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

316 lines
9.9 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="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"/>
</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"/>
</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"/>
</resultMap>
<!-- 新增 -->
<insert id="save" parameterType="map">
INSERT INTO management_exam_check(
exam_check_id,
plan_id,
check_status,
reason,
exam_apply_id,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
) VALUES(
#{examCheckId},
#{planId},
#{checkStatus},
#{reason},
#{examApplyId},
#{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>
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.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>
</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.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.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.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete,
1
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="listBO" parameterType="map" resultMap="examCheckBO">
SELECT
t1.exam_check_id,
t1.plan_id,
t1.check_status,
t1.reason,
t1.exam_apply_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.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="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
management_exam_check t1
WHERE
t1.is_delete = 0
</select>
</mapper>