btxtgxq-system-bigdata/target/classes/mybatis/mapper/casesupervise/casesupervise-mapper.xml
2021-01-11 15:07:46 +08:00

198 lines
6.3 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.bigdata.dao.casesupervise.ICaseSuperviseDao">
<resultMap id="caseSuperviseDTO" type="com.cm.bigdata.pojo.dtos.casesupervise.CaseSuperviseDTO">
<id column="case_supervise_id" property="caseSuperviseId"/>
<result column="is_supervise" property="isSupervise"/>
<result column="quarter" property="quarter"/>
<result column="case_id" property="caseId"/>
<result column="supervise_time" property="superviseTime"/>
<result column="year" property="year"/>
<result column="area_id" property="areaId"/>
<result column="area_name" property="areaName"/>
<result column="supervise_count" property="superviseCount"/>
</resultMap>
<!-- 新增案件督察表 -->
<insert id="saveCaseSupervise" parameterType="map">
INSERT INTO gen_case_supervise(
case_supervise_id,
is_supervise,
quarter,
case_id,
supervise_time,
year,
area_id,
area_name,
supervise_count,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{caseSuperviseId},
#{isSupervise},
#{quarter},
#{caseId},
#{superviseTime},
#{year},
#{areaId},
#{areaName},
#{superviseCount},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除案件督察表 -->
<update id="removeCaseSupervise" parameterType="map">
UPDATE
gen_case_supervise
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
case_supervise_id IN
<foreach collection="caseSuperviseIds" index="index" open="(" separator="," close=")">
#{caseSuperviseIds[${index}]}
</foreach>
</update>
<!-- 删除案件督察表(物理) -->
<update id="deleteCaseSupervise" parameterType="map">
DELETE FROM
gen_case_supervise
WHERE
case_supervise_id IN
<foreach collection="caseSuperviseIds" index="index" open="(" separator="," close=")">
#{caseSuperviseIds[${index}]}
</foreach>
</update>
<!-- 修改案件督察表 -->
<update id="updateCaseSupervise" parameterType="map">
UPDATE
gen_case_supervise
SET
<if test="isSupervise != null and isSupervise != ''">
is_supervise = #{isSupervise},
</if>
<if test="quarter != null and quarter != ''">
quarter = #{quarter},
</if>
<if test="caseId != null and caseId != ''">
case_id = #{caseId},
</if>
<if test="superviseTime != null and superviseTime != ''">
supervise_time = #{superviseTime},
</if>
<if test="year != null and year != ''">
year = #{year},
</if>
<if test="areaId != null and areaId != ''">
area_id = #{areaId},
</if>
<if test="areaName != null and areaName != ''">
area_name = #{areaName},
</if>
<if test="superviseCount != null and superviseCount != ''">
supervise_count = #{superviseCount},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
case_supervise_id = #{caseSuperviseId}
</update>
<!-- 案件督察表详情 -->
<select id="getCaseSupervise" parameterType="map" resultMap="caseSuperviseDTO">
SELECT
t1.is_supervise,
t1.quarter,
t1.case_id,
t1.supervise_time,
t1.year,
t1.area_id,
t1.area_name,
t1.supervise_count,
t1.case_supervise_id
FROM
gen_case_supervise t1
WHERE
t1.is_delete = 0
<if test="caseSuperviseId != null and caseSuperviseId != ''">
AND
t1.case_supervise_id = #{caseSuperviseId}
</if>
</select>
<!-- 案件督察表列表 -->
<select id="listCaseSupervise" parameterType="map" resultMap="caseSuperviseDTO">
SELECT
t1.is_supervise,
t1.quarter,
t1.case_id,
t1.supervise_time,
t1.year,
t1.area_id,
t1.area_name,
t1.supervise_count,
t1.case_supervise_id
FROM
gen_case_supervise t1
WHERE
t1.is_delete = 0
<if test="year != null and year != ''">
AND t1.year = #{year}
</if>
<if test="quarter != null and quarter != ''">
AND t1.quarter = #{quarter}
</if>
<if test="areaName != null and areaName != ''">
AND t1.area_name = #{areaName}
</if>
<if test="areaId != null and areaId != ''">
AND t1.area_id = #{areaId}
</if>
<if test="keywords != null and keywords != ''">
AND (
t1.id LIKE CONCAT('%', #{keywords}, '%')
OR
t1.case_supervise_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="caseSuperviseIds != null and caseSuperviseIds.size > 0">
AND
t1.case_supervise_id IN
<foreach collection="caseSuperviseIds" index="index" open="(" separator="," close=")">
#{caseSuperviseIds[${index}]}
</foreach>
</if>
</select>
<!-- 案件督察表统计 -->
<select id="countCaseSupervise" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
gen_case_supervise t1
WHERE
t1.is_delete = 0
</select>
</mapper>