first commit
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
<?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.mhd.basic.domain.areaAggregate.repository.mapper.SysCountyMapper">
|
||||
<sql id="selectVo">
|
||||
SELECT a.county_id,
|
||||
a.county_code,
|
||||
a.county_code_new,
|
||||
a.city_code,
|
||||
a.county_name,
|
||||
a.county_remark,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag
|
||||
FROM `sys_county` a
|
||||
WHERE a.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO"
|
||||
resultType="com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity">
|
||||
<include refid="selectVo"></include>
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
<select id="selectCountyAreaList"
|
||||
parameterType="com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO"
|
||||
resultType="com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO">
|
||||
SELECT a.county_id as areaId,
|
||||
a.city_code as parentAreaCode,
|
||||
a.county_code as areaCode,
|
||||
a.county_code_new as areaCodeNew,
|
||||
a.county_name as areaName,
|
||||
a.county_remark as areaRemark,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag
|
||||
FROM
|
||||
`sys_county` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
|
||||
<select id="findById" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity">
|
||||
<include refid="selectVo"></include>
|
||||
and a.county_id = #{value}
|
||||
</select>
|
||||
<select id="findByCountyCode" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity">
|
||||
<include refid="selectVo"></include>
|
||||
and a.county_code = #{value}
|
||||
</select>
|
||||
|
||||
<select id="findCountyMaxCode" parameterType="java.lang.Long"
|
||||
resultType="com.mhd.basic.domain.areaAggregate.entity.SysCountyEntity">
|
||||
SELECT county_id,
|
||||
county_code,
|
||||
county_code_new,
|
||||
city_code,
|
||||
county_name,
|
||||
county_remark
|
||||
FROM `sys_county`
|
||||
WHERE city_code = #{values}
|
||||
ORDER BY county_code_new DESC LIMIT 1
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="countyId !=null and countyId !='' ">
|
||||
and a.county_id = #{countyId}
|
||||
</if>
|
||||
<if test="countyCode !=null and countyCode !='' ">
|
||||
and a.county_code = #{countyCode}
|
||||
</if>
|
||||
<if test="cityCodeNew !=null and cityCodeNew !='' ">
|
||||
and a.city_code_new = #{cityCodeNew}
|
||||
</if>
|
||||
<if test="cityCode !=null and cityCode !='' ">
|
||||
and a.city_code = #{cityCode}
|
||||
</if>
|
||||
<if test="provinceCode !=null and provinceCode !='' ">
|
||||
and a.province_code = #{provinceCode}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 根据县区编码查询省市县名称 -->
|
||||
<select id="findAreaInfo" parameterType="com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO"
|
||||
resultType="com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO">
|
||||
SELECT
|
||||
a.county_id AS areaId,
|
||||
a.city_code AS parentAreaCode,
|
||||
a.county_code AS areaCode,
|
||||
a.county_code_new AS areaCodeNew,
|
||||
a.county_name AS areaName,
|
||||
a.county_remark AS areaRemark,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag,
|
||||
c.province_name as provinceName,
|
||||
b.city_name as cityName,
|
||||
a.county_name as countyName,
|
||||
CONCAT( c.province_name, b.city_name, a.county_name ) AS provinceCityCountyName
|
||||
FROM
|
||||
`sys_county` a
|
||||
LEFT JOIN sys_city b ON a.city_code = b.city_code
|
||||
LEFT JOIN sys_province c ON b.province_code = c.province_code
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
|
||||
<select id="findAreaInfoByCityCode" resultType="com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO" parameterType="com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO">
|
||||
SELECT
|
||||
a.city_id AS areaId,
|
||||
a.province_code AS parentAreaCode,
|
||||
a.city_code AS areaCode,
|
||||
a.city_code_new AS areaCodeNew,
|
||||
a.city_name AS areaName,
|
||||
a.city_remark AS areaRemark,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag,
|
||||
CONCAT( b.province_name, a.city_name ) AS provinceCityCountyName
|
||||
FROM
|
||||
sys_city a
|
||||
LEFT JOIN sys_province b ON a.province_code = b.province_code
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
|
||||
<select id="findAreaInfoByProvince" resultType="com.mhd.basic.domain.areaAggregate.repository.po.SysAreaPO" parameterType="com.mhd.basic.domain.areaAggregate.repository.todo.SysProvinceCityCountyDO">
|
||||
SELECT
|
||||
a.province_id AS areaId,
|
||||
a.province_code AS areaCode,
|
||||
a.province_name AS areaName,
|
||||
a.province_remark AS areaRemark,
|
||||
a.create_time,
|
||||
a.create_by,
|
||||
a.create_by_name,
|
||||
a.update_time,
|
||||
a.update_by,
|
||||
a.update_by_name,
|
||||
a.del_flag,
|
||||
a.province_name AS provinceCityCountyName
|
||||
FROM
|
||||
sys_province a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user