bt-yjj-system-examination-s.../src/main/resources/mybatis/mapper/examcheck/exam-check-mapper.xml
2021-05-15 16:49:12 +08:00

393 lines
12 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.dao.examcheck.IExamCheckDao">
<resultMap id="examCheckDTO" type="cn.com.tenlion.pojo.dtos.examcheck.ExamCheckDTO">
<result column="exam_check_id" property="examCheckId"/>
<result column="plan_id" property="planId"/>
<result column="check_status" property="checkStatus"/>
<result column="reason" property="reason"/>
<result column="exam_apply_id" property="examApplyId"/>
<result column="next_commit_time" property="nextCommitTime"/>
<result column="work_type_id" property="workTypeId"/>
<result column="org_id" property="orgId"/>
</resultMap>
<resultMap id="examCheckBO" type="cn.com.tenlion.pojo.bos.examcheck.ExamCheckBO">
<result column="exam_check_id" property="examCheckId"/>
<result column="plan_id" property="planId"/>
<result column="check_status" property="checkStatus"/>
<result column="reason" property="reason"/>
<result column="exam_apply_id" property="examApplyId"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
<result column="next_commit_time" property="nextCommitTime"/>
<result column="work_type_id" property="workTypeId"/>
<result column="org_id" property="orgId"/>
</resultMap>
<resultMap id="examCheckPO" type="cn.com.tenlion.pojo.pos.examcheck.ExamCheckPO">
<result column="exam_check_id" property="examCheckId"/>
<result column="plan_id" property="planId"/>
<result column="check_status" property="checkStatus"/>
<result column="reason" property="reason"/>
<result column="exam_apply_id" property="examApplyId"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
<result column="next_commit_time" property="nextCommitTime"/>
<result column="work_type_id" property="workTypeId"/>
<result column="org_id" property="orgId"/>
</resultMap>
<!-- 新增 -->
<insert id="save" parameterType="map">
INSERT INTO management_exam_check(
exam_check_id,
plan_id,
check_status,
reason,
exam_apply_id,
next_commit_time,
work_type_id,
org_id,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
) VALUES(
#{examCheckId},
#{planId},
#{checkStatus},
#{reason},
#{examApplyId},
#{nextCommitTime},
#{workTypeId},
#{orgId},
#{gmtCreate},
#{creator},
#{gmtModified},
#{modifier},
#{isDelete}
)
</insert>
<!-- 删除 -->
<update id="remove" parameterType="map">
UPDATE
management_exam_check
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
exam_check_id IN
<foreach collection="examCheckIds" index="index" open="(" separator="," close=")">
#{examCheckIds[${index}]}
</foreach>
</update>
<!-- 删除(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
management_exam_check
WHERE
exam_check_id IN
<foreach collection="examCheckIds" index="index" open="(" separator="," close=")">
#{examCheckIds[${index}]}
</foreach>
</update>
<!-- 修改 -->
<update id="update" parameterType="map">
UPDATE
management_exam_check
SET
<if test="planId != null and planId != ''">
plan_id = #{planId},
</if>
<if test="checkStatus != null">
check_status = #{checkStatus},
</if>
<if test="reason != null and reason != ''">
reason = #{reason},
</if>
<if test="examApplyId != null and examApplyId != ''">
exam_apply_id = #{examApplyId},
</if>
<if test="nextCommitTime != null and nextCommitTime != ''">
next_commit_time = #{nextCommitTime},
</if>
<if test="workTypeId != null and workTypeId != ''">
work_type_id = #{workTypeId},
</if>
<if test="orgId != null and orgId != ''">
org_id = #{orgId},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
exam_check_id = exam_check_id
WHERE
exam_check_id = #{examCheckId}
</update>
<!-- 详情 -->
<select id="get" parameterType="map" resultMap="examCheckDTO">
SELECT
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_id,
t1.next_commit_time,
t1.work_type_id,
t1.org_id,
t1.exam_check_id
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
<if test="examCheckId != null and examCheckId != ''">
AND
t1.exam_check_id = #{examCheckId}
</if>
<if test="planId != null and planId != ''">
AND
t1.plan_id = #{planId}
</if>
</select>
<!-- 详情 -->
<select id="getBO" parameterType="map" resultMap="examCheckBO">
SELECT
t1.exam_check_id,
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_id,
t1.next_commit_time,
t1.work_type_id,
t1.org_id,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
<if test="examCheckId != null and examCheckId != ''">
AND
t1.exam_check_id = #{examCheckId}
</if>
</select>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="examCheckPO">
SELECT
t1.exam_check_id,
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_id,
t1.next_commit_time,
t1.work_type_id,
t1.org_id,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
<if test="examCheckId != null and examCheckId != ''">
AND
t1.exam_check_id = #{examCheckId}
</if>
</select>
<!-- 列表 -->
<select id="list" parameterType="map" resultMap="examCheckDTO">
SELECT
t1.exam_check_id,
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_id,
t1.next_commit_time,
t1.work_type_id,
t1.org_id,
1
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
<if test="workTypeId != null and workTypeId != ''">
AND t1.work_type_id = #{workTypeId}
</if>
<if test="orgId != null and orgId != ''">
AND t1.org_id = #{orgId}
</if>
<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="examCheckIds != null and examCheckIds.size > 0">
AND
t1.exam_check_id IN
<foreach collection="examCheckIds" index="index" open="(" separator="," close=")">
#{examCheckIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listBO" parameterType="map" resultMap="examCheckBO">
SELECT
t1.exam_check_id,
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_id,
t1.next_commit_time,
t1.work_type_id,
t1.org_id,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
management_exam_check 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="examCheckIds != null and examCheckIds.size > 0">
AND
t1.exam_check_id IN
<foreach collection="examCheckIds" index="index" open="(" separator="," close=")">
#{examCheckIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="examCheckPO">
SELECT
t1.exam_check_id,
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_id,
t1.next_commit_time,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.work_type_id,
t1.org_id,
t1.is_delete
FROM
management_exam_check 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="examCheckIds != null and examCheckIds.size > 0">
AND
t1.exam_check_id IN
<foreach collection="examCheckIds" index="index" open="(" separator="," close=")">
#{examCheckIds[${index}]}
</foreach>
</if>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
</select>
<!-- 开班计划统计 -->
<select id="statisticsCount" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
AND t1.check_status = #{checkStatus}
</select>
<!-- 列表 -->
<select id="getExamCheck" parameterType="map" resultMap="examCheckDTO">
SELECT
t1.exam_check_id,
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_id,
t1.next_commit_time,
t1.work_type_id,
t1.org_id,
1
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
AND (t1.check_status = 0 OR t1.check_status = 3)
<if test="workTypeId != null and workTypeId != ''">
AND t1.work_type_id = #{workTypeId}
</if>
<if test="orgId != null and orgId != ''">
AND t1.org_id = #{orgId}
</if>
</select>
</mapper>