btxtgxq-system-population/src/main/resources/mybatis/mapper/security/security-mapper.xml
2023-11-06 11:58:00 +08:00

465 lines
15 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="com.cm.population.dao.security.ISecurityDao">
<resultMap id="securityDTO" type="com.cm.population.pojo.dtos.security.SecurityDTO">
<result column="security_id" property="securityId"/>
<result column="population_info_id" property="populationInfoId"/>
<result column="charge" property="charge"/>
<result column="time" property="time"/>
<result column="security_address" property="securityAddress"/>
<result column="security_area_code" property="securityAreaCode"/>
<result column="security_area_name" property="securityAreaName"/>
<result column="lat" property="lat"/>
<result column="lng" property="lng"/>
<result column="map_address" property="mapAddress"/>
<result column="degree" property="degree"/>
<result column="acceptance_population_info_id" property="acceptancePopulationInfoId"/>
<result column="acceptance_name" property="acceptanceName"/>
<result column="acceptance_idcard" property="acceptanceIdcard"/>
<result column="acceptance_phone" property="acceptancePhone"/>
<result column="handle_population_info_id" property="handlePopulationInfoId"/>
<result column="handle_name" property="handleName"/>
<result column="handle_idcard" property="handleIdcard"/>
<result column="handle_phone" property="handlePhone"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="securityBO" type="com.cm.population.pojo.bos.security.SecurityBO">
<result column="security_id" property="securityId"/>
<result column="population_info_id" property="populationInfoId"/>
<result column="charge" property="charge"/>
<result column="time" property="time"/>
<result column="address" property="address"/>
<result column="lat" property="lat"/>
<result column="lng" property="lng"/>
<result column="map_address" property="mapAddress"/>
<result column="degree" property="degree"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="securityPO" type="com.cm.population.pojo.pos.security.SecurityPO">
<result column="security_id" property="securityId"/>
<result column="population_info_id" property="populationInfoId"/>
<result column="charge" property="charge"/>
<result column="time" property="time"/>
<result column="address" property="address"/>
<result column="lat" property="lat"/>
<result column="lng" property="lng"/>
<result column="map_address" property="mapAddress"/>
<result column="degree" property="degree"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增信访管理-社会治安 -->
<insert id="save" parameterType="map">
INSERT INTO population_security(
security_id,
population_info_id,
charge,
time,
security_address,
security_area_code,
security_area_name,
lat,
lng,
map_address,
degree,
acceptance_population_info_id,
acceptance_name,
acceptance_idcard,
acceptance_phone,
handle_population_info_id,
handle_name,
handle_idcard,
handle_phone,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{securityId},
#{populationInfoId},
#{charge},
#{time},
#{securityAddress},
#{securityAreaCode},
#{securityAreaName},
#{lat},
#{lng},
#{mapAddress},
#{degree},
#{acceptancePopulationInfoId},
#{acceptanceName},
#{acceptanceIdcard},
#{acceptancePhone},
#{handlePopulationInfoId},
#{handleName},
#{handleIdcard},
#{handlePhone},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除信访管理-社会治安 -->
<update id="remove" parameterType="map">
UPDATE
population_security
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
security_id IN
<foreach collection="securityIds" index="index" open="(" separator="," close=")">
#{securityIds[${index}]}
</foreach>
</update>
<!-- 删除信访管理-社会治安(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
population_security
WHERE
security_id IN
<foreach collection="securityIds" index="index" open="(" separator="," close=")">
#{securityIds[${index}]}
</foreach>
</update>
<!-- 修改信访管理-社会治安 -->
<update id="update" parameterType="map">
UPDATE
population_security
SET
<if test="populationInfoId != null and populationInfoId != ''">
population_info_id = #{populationInfoId},
</if>
<if test="charge != null and charge != ''">
charge = #{charge},
</if>
<if test="time != null and time != ''">
time = #{time},
</if>
<if test="securityAddress != null and securityAddress != ''">
security_address = #{securityAddress},
</if>
<if test="securityAreaCode != null and securityAreaCode != ''">
security_area_code = #{securityAreaCode},
</if>
<if test="securityAreaName != null and securityAreaName != ''">
security_area_name = #{securityAreaName},
</if>
<if test="lat != null and lat != ''">
lat = #{lat},
</if>
<if test="lng != null and lng != ''">
lng = #{lng},
</if>
<if test="mapAddress != null and mapAddress != ''">
map_address = #{mapAddress},
</if>
<if test="degree != null">
degree = #{degree},
</if>
<if test="acceptancePopulationInfoId != null and acceptancePopulationInfoId != ''">
acceptance_population_info_id = #{acceptancePopulationInfoId},
</if>
<if test="acceptanceName != null and acceptanceName != ''">
acceptance_name = #{acceptanceName},
</if>
<if test="acceptanceIdcard != null and acceptanceIdcard != ''">
acceptance_idcard = #{acceptanceIdcard},
</if>
<if test="acceptancePhone != null and acceptancePhone != ''">
acceptance_phone = #{acceptancePhone},
</if>
<if test="handlePopulationInfoId != null and handlePopulationInfoId != ''">
handle_population_info_id = #{handlePopulationInfoId},
</if>
<if test="handleName != null and handleName != ''">
handle_name = #{handleName},
</if>
<if test="handleIdcard != null and handleIdcard != ''">
handle_idcard = #{handleIdcard},
</if>
<if test="handlePhone != null and handlePhone != ''">
handle_phone = #{handlePhone},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
security_id = security_id
WHERE
security_id = #{securityId}
</update>
<!-- 信访管理-社会治安详情 -->
<select id="get" parameterType="map" resultMap="securityDTO">
SELECT
t1.population_info_id,
t1.charge,
t1.time,
t1.security_address,
t1.security_area_code,
t1.security_area_name,
t1.lat,
t1.lng,
t1.map_address,
t1.degree,
t1.security_id,
t1.acceptance_population_info_id,
t1.acceptance_name,
t1.acceptance_idcard,
t1.acceptance_phone,
t1.handle_population_info_id,
t1.handle_name,
t1.handle_idcard,
t1.handle_phone
FROM
population_security t1
WHERE
t1.is_delete = 0
<if test="securityId != null and securityId != ''">
AND
t1.security_id = #{securityId}
</if>
</select>
<!-- 信访管理-社会治安详情 -->
<select id="getBO" parameterType="map" resultMap="securityBO">
SELECT
t1.security_id,
t1.population_info_id,
t1.charge,
t1.time,
t1.address,
t1.lat,
t1.lng,
t1.map_address,
t1.degree,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_security t1
WHERE
t1.is_delete = 0
<if test="securityId != null and securityId != ''">
AND
t1.security_id = #{securityId}
</if>
</select>
<!-- 信访管理-社会治安详情 -->
<select id="getPO" parameterType="map" resultMap="securityPO">
SELECT
t1.security_id,
t1.population_info_id,
t1.charge,
t1.time,
t1.address,
t1.lat,
t1.lng,
t1.map_address,
t1.degree,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_security t1
WHERE
t1.is_delete = 0
<if test="securityId != null and securityId != ''">
AND
t1.security_id = #{securityId}
</if>
</select>
<!-- 信访管理-社会治安列表 -->
<select id="list" parameterType="map" resultMap="securityDTO">
SELECT
t1.security_id,
t1.population_info_id,
t1.charge,
t1.time,
t1.security_address,
t1.security_area_code,
t1.security_area_name,
t1.lat,
t1.lng,
t1.map_address,
t1.degree,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
t1.acceptance_population_info_id,
t1.acceptance_name,
t1.acceptance_idcard,
t1.acceptance_phone,
t1.handle_population_info_id,
t1.handle_name,
t1.handle_idcard,
t1.handle_phone,
t1.creator
FROM
population_security t1
WHERE
t1.is_delete = 0
<if test="creator != null and creator != ''">
AND t1.creator = #{creator}
</if>
<if test="degree != null and degree != ''">
AND t1.degree = #{degree}
</if>
<if test="charge != null and charge != ''">
AND t1.charge LIKE CONCAT('%', #{charge}, '%')
</if>
<if test="populationInfoId != null and populationInfoId != ''">
AND t1.population_info_id = #{populationInfoId}
</if>
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.address LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="securityIds != null and securityIds.size > 0">
AND
t1.security_id IN
<foreach collection="securityIds" index="index" open="(" separator="," close=")">
#{securityIds[${index}]}
</foreach>
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- 信访管理-社会治安列表 -->
<select id="listBO" parameterType="map" resultMap="securityBO">
SELECT
t1.security_id,
t1.population_info_id,
t1.charge,
t1.time,
t1.address,
t1.lat,
t1.lng,
t1.map_address,
t1.degree,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_security t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="securityIds != null and securityIds.size > 0">
AND
t1.security_id IN
<foreach collection="securityIds" index="index" open="(" separator="," close=")">
#{securityIds[${index}]}
</foreach>
</if>
</select>
<!-- 信访管理-社会治安列表 -->
<select id="listPO" parameterType="map" resultMap="securityPO">
SELECT
t1.security_id,
t1.population_info_id,
t1.charge,
t1.time,
t1.address,
t1.lat,
t1.lng,
t1.map_address,
t1.degree,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_security t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="securityIds != null and securityIds.size > 0">
AND
t1.security_id IN
<foreach collection="securityIds" index="index" open="(" separator="," close=")">
#{securityIds[${index}]}
</foreach>
</if>
</select>
<!-- 信访管理-社会治安统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
population_security t1
WHERE
t1.is_delete = 0
</select>
</mapper>