获取国家下属的所有国家
This commit is contained in:
@@ -4,10 +4,12 @@ import com.yupi.springbootinit.common.BaseResponse;
|
||||
import com.yupi.springbootinit.common.ResultUtils;
|
||||
import com.yupi.springbootinit.model.dto.host.HostInfoDTO;
|
||||
import com.yupi.springbootinit.model.entity.NewHosts;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
|
||||
import com.yupi.springbootinit.rabbitMQ.MQSender;
|
||||
import com.yupi.springbootinit.service.HostInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -26,10 +28,20 @@ public class HostInfoController {
|
||||
@Resource
|
||||
private MQSender mqSender;
|
||||
|
||||
@Resource
|
||||
private HostInfoService hostInfoService;
|
||||
|
||||
@PostMapping("add_host")
|
||||
public BaseResponse<Boolean> addHost(@RequestBody List<NewHosts> newHosts){
|
||||
mqSender.send(newHosts);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
@GetMapping("host_info")
|
||||
public BaseResponse<List<CountryInfoVO>> getCountryInfo(@Param("countryName") String countryName){
|
||||
|
||||
return ResultUtils.success(hostInfoService.getCountryInfo(countryName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yupi.springbootinit.mapper;
|
||||
|
||||
import com.yupi.springbootinit.model.entity.CountryInfo;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 15:26
|
||||
*/
|
||||
|
||||
public interface CountryInfoMapper {
|
||||
int deleteByPrimaryKey(@Param("id") Integer id, @Param("countryId") String countryId);
|
||||
|
||||
int insert(CountryInfo record);
|
||||
|
||||
int insertSelective(CountryInfo record);
|
||||
|
||||
CountryInfo selectByPrimaryKey(@Param("id") Integer id, @Param("countryId") String countryId);
|
||||
|
||||
int updateByPrimaryKeySelective(CountryInfo record);
|
||||
|
||||
int updateByPrimaryKey(CountryInfo record);
|
||||
|
||||
List<CountryInfoVO> selectCountryGroupCountryByCountryName(String countryName);
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.yupi.springbootinit.model.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 15:26
|
||||
*/
|
||||
|
||||
/**
|
||||
* 国家与地区信息统计
|
||||
*/
|
||||
public class CountryInfo {
|
||||
/**
|
||||
* 主键id,无业务含义
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 国家id
|
||||
*/
|
||||
private String countryId;
|
||||
|
||||
/**
|
||||
* 业务区与地区码
|
||||
*/
|
||||
private String countryGroup;
|
||||
|
||||
/**
|
||||
* 业务区与地区名称
|
||||
*/
|
||||
private String countryGroupName;
|
||||
|
||||
/**
|
||||
* 国家名称
|
||||
*/
|
||||
private String countryName;
|
||||
|
||||
/**
|
||||
* 语言
|
||||
*/
|
||||
private String language;
|
||||
|
||||
/**
|
||||
* 语言中文
|
||||
*/
|
||||
private String languageName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private String creator;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private String updater;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCountryId() {
|
||||
return countryId;
|
||||
}
|
||||
|
||||
public void setCountryId(String countryId) {
|
||||
this.countryId = countryId;
|
||||
}
|
||||
|
||||
public String getCountryGroup() {
|
||||
return countryGroup;
|
||||
}
|
||||
|
||||
public void setCountryGroup(String countryGroup) {
|
||||
this.countryGroup = countryGroup;
|
||||
}
|
||||
|
||||
public String getCountryGroupName() {
|
||||
return countryGroupName;
|
||||
}
|
||||
|
||||
public void setCountryGroupName(String countryGroupName) {
|
||||
this.countryGroupName = countryGroupName;
|
||||
}
|
||||
|
||||
public String getCountryName() {
|
||||
return countryName;
|
||||
}
|
||||
|
||||
public void setCountryName(String countryName) {
|
||||
this.countryName = countryName;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
public String getLanguageName() {
|
||||
return languageName;
|
||||
}
|
||||
|
||||
public void setLanguageName(String languageName) {
|
||||
this.languageName = languageName;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getUpdater() {
|
||||
return updater;
|
||||
}
|
||||
|
||||
public void setUpdater(String updater) {
|
||||
this.updater = updater;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.yupi.springbootinit.model.vo.country;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/6/13 15:23
|
||||
*/
|
||||
@Data
|
||||
public class CountryInfoVO {
|
||||
private String countryName;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ package com.yupi.springbootinit.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yupi.springbootinit.model.dto.host.HostInfoDTO;
|
||||
import com.yupi.springbootinit.model.entity.NewHosts;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,9 +16,10 @@ import java.util.concurrent.CompletableFuture;
|
||||
*/
|
||||
public interface HostInfoService extends IService<NewHosts> {
|
||||
|
||||
public CompletableFuture<Void> saveHostInfo(List<NewHosts> newHosts);
|
||||
CompletableFuture<Void> saveHostInfo(List<NewHosts> newHosts);
|
||||
|
||||
public CompletableFuture<Void> processHosts(List<NewHosts> hosts);
|
||||
CompletableFuture<Void> processHosts(List<NewHosts> hosts);
|
||||
|
||||
List<NewHostsVO> getConditionHosts(HostInfoDTO hostInfoDTO);
|
||||
|
||||
List<CountryInfoVO> getCountryInfo(String countryName);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.yupi.springbootinit.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.yupi.springbootinit.mapper.CountryInfoMapper;
|
||||
import com.yupi.springbootinit.mapper.NewHostsMapper;
|
||||
import com.yupi.springbootinit.model.dto.host.HostInfoDTO;
|
||||
import com.yupi.springbootinit.model.entity.NewHosts;
|
||||
import com.yupi.springbootinit.model.vo.country.CountryInfoVO;
|
||||
import com.yupi.springbootinit.model.vo.hosts.NewHostsVO;
|
||||
import com.yupi.springbootinit.service.HostInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -13,6 +15,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -26,6 +29,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class HostInfoServiceImpl extends ServiceImpl<NewHostsMapper, NewHosts> implements HostInfoService {
|
||||
|
||||
@Resource
|
||||
private CountryInfoMapper countryInfoMapper;
|
||||
|
||||
@Override
|
||||
@Async("taskExecutor")
|
||||
@@ -80,8 +85,10 @@ public class HostInfoServiceImpl extends ServiceImpl<NewHostsMapper, NewHosts> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NewHostsVO> getConditionHosts(HostInfoDTO hostInfoDTO) {
|
||||
|
||||
public List<CountryInfoVO> getCountryInfo(String countryName) {
|
||||
countryInfoMapper.selectCountryGroupCountryByCountryName(countryName);
|
||||
return List.of();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user