btxtgxq-system-population/src/main/resources/mybatis/mapper/petition/petition-mapper.xml

489 lines
16 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.petition.IPetitionDao">
<resultMap id="petitionDTO" type="com.cm.population.pojo.dtos.petition.PetitionDTO">
<result column="petition_id" property="petitionId"/>
<result column="population_info_id" property="populationInfoId"/>
<result column="activation" property="activation"/>
<result column="measure" property="measure"/>
<result column="economy" property="economy"/>
<result column="stabilize_status" property="stabilizeStatus"/>
<result column="stabilize_level" property="stabilizeLevel"/>
<result column="type" property="type"/>
<result column="puttime" property="puttime"/>
<result column="reason" property="reason"/>
<result column="reason_other" property="reasonOther"/>
<result column="onduty" property="onduty"/>
<result column="handle" property="handle"/>
<result column="coordinate" property="coordinate"/>
<result column="coordinate_name" property="coordinateName"/>
<result column="talk" property="talk"/>
<result column="talk_name" property="talkName"/>
<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="petitionBO" type="com.cm.population.pojo.bos.petition.PetitionBO">
<result column="petition_id" property="petitionId"/>
<result column="population_info_id" property="populationInfoId"/>
<result column="activation" property="activation"/>
<result column="measure" property="measure"/>
<result column="economy" property="economy"/>
<result column="stabilize_status" property="stabilizeStatus"/>
<result column="stabilize_level" property="stabilizeLevel"/>
<result column="type" property="type"/>
<result column="reason" property="reason"/>
<result column="reason_other" property="reasonOther"/>
<result column="onduty" property="onduty"/>
<result column="handle" property="handle"/>
<result column="coordinate" property="coordinate"/>
<result column="talk" property="talk"/>
<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="petitionPO" type="com.cm.population.pojo.pos.petition.PetitionPO">
<result column="petition_id" property="petitionId"/>
<result column="population_info_id" property="populationInfoId"/>
<result column="activation" property="activation"/>
<result column="measure" property="measure"/>
<result column="economy" property="economy"/>
<result column="stabilize_status" property="stabilizeStatus"/>
<result column="stabilize_level" property="stabilizeLevel"/>
<result column="type" property="type"/>
<result column="reason" property="reason"/>
<result column="reason_other" property="reasonOther"/>
<result column="onduty" property="onduty"/>
<result column="handle" property="handle"/>
<result column="coordinate" property="coordinate"/>
<result column="talk" property="talk"/>
<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_petition(
petition_id,
population_info_id,
activation,
measure,
economy,
stabilize_status,
stabilize_level,
puttime,
type,
reason,
reason_other,
onduty,
handle,
coordinate,
talk,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{petitionId},
#{populationInfoId},
#{activation},
#{measure},
#{economy},
#{stabilizeStatus},
#{stabilizeLevel},
#{puttime},
#{type},
#{reason},
#{reasonOther},
#{onduty},
#{handle},
#{coordinate},
#{talk},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除信访管理-重点上访户 -->
<update id="remove" parameterType="map">
UPDATE
population_petition
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
petition_id IN
<foreach collection="petitionIds" index="index" open="(" separator="," close=")">
#{petitionIds[${index}]}
</foreach>
</update>
<!-- 删除信访管理-重点上访户(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
population_petition
WHERE
petition_id IN
<foreach collection="petitionIds" index="index" open="(" separator="," close=")">
#{petitionIds[${index}]}
</foreach>
</update>
<!-- 修改信访管理-重点上访户 -->
<update id="update" parameterType="map">
UPDATE
population_petition
SET
<if test="populationInfoId != null and populationInfoId != ''">
population_info_id = #{populationInfoId},
</if>
<if test="activation != null">
activation = #{activation},
</if>
<if test="measure != null">
measure = #{measure},
</if>
<if test="economy != null">
economy = #{economy},
</if>
<if test="stabilizeStatus != null">
stabilize_status = #{stabilizeStatus},
</if>
<if test="stabilizeLevel != null">
stabilize_level = #{stabilizeLevel},
</if>
<if test="puttime != null">
puttime = #{puttime},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="reason != null">
reason = #{reason},
</if>
<if test="reasonOther != null and reasonOther != ''">
reason_other = #{reasonOther},
</if>
<if test="onduty != null">
onduty = #{onduty},
</if>
<if test="handle != null">
handle = #{handle},
</if>
<if test="coordinate != null">
coordinate = #{coordinate},
</if>
<if test="talk != null">
talk = #{talk},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
petition_id = petition_id
WHERE
petition_id = #{petitionId}
</update>
<!-- 信访管理-重点上访户详情 -->
<select id="get" parameterType="map" resultMap="petitionDTO">
SELECT
t1.population_info_id,
t1.activation,
t1.measure,
t1.economy,
t1.stabilize_status,
t1.stabilize_level,
t1.puttime,
t1.type,
t1.reason,
t1.reason_other,
t1.onduty,
t1.handle,
t1.coordinate,
t2.dictionary_name AS coordinate_name,
t1.talk,
t3.dictionary_name AS talk_name,
t1.petition_id
FROM
population_petition t1
LEFT JOIN
data_dictionary t2
ON
t1.coordinate = t2.dictionary_id
LEFT JOIN
data_dictionary t3
ON
t1.talk = t3.dictionary_id
WHERE
t1.is_delete = 0
<if test="petitionId != null and petitionId != ''">
AND
t1.petition_id = #{petitionId}
</if>
</select>
<!-- 信访管理-重点上访户详情 -->
<select id="getBO" parameterType="map" resultMap="petitionBO">
SELECT
t1.petition_id,
t1.population_info_id,
t1.activation,
t1.measure,
t1.economy,
t1.stabilize_status,
t1.stabilize_level,
t1.type,
t1.reason,
t1.reason_other,
t1.onduty,
t1.handle,
t1.coordinate,
t1.talk,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_petition t1
WHERE
t1.is_delete = 0
<if test="petitionId != null and petitionId != ''">
AND
t1.petition_id = #{petitionId}
</if>
</select>
<!-- 信访管理-重点上访户详情 -->
<select id="getPO" parameterType="map" resultMap="petitionPO">
SELECT
t1.petition_id,
t1.population_info_id,
t1.activation,
t1.measure,
t1.economy,
t1.stabilize_status,
t1.stabilize_level,
t1.type,
t1.reason,
t1.reason_other,
t1.onduty,
t1.handle,
t1.coordinate,
t1.talk,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_petition t1
WHERE
t1.is_delete = 0
<if test="petitionId != null and petitionId != ''">
AND
t1.petition_id = #{petitionId}
</if>
</select>
<!-- 信访管理-重点上访户列表 -->
<select id="list" parameterType="map" resultMap="petitionDTO">
SELECT
t1.population_info_id,
t1.activation,
t1.measure,
t1.economy,
t1.stabilize_status,
t1.stabilize_level,
t1.puttime,
t1.type,
t1.reason,
t1.reason_other,
t1.onduty,
t1.handle,
t1.coordinate,
t2.dictionary_name AS coordinate_name,
t1.talk,
t3.dictionary_name AS talk_name,
t1.petition_id,
t1.creator
FROM
population_petition t1
LEFT JOIN
data_dictionary t2
ON
t1.coordinate = t2.dictionary_id
LEFT JOIN
data_dictionary t3
ON
t1.talk = t3.dictionary_id
WHERE
t1.is_delete = 0
<if test="creator != null and creator != ''">
AND t1.creator = #{creator}
</if>
<if test="activation != null and activation != ''">
AND t1.activation = #{activation}
</if>
<if test="measure != null and measure != ''">
AND t1.measure = #{measure}
</if>
<if test="stabilizeStatus != null and stabilizeStatus != ''">
AND t1.stabilize_status = #{stabilizeStatus}
</if>
<if test="stabilizeLevel != null and stabilizeLevel != ''">
AND t1.stabilize_level = #{stabilizeLevel}
</if>
<if test="handle != null and handle != ''">
AND t1.handle = #{handle}
</if>
<if test="populationInfoId != null and populationInfoId != ''">
AND t1.population_info_id = #{populationInfoId}
</if>
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.coordinate 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="petitionIds != null and petitionIds.size > 0">
AND
t1.petition_id IN
<foreach collection="petitionIds" index="index" open="(" separator="," close=")">
#{petitionIds[${index}]}
</foreach>
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- 信访管理-重点上访户列表 -->
<select id="listBO" parameterType="map" resultMap="petitionBO">
SELECT
t1.petition_id,
t1.population_info_id,
t1.activation,
t1.measure,
t1.economy,
t1.stabilize_status,
t1.stabilize_level,
t1.type,
t1.reason,
t1.reason_other,
t1.onduty,
t1.handle,
t1.coordinate,
t1.talk,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_petition 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="petitionIds != null and petitionIds.size > 0">
AND
t1.petition_id IN
<foreach collection="petitionIds" index="index" open="(" separator="," close=")">
#{petitionIds[${index}]}
</foreach>
</if>
</select>
<!-- 信访管理-重点上访户列表 -->
<select id="listPO" parameterType="map" resultMap="petitionPO">
SELECT
t1.petition_id,
t1.population_info_id,
t1.activation,
t1.measure,
t1.economy,
t1.stabilize_status,
t1.stabilize_level,
t1.type,
t1.reason,
t1.reason_other,
t1.onduty,
t1.handle,
t1.coordinate,
t1.talk,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
population_petition 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="petitionIds != null and petitionIds.size > 0">
AND
t1.petition_id IN
<foreach collection="petitionIds" index="index" open="(" separator="," close=")">
#{petitionIds[${index}]}
</foreach>
</if>
</select>
<!-- 信访管理-重点上访户统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
population_petition t1
WHERE
t1.is_delete = 0
</select>
</mapper>