主播信息入库添加 userId 字段,添加国家信息接口
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.yupi.springbootinit.controller;
|
||||
|
||||
import com.yupi.springbootinit.common.BaseResponse;
|
||||
import com.yupi.springbootinit.common.ResultUtils;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
import com.yupi.springbootinit.service.CountryInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 13:44
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
@Slf4j
|
||||
@CrossOrigin
|
||||
public class CommonController {
|
||||
|
||||
@Resource
|
||||
private CountryInfoService countryInfoService;
|
||||
|
||||
@PostMapping("country_info")
|
||||
public BaseResponse<List<CountryInfoVO>> countryInfo() {
|
||||
|
||||
return ResultUtils.success(countryInfoService.getCountryList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yupi.springbootinit.mapper;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yupi.springbootinit.model.entity.CountryInfo;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 13:58
|
||||
*/
|
||||
|
||||
public interface CountryInfoMapper extends BaseMapper<CountryInfo> {
|
||||
|
||||
List<CountryInfoVO> selectByCountryGroupName();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.yupi.springbootinit.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 13:58
|
||||
*/
|
||||
|
||||
/**
|
||||
* 国家与地区信息统计
|
||||
*/
|
||||
@ApiModel(description = "国家与地区信息统计")
|
||||
@Data
|
||||
@TableName(value = "country_info")
|
||||
public class CountryInfo {
|
||||
/**
|
||||
* 主键id,无业务含义
|
||||
*/
|
||||
@ApiModelProperty(value = "主键id,无业务含义")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 国家id
|
||||
*/
|
||||
@TableId(value = "country_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "国家id")
|
||||
private String countryId;
|
||||
|
||||
/**
|
||||
* 业务区与地区码
|
||||
*/
|
||||
@TableField(value = "country_group")
|
||||
@ApiModelProperty(value = "业务区与地区码")
|
||||
private String countryGroup;
|
||||
|
||||
/**
|
||||
* 业务区与地区名称
|
||||
*/
|
||||
@TableField(value = "country_group_name")
|
||||
@ApiModelProperty(value = "业务区与地区名称")
|
||||
private String countryGroupName;
|
||||
|
||||
/**
|
||||
* 国家名称
|
||||
*/
|
||||
@TableField(value = "country_name")
|
||||
@ApiModelProperty(value = "国家名称")
|
||||
private String countryName;
|
||||
|
||||
/**
|
||||
* 语言
|
||||
*/
|
||||
@TableField(value = "`language`")
|
||||
@ApiModelProperty(value = "语言")
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 语言中文
|
||||
*/
|
||||
@TableField(value = "language_name")
|
||||
@ApiModelProperty(value = "语言中文")
|
||||
private String languageName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@TableField(value = "creator")
|
||||
@ApiModelProperty(value = "创建人id")
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "update_time")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
@TableField(value = "updater")
|
||||
@ApiModelProperty(value = "更新人id")
|
||||
private String updater;
|
||||
}
|
||||
@@ -72,6 +72,11 @@ public class NewHosts {
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 用户 Id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 入库人
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.yupi.springbootinit.model.vo.country;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 13:58
|
||||
*/
|
||||
|
||||
/**
|
||||
* 国家与地区信息统计
|
||||
*/
|
||||
@ApiModel(description = "国家与地区信息统计")
|
||||
@Data
|
||||
@TableName(value = "country_info")
|
||||
public class CountryInfoVO {
|
||||
/**
|
||||
* 国家id
|
||||
*/
|
||||
@TableId(value = "country_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "国家id")
|
||||
private String countryId;
|
||||
|
||||
/**
|
||||
* 业务区与地区码
|
||||
*/
|
||||
@TableField(value = "country_group")
|
||||
@ApiModelProperty(value = "业务区与地区码")
|
||||
private String countryGroup;
|
||||
|
||||
/**
|
||||
* 业务区与地区名称
|
||||
*/
|
||||
@TableField(value = "country_group_name")
|
||||
@ApiModelProperty(value = "业务区与地区名称")
|
||||
private String countryGroupName;
|
||||
|
||||
/**
|
||||
* 国家名称
|
||||
*/
|
||||
@TableField(value = "country_name")
|
||||
@ApiModelProperty(value = "国家名称")
|
||||
private String countryName;
|
||||
|
||||
/**
|
||||
* 语言
|
||||
*/
|
||||
@TableField(value = "`language`")
|
||||
@ApiModelProperty(value = "语言")
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 语言中文
|
||||
*/
|
||||
@TableField(value = "language_name")
|
||||
@ApiModelProperty(value = "语言中文")
|
||||
private String languageName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yupi.springbootinit.service;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 13:57
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yupi.springbootinit.model.entity.CountryInfo;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CountryInfoService extends IService<CountryInfo> {
|
||||
|
||||
List<CountryInfoVO> getCountryList();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yupi.springbootinit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yupi.springbootinit.model.entity.CountryInfo;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.yupi.springbootinit.mapper.CountryInfoMapper;
|
||||
import com.yupi.springbootinit.service.CountryInfoService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 13:57
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CountryInfoServiceImpl extends ServiceImpl<CountryInfoMapper, CountryInfo> implements CountryInfoService{
|
||||
|
||||
@Resource
|
||||
private CountryInfoMapper countryInfoMapper;
|
||||
|
||||
@Override
|
||||
public List<CountryInfoVO> getCountryList() {
|
||||
return countryInfoMapper.selectByCountryGroupName();
|
||||
}
|
||||
}
|
||||
42
src/main/resources/mapper/CountryInfoMapper.xml
Normal file
42
src/main/resources/mapper/CountryInfoMapper.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yupi.springbootinit.mapper.CountryInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.yupi.springbootinit.model.entity.CountryInfo">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table country_info-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<id column="country_id" jdbcType="VARCHAR" property="countryId" />
|
||||
<result column="country_group" jdbcType="VARCHAR" property="countryGroup" />
|
||||
<result column="country_group_name" jdbcType="VARCHAR" property="countryGroupName" />
|
||||
<result column="country_name" jdbcType="VARCHAR" property="countryName" />
|
||||
<result column="language" jdbcType="VARCHAR" property="language" />
|
||||
<result column="language_name" jdbcType="VARCHAR" property="languageName" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="updater" jdbcType="VARCHAR" property="updater" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="CountryInfoVOMap" type="com.yupi.springbootinit.model.vo.country.CountryInfoVO">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table country_info-->
|
||||
<id column="country_id" jdbcType="VARCHAR" property="countryId" />
|
||||
<result column="country_group" jdbcType="VARCHAR" property="countryGroup" />
|
||||
<result column="country_group_name" jdbcType="VARCHAR" property="countryGroupName" />
|
||||
<result column="country_name" jdbcType="VARCHAR" property="countryName" />
|
||||
<result column="language" jdbcType="VARCHAR" property="language" />
|
||||
<result column="language_name" jdbcType="VARCHAR" property="languageName" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, country_id, country_group, country_group_name, country_name, `language`, language_name,
|
||||
create_time, creator, update_time, updater
|
||||
</sql>
|
||||
|
||||
<!--auto generated by MybatisCodeHelper on 2025-06-13-->
|
||||
<select id="selectByCountryGroupName" resultMap="CountryInfoVOMap">
|
||||
select *
|
||||
from country_info
|
||||
group by country_group_name;
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -20,6 +20,7 @@
|
||||
<result column="updater" jdbcType="VARCHAR" property="updater" />
|
||||
<result column="online_fans" jdbcType="INTEGER" property="onlineFans"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="user_id" jdbcType="BIGINT" property="userId"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="HostInfoVo" type="com.yupi.springbootinit.model.vo.hosts.NewHostsVO">
|
||||
@@ -42,7 +43,7 @@
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum, yesterday_coins,
|
||||
country, hosts_kind, tenant_id, creator, create_time, updater, update_time
|
||||
country, hosts_kind, tenant_id, creator, create_time, updater, update_time, user_id
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
@@ -61,12 +62,12 @@
|
||||
insert into new_hosts (hosts_id, hosts_level, hosts_coins,
|
||||
Invitation_type, fans, fllowernum,
|
||||
yesterday_coins, country, hosts_kind,
|
||||
tenant_id, creator
|
||||
tenant_id, creator, user_id
|
||||
)
|
||||
values (#{hostsId,jdbcType=VARCHAR}, #{hostsLevel,jdbcType=VARCHAR}, #{hostsCoins,jdbcType=INTEGER},
|
||||
#{invitationType,jdbcType=INTEGER}, #{fans,jdbcType=INTEGER}, #{fllowernum,jdbcType=INTEGER},
|
||||
#{yesterdayCoins,jdbcType=INTEGER}, #{country,jdbcType=VARCHAR}, #{hostsKind,jdbcType=VARCHAR},
|
||||
#{tenantId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT})
|
||||
#{tenantId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yupi.springbootinit.model.entity.NewHosts" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
@@ -232,13 +233,13 @@
|
||||
<!--@mbg.generated-->
|
||||
insert into new_hosts
|
||||
(hosts_id, hosts_level, hosts_coins, Invitation_type, fans, fllowernum, yesterday_coins,
|
||||
country, hosts_kind, tenant_id, creator)
|
||||
country, hosts_kind, tenant_id, creator, user_id)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.hostsId,jdbcType=VARCHAR}, #{item.hostsLevel,jdbcType=VARCHAR}, #{item.hostsCoins,jdbcType=INTEGER},
|
||||
#{item.invitationType,jdbcType=INTEGER}, #{item.fans,jdbcType=INTEGER}, #{item.fllowernum,jdbcType=INTEGER},
|
||||
#{item.yesterdayCoins,jdbcType=INTEGER}, #{item.country,jdbcType=VARCHAR}, #{item.hostsKind,jdbcType=VARCHAR},
|
||||
#{item.tenantId,jdbcType=BIGINT}, #{item.creator,jdbcType=INTEGER})
|
||||
#{item.tenantId,jdbcType=BIGINT}, #{item.creator,jdbcType=INTEGER},#{item.userId,jdbcType=BIGINT})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user