Commit 492c21fb authored by 耿迪迪's avatar 耿迪迪
parents 0fce269e 0f3d440b
package com.zehong.web.controller.common;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.system.service.IDistrictPlanningService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 行政区规划controller
*/
@RestController
@RequestMapping("/districtPlanning")
public class DistrictPlanningController {
@Resource
IDistrictPlanningService districtPlanningService;
/**
* 查询监督检查列表
*/
@GetMapping("/listCountyByDict")
public AjaxResult listCountyByDict(){
return AjaxResult.success(districtPlanningService.listCountyByDict());
}
}
......@@ -34,6 +34,9 @@ public class TCountyLevelRegion extends BaseEntity
@Excel(name = "0 否,1 是")
private Long fIsMajor;
// 排序
private Long seq;
public void setfId(Long fId)
{
this.fId = fId;
......@@ -80,6 +83,14 @@ public class TCountyLevelRegion extends BaseEntity
return fIsMajor;
}
public Long getSeq() {
return seq;
}
public void setSeq(Long seq) {
this.seq = seq;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -36,6 +36,13 @@ public interface SysDictDataMapper
*/
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
/**
* 根据 标签查询
* @param dictType d
* @return r
*/
public SysDictData selectDictDataByLabel(String dictType);
/**
* 根据字典数据ID查询信息
*
......
......@@ -27,6 +27,13 @@ public interface TCountyLevelRegionMapper
*/
public List<TCountyLevelRegion> selectTCountyLevelRegionList(TCountyLevelRegion tCountyLevelRegion);
/**
* 根据city_code 查询
* @param fCityId c
* @return r
*/
public List<TCountyLevelRegion> queryByCityId(String fCityId);
/**
* 新增县级行政区
*
......
package com.zehong.system.service;
import com.zehong.system.domain.TCountyLevelRegion;
import java.util.List;
/**
* 行政区规划service
*
* @author zehong
* @date 2024-07-01
*/
public interface IDistrictPlanningService {
List<TCountyLevelRegion> listCountyByDict();
}
......@@ -18,6 +18,13 @@ public interface ISysDictDataService
*/
public List<SysDictData> selectDictDataList(SysDictData dictData);
/**
* 根据标签查询
* @param dictLable d
* @return r
*/
public SysDictData selectByLable(String dictLable);
/**
* 根据字典类型和字典键值查询字典数据信息
*
......
package com.zehong.system.service.impl;
import com.zehong.common.core.domain.entity.SysDictData;
import com.zehong.system.domain.TCountyLevelRegion;
import com.zehong.system.mapper.TCityLevelRegionMapper;
import com.zehong.system.mapper.TCountyLevelRegionMapper;
import com.zehong.system.service.IDistrictPlanningService;
import com.zehong.system.service.ISysDictDataService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: zehong
* @Date: 2024/7/1 17:44
*/
@Service
public class DistrictPlanningServiceImpl implements IDistrictPlanningService {
@Resource
private TCityLevelRegionMapper cityLevelRegionMapper;
@Resource
private TCountyLevelRegionMapper countyLevelRegionMapper;
@Resource
private ISysDictDataService sysDictDataService;
/**
* 根据配置的 市查询 县-区数据 city_under_admin_plan city_code
* @return r
*/
@Override
public List<TCountyLevelRegion> listCountyByDict() {
SysDictData city_code = sysDictDataService.selectByLable("city_code");
String dictValue = city_code.getDictValue();
return countyLevelRegionMapper.queryByCityId(dictValue);
}
}
......@@ -31,6 +31,12 @@ public class SysDictDataServiceImpl implements ISysDictDataService
return dictDataMapper.selectDictDataList(dictData);
}
@Override
public SysDictData selectByLable(String dictLable) {
return dictDataMapper.selectDictDataByLabel(dictLable);
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
......
......@@ -50,6 +50,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataByLabel" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where dict_label = #{dictType}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
......
......@@ -10,10 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="fCountyCode" column="f_county_code" />
<result property="fName" column="f_name" />
<result property="fIsMajor" column="f_is_major" />
<result property="seq" column="f_sql" />
</resultMap>
<sql id="selectTCountyLevelRegionVo">
select f_id, f_city_id, f_county_code, f_name, f_is_major from t_county_level_region
select f_id, f_city_id, f_county_code, f_name, f_is_major ,f_sql from t_county_level_region
</sql>
<select id="selectTCountyLevelRegionList" parameterType="TCountyLevelRegion" resultMap="TCountyLevelRegionResult">
......@@ -25,6 +26,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fIsMajor != null "> and f_is_major = #{fIsMajor}</if>
</where>
</select>
<select id="queryByCityId" resultMap="TCountyLevelRegionResult">
<include refid="selectTCountyLevelRegionVo"/>
where f_city_id = #{fCityId}
</select>
<select id="selectTCountyLevelRegionById" parameterType="Long" resultMap="TCountyLevelRegionResult">
<include refid="selectTCountyLevelRegionVo"/>
......@@ -39,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fCountyCode != null and fCountyCode != ''">f_county_code,</if>
<if test="fName != null and fName != ''">f_name,</if>
<if test="fIsMajor != null">f_is_major,</if>
<if test="seq != null">f_seq,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fId != null">#{fId},</if>
......@@ -46,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fCountyCode != null and fCountyCode != ''">#{fCountyCode},</if>
<if test="fName != null and fName != ''">#{fName},</if>
<if test="fIsMajor != null">#{fIsMajor},</if>
<if test="seq != null">#{seq},</if>
</trim>
</insert>
......@@ -77,7 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
f_city_id,
f_county_code,
f_name,
f_is_major
f_is_major,
f_sql
)VALUES
<foreach collection="list" separator="," item="item">
(
......@@ -85,7 +93,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.fCityId},
#{item.fCountyCode},
#{item.fName},
#{item.fIsMajor}
#{item.fIsMajor},
#{item.sql}
)
</foreach>
</insert>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment