218 lines
8.1 KiB
XML
218 lines
8.1 KiB
XML
<?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="cn.com.tenlion.commonpopulation.dao.addicts.IAddictsDao">
|
|
|
|
<resultMap id="addictsDTO" type="cn.com.tenlion.commonpopulation.pojo.dtos.addicts.AddictsDTO">
|
|
<id column="addicts_id" property="addictsId"/>
|
|
<result column="full_name" property="fullName"/>
|
|
<result column="id_card_number" property="idCardNumber"/>
|
|
<result column="control_info" property="controlInfo"/>
|
|
<result column="crime_info" property="crimeInfo"/>
|
|
<result column="discovery_date" property="discoveryDate"/>
|
|
<result column="help_user_phone" property="helpUserPhone"/>
|
|
<result column="control_user_name" property="controlUserName"/>
|
|
<result column="has_crime_his" property="hasCrimeHis"/>
|
|
<result column="drug_result" property="drugResult"/>
|
|
<result column="help_user_name" property="helpUserName"/>
|
|
<result column="control_user_phone" property="controlUserPhone"/>
|
|
<result column="help_info" property="helpInfo"/>
|
|
<result column="drug_reason" property="drugReason"/>
|
|
<result column="area_id" property="areaId"/>
|
|
<result column="area_code" property="areaCode"/>
|
|
<result column="area_names" property="areaNames"/>
|
|
<result column="grid_id" property="gridId"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增特殊人群-吸毒人员 -->
|
|
<insert id="saveAddicts" parameterType="map">
|
|
INSERT INTO gen_addicts(
|
|
addicts_id, full_name, id_card_number, control_info, crime_info, discovery_date,
|
|
help_user_phone, control_user_name, has_crime_his, drug_result, help_user_name,
|
|
control_user_phone, help_info, drug_reason, creator, gmt_create, modifier, gmt_modified,
|
|
is_delete, area_id, area_code, area_names, grid_id
|
|
) VALUES(
|
|
#{addictsId}, #{fullName}, #{idCardNumber}, #{controlInfo}, #{crimeInfo}, #{discoveryDate},
|
|
#{helpUserPhone}, #{controlUserName}, #{hasCrimeHis}, #{drugResult}, #{helpUserName},
|
|
#{controlUserPhone}, #{helpInfo}, #{drugReason}, #{creator}, #{gmtCreate}, #{modifier},
|
|
#{gmtModified}, #{isDelete}, #{areaId}, #{areaCode}, #{areaNames}, #{gridId}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除特殊人群-吸毒人员 -->
|
|
<update id="removeAddicts" parameterType="map">
|
|
UPDATE
|
|
gen_addicts
|
|
SET
|
|
is_delete = 1,
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
addicts_id IN
|
|
<foreach collection="addictsIds" index="index" open="(" separator="," close=")">
|
|
#{addictsIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除特殊人群-吸毒人员(物理) -->
|
|
<update id="deleteAddicts" parameterType="map">
|
|
DELETE FROM
|
|
gen_addicts
|
|
WHERE
|
|
addicts_id IN
|
|
<foreach collection="addictsIds" index="index" open="(" separator="," close=")">
|
|
#{addictsIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改特殊人群-吸毒人员 -->
|
|
<update id="updateAddicts" parameterType="map">
|
|
UPDATE
|
|
gen_addicts
|
|
SET
|
|
<if test="fullName != null and fullName != ''">
|
|
full_name = #{fullName},
|
|
</if>
|
|
<if test="idCardNumber != null and idCardNumber != ''">
|
|
id_card_number = #{idCardNumber},
|
|
</if>
|
|
<if test="controlInfo != null and controlInfo != ''">
|
|
control_info = #{controlInfo},
|
|
</if>
|
|
<if test="crimeInfo != null and crimeInfo != ''">
|
|
crime_info = #{crimeInfo},
|
|
</if>
|
|
<if test="discoveryDate != null and discoveryDate != ''">
|
|
discovery_date = #{discoveryDate},
|
|
</if>
|
|
<if test="helpUserPhone != null and helpUserPhone != ''">
|
|
help_user_phone = #{helpUserPhone},
|
|
</if>
|
|
<if test="controlUserName != null and controlUserName != ''">
|
|
control_user_name = #{controlUserName},
|
|
</if>
|
|
<if test="hasCrimeHis != null and hasCrimeHis != ''">
|
|
has_crime_his = #{hasCrimeHis},
|
|
</if>
|
|
<if test="drugResult != null and drugResult != ''">
|
|
drug_result = #{drugResult},
|
|
</if>
|
|
<if test="helpUserName != null and helpUserName != ''">
|
|
help_user_name = #{helpUserName},
|
|
</if>
|
|
<if test="controlUserPhone != null and controlUserPhone != ''">
|
|
control_user_phone = #{controlUserPhone},
|
|
</if>
|
|
<if test="helpInfo != null and helpInfo != ''">
|
|
help_info = #{helpInfo},
|
|
</if>
|
|
<if test="drugReason != null and drugReason != ''">
|
|
drug_reason = #{drugReason},
|
|
</if>
|
|
<if test="areaId != null and areaId != ''">
|
|
area_id = #{areaId},
|
|
</if>
|
|
<if test="areaCode != null and areaCode != ''">
|
|
area_code = #{areaCode},
|
|
</if>
|
|
<if test="areaNames != null and areaNames != ''">
|
|
area_names = #{areaNames},
|
|
</if>
|
|
<if test="gridId != null and gridId != ''">
|
|
grid_id = #{gridId},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
addicts_id = #{addictsId}
|
|
</update>
|
|
|
|
<!-- 特殊人群-吸毒人员详情 -->
|
|
<select id="getAddicts" parameterType="map" resultMap="addictsDTO">
|
|
SELECT
|
|
t1.addicts_id,
|
|
t1.full_name,
|
|
t1.id_card_number,
|
|
t1.control_info,
|
|
t1.crime_info,
|
|
t1.discovery_date,
|
|
t1.help_user_phone,
|
|
t1.control_user_name,
|
|
t1.has_crime_his,
|
|
t1.drug_result,
|
|
t1.help_user_name,
|
|
t1.control_user_phone,
|
|
t1.help_info,
|
|
t1.drug_reason,
|
|
t1.area_id,
|
|
t1.area_code,
|
|
t1.area_names,
|
|
t1.grid_id
|
|
FROM
|
|
gen_addicts t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="addictsId != null and addictsId != ''">
|
|
AND t1.addicts_id = #{addictsId}
|
|
</if>
|
|
<if test="idCardNumber != null and idCardNumber != ''">
|
|
AND t1.id_card_number = #{idCardNumber}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 特殊人群-吸毒人员列表 -->
|
|
<select id="listAddicts" parameterType="map" resultMap="addictsDTO">
|
|
SELECT
|
|
t1.addicts_id,
|
|
t1.full_name,
|
|
t1.id_card_number,
|
|
t1.control_info,
|
|
t1.crime_info,
|
|
t1.discovery_date,
|
|
t1.help_user_phone,
|
|
t1.control_user_name,
|
|
t1.has_crime_his,
|
|
t1.drug_result,
|
|
t1.help_user_name,
|
|
t1.control_user_phone,
|
|
t1.help_info,
|
|
t1.drug_reason,
|
|
t1.area_id,
|
|
t1.area_code,
|
|
t1.area_names,
|
|
t1.grid_id
|
|
FROM
|
|
gen_addicts t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="fullName != null and fullName !=''">
|
|
AND t1.full_name LIKE CONCAT('%', #{fullName}, '%')
|
|
</if>
|
|
<if test="idCardNumber !=null and idCardNumber !=''">
|
|
AND t1.id_card_number LIKE CONCAT('%', #{idCardNumber}, '%')
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike != ''">
|
|
AND t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</if>
|
|
<if test="gridId != null and gridId != ''">
|
|
AND t1.grid_id = #{gridId}
|
|
</if>
|
|
ORDER BY t1.gmt_create DESC
|
|
</select>
|
|
|
|
<!-- 特殊人群-吸毒人员统计 -->
|
|
<select id="countAddicts" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
gen_addicts t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="areaCode != null and areaCode != ''">
|
|
AND t1.area_code = #{areaCode}
|
|
</if>
|
|
<if test="areaCodeLike != null and areaCodeLike !=''">
|
|
AND t1.area_code LIKE CONCAT(#{areaCodeLike}, '%')
|
|
</if>
|
|
</select>
|
|
|
|
</mapper> |