btxtgxq-system-bigdata/target/classes/mybatis/mapper/deptinspector/deptinspector-mapper.xml
2021-01-11 14:16:26 +08:00

160 lines
5.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="com.cm.bigdata.dao.deptinspector.IDeptInspectorDao">
<resultMap id="deptInspectorDTO" type="com.cm.bigdata.pojo.dtos.deptinspector.DeptInspectorDTO">
<id column="dept_inspector_id" property="deptInspectorId"/>
<result column="dept_id" property="deptId"/>
<result column="inspector_time" property="inspectorTime"/>
<result column="inspector_num" property="inspectorNum"/>
</resultMap>
<!-- 新增案件督查记录表 -->
<insert id="saveDeptInspector" parameterType="map">
INSERT INTO gen_dept_inspector(
dept_inspector_id,
dept_id,
inspector_time,
inspector_num,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{deptInspectorId},
#{deptId},
#{inspectorTime},
#{inspectorNum},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除案件督查记录表 -->
<update id="removeDeptInspector" parameterType="map">
UPDATE
gen_dept_inspector
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
dept_inspector_id IN
<foreach collection="deptInspectorIds" index="index" open="(" separator="," close=")">
#{deptInspectorIds[${index}]}
</foreach>
</update>
<!-- 删除案件督查记录表(物理) -->
<update id="deleteDeptInspector" parameterType="map">
DELETE FROM
gen_dept_inspector
WHERE
dept_inspector_id IN
<foreach collection="deptInspectorIds" index="index" open="(" separator="," close=")">
#{deptInspectorIds[${index}]}
</foreach>
</update>
<!-- 修改案件督查记录表 -->
<update id="updateDeptInspector" parameterType="map">
UPDATE
gen_dept_inspector
SET
<if test="deptId != null and deptId != ''">
dept_id = #{deptId},
</if>
<if test="inspectorNum != null and inspectorNum != ''">
inspector_time = #{inspectorNum},
</if>
<if test="nspectorNum != null and inspectorNum != ''">
inspector_num = #{inspectorNum},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
dept_inspector_id = #{deptInspectorId}
</update>
<!-- 案件督查记录表详情 -->
<select id="getDeptInspector" parameterType="map" resultMap="deptInspectorDTO">
SELECT
t1.dept_id,
t1.inspector_time,
t1.inspector_num,
t1.dept_inspector_id
FROM
gen_dept_inspector t1
WHERE
t1.is_delete = 0
<if test="deptInspectorId != null and deptInspectorId != ''">
AND
t1.dept_inspector_id = #{deptInspectorId}
</if>
</select>
<!-- 案件督查记录表列表 -->
<select id="listDeptInspector" parameterType="map" resultMap="deptInspectorDTO">
SELECT
t1.dept_id,
t1.inspector_time,
t1.inspector_num,
t1.dept_inspector_id
FROM
gen_dept_inspector t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
t1.id LIKE CONCAT('%', #{keywords}, '%')
OR
t1.dept_inspector_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="deptInspectorIds != null and deptInspectorIds.size > 0">
AND
t1.dept_inspector_id IN
<foreach collection="deptInspectorIds" index="index" open="(" separator="," close=")">
#{deptInspectorIds[${index}]}
</foreach>
</if>
</select>
<!-- 案件督查记录表统计 -->
<select id="countDeptInspector" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
gen_dept_inspector t1
WHERE
t1.is_delete = 0 AND t1.dept_id = #{deptId} AND t1.inspector_time = #{inspectorTime}
</select>
<!--统计部门督促的数量-->
<select id="countDeptInspectorNum" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
gen_dept_inspector t1
WHERE
t1.is_delete = 0
AND
t1.dept_id = #{deptId} AND t1.inspector_time between #{startTime} AND #{endTime}
</select>
</mapper>