feat: 行政区管理&根据级别和父级行政区编码查询行政区下拉
This commit is contained in:
parent
f25d0cf421
commit
ca1a9f75a6
@ -0,0 +1,27 @@
|
||||
package com.yfd.platform.qgc_base.controller;
|
||||
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_base.domain.SdAddvcdDicDropdownRequest;
|
||||
import com.yfd.platform.qgc_base.service.ISdAddvcdDicService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/env/addvcd")
|
||||
@Tag(name = "行政区管理")
|
||||
public class SdAddvcdDicController {
|
||||
|
||||
@Resource
|
||||
private ISdAddvcdDicService addvcdDicService;
|
||||
|
||||
@PostMapping("/selectForDropdown")
|
||||
@Operation(summary = "根据级别和父级行政区编码查询行政区下拉")
|
||||
public ResponseResult selectForDropdown(@RequestBody SdAddvcdDicDropdownRequest request) {
|
||||
return ResponseResult.successData(addvcdDicService.selectForDropdown(request.getGrd(), request.getPaddvcd()));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.yfd.platform.qgc_base.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区字典表
|
||||
* </p>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("SD_ADDVCD_DIC")
|
||||
public class SdAddvcdDic implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 行政区编码
|
||||
*/
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String addvcd;
|
||||
|
||||
/**
|
||||
* 行政区划名称
|
||||
*/
|
||||
private String addvnm;
|
||||
|
||||
/**
|
||||
* 所属行政编码,根节点为空
|
||||
*/
|
||||
private String paddvcd;
|
||||
|
||||
/**
|
||||
* 树级别,从1开始 1=省 2=市 3=县
|
||||
*/
|
||||
private Integer grd;
|
||||
|
||||
/**
|
||||
* 树全路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderIndex;
|
||||
|
||||
/**
|
||||
* 中心经度
|
||||
*/
|
||||
private Double lgtd;
|
||||
|
||||
/**
|
||||
* 中心纬度
|
||||
*/
|
||||
private Double lttd;
|
||||
|
||||
/**
|
||||
* 面积
|
||||
*/
|
||||
private Double area;
|
||||
|
||||
/**
|
||||
* 周长
|
||||
*/
|
||||
private Double perimeter;
|
||||
|
||||
/**
|
||||
* 所属国家
|
||||
*/
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
private String introduce;
|
||||
|
||||
/**
|
||||
* 介绍图片
|
||||
*/
|
||||
private String inffile;
|
||||
|
||||
/**
|
||||
* 简称
|
||||
*/
|
||||
private String shortname;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.yfd.platform.qgc_base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SdAddvcdDicDropdownRequest {
|
||||
|
||||
/**
|
||||
* 树级别,从1开始 1=省 2=市 3=县
|
||||
*/
|
||||
private Integer grd;
|
||||
|
||||
/**
|
||||
* 所属行政编码,根节点为空
|
||||
*/
|
||||
private String paddvcd;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.yfd.platform.qgc_base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.qgc_base.domain.SdAddvcdDic;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区字典表 Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
public interface SdAddvcdDicMapper extends BaseMapper<SdAddvcdDic> {
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.yfd.platform.qgc_base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.platform.qgc_base.domain.SdAddvcdDic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区字典表 服务类
|
||||
* </p>
|
||||
*/
|
||||
public interface ISdAddvcdDicService extends IService<SdAddvcdDic> {
|
||||
|
||||
/**
|
||||
* 根据级别和父级行政区编码查询下拉数据
|
||||
*/
|
||||
List<SdAddvcdDic> selectForDropdown(Integer grd, String paddvcd);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yfd.platform.qgc_base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.qgc_base.domain.SdAddvcdDic;
|
||||
import com.yfd.platform.qgc_base.mapper.SdAddvcdDicMapper;
|
||||
import com.yfd.platform.qgc_base.service.ISdAddvcdDicService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行政区字典表 服务实现类
|
||||
* </p>
|
||||
*/
|
||||
@Service
|
||||
public class SdAddvcdDicServiceImpl extends ServiceImpl<SdAddvcdDicMapper, SdAddvcdDic> implements ISdAddvcdDicService {
|
||||
|
||||
@Override
|
||||
public List<SdAddvcdDic> selectForDropdown(Integer grd, String paddvcd) {
|
||||
return this.lambdaQuery()
|
||||
.eq(grd != null, SdAddvcdDic::getGrd, grd)
|
||||
.eq(StringUtils.hasText(paddvcd), SdAddvcdDic::getPaddvcd, paddvcd)
|
||||
.orderByAsc(SdAddvcdDic::getOrderIndex)
|
||||
.list();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user