twoduty/src/main/resources/mybatis/mapper/problemClue/problemClue-mapper.xml
2021-03-30 18:01:49 +08:00

460 lines
15 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.tenlion.twoduty.dao.problemclue.IProblemClueDao">
<resultMap id="problemClueDTO" type="com.tenlion.twoduty.pojo.dtos.problemclue.ProblemClueDTO">
<result column="report_id" property="reportId"/>
<result column="duty_index_lib_id" property="dutyIndexLibId"/>
<result column="case_number" property="caseNumber"/>
<result column="handover_number" property="handoverNumber"/>
<result column="be_reported_person" property="beReportedPerson"/>
<result column="report_person" property="reportPerson"/>
<result column="org_job" property="orgJob"/>
<result column="main_clue_content" property="mainClueContent"/>
<result column="accept_date_time" property="acceptDateTime"/>
<result column="clue_source" property="clueSource"/>
<result column="need_result" property="needResult"/>
<result column="limit_result_time" property="limitResultTime"/>
<result column="verify_problem" property="verifyProblem"/>
<result column="progress" property="progress"/>
<result column="may_result_opinion" property="mayResultOpinion"/>
<result column="over_status" property="overStatus"/>
<result column="case_result" property="caseResult"/>
<result column="remarks" property="remarks"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<resultMap id="problemClueBO" type="com.tenlion.twoduty.pojo.bos.problemclue.ProblemClueBO">
<result column="report_id" property="reportId"/>
<result column="duty_index_lib_id" property="dutyIndexLibId"/>
<result column="case_number" property="caseNumber"/>
<result column="handover_number" property="handoverNumber"/>
<result column="be_reported_person" property="beReportedPerson"/>
<result column="report_person" property="reportPerson"/>
<result column="org_job" property="orgJob"/>
<result column="main_clue_content" property="mainClueContent"/>
<result column="accept_date_time" property="acceptDateTime"/>
<result column="clue_source" property="clueSource"/>
<result column="need_result" property="needResult"/>
<result column="limit_result_time" property="limitResultTime"/>
<result column="verify_problem" property="verifyProblem"/>
<result column="progress" property="progress"/>
<result column="may_result_opinion" property="mayResultOpinion"/>
<result column="over_status" property="overStatus"/>
<result column="case_result" property="caseResult"/>
<result column="remarks" property="remarks"/>
<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="problemCluePO" type="com.tenlion.twoduty.pojo.pos.problemclue.ProblemCluePO">
<result column="report_id" property="reportId"/>
<result column="duty_index_lib_id" property="dutyIndexLibId"/>
<result column="case_number" property="caseNumber"/>
<result column="handover_number" property="handoverNumber"/>
<result column="be_reported_person" property="beReportedPerson"/>
<result column="report_person" property="reportPerson"/>
<result column="org_job" property="orgJob"/>
<result column="main_clue_content" property="mainClueContent"/>
<result column="accept_date_time" property="acceptDateTime"/>
<result column="clue_source" property="clueSource"/>
<result column="need_result" property="needResult"/>
<result column="limit_result_time" property="limitResultTime"/>
<result column="verify_problem" property="verifyProblem"/>
<result column="progress" property="progress"/>
<result column="may_result_opinion" property="mayResultOpinion"/>
<result column="over_status" property="overStatus"/>
<result column="case_result" property="caseResult"/>
<result column="remarks" property="remarks"/>
<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 t_problem_clue(
report_id,
duty_index_lib_id,
case_number,
handover_number,
be_reported_person,
report_person,
org_job,
main_clue_content,
accept_date_time,
clue_source,
need_result,
limit_result_time,
verify_problem,
progress,
may_result_opinion,
over_status,
case_result,
remarks,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{reportId},
#{dutyIndexLibId},
#{caseNumber},
#{handoverNumber},
#{beReportedPerson},
#{reportPerson},
#{orgJob},
#{mainClueContent},
#{acceptDateTime},
#{clueSource},
#{needResult},
#{limitResultTime},
#{verifyProblem},
#{progress},
#{mayResultOpinion},
#{overStatus},
#{caseResult},
#{remarks},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除 -->
<update id="remove" parameterType="map">
UPDATE
t_problem_clue
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
report_id IN
<foreach collection="reportIds" index="index" open="(" separator="," close=")">
#{reportIds[${index}]}
</foreach>
</update>
<!-- 删除(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
t_problem_clue
WHERE
report_id IN
<foreach collection="reportIds" index="index" open="(" separator="," close=")">
#{reportIds[${index}]}
</foreach>
</update>
<!-- 修改 -->
<update id="update" parameterType="map">
UPDATE
t_problem_clue
SET
<if test="caseNumber != null and caseNumber != ''">
case_number = #{caseNumber},
</if>
<if test="handoverNumber != null and handoverNumber != ''">
handover_number = #{handoverNumber},
</if>
<if test="beReportedPerson != null and beReportedPerson != ''">
be_reported_person = #{beReportedPerson},
</if>
<if test="reportPerson != null and reportPerson != ''">
report_person = #{reportPerson},
</if>
<if test="orgJob != null and orgJob != ''">
org_job = #{orgJob},
</if>
<if test="mainClueContent != null and mainClueContent != ''">
main_clue_content = #{mainClueContent},
</if>
<if test="acceptDateTime != null and acceptDateTime != ''">
accept_date_time = #{acceptDateTime},
</if>
<if test="clueSource != null and clueSource != ''">
clue_source = #{clueSource},
</if>
<if test="needResult != null">
need_result = #{needResult},
</if>
<if test="limitResultTime != null and limitResultTime != ''">
limit_result_time = #{limitResultTime},
</if>
<if test="verifyProblem != null and verifyProblem != ''">
verify_problem = #{verifyProblem},
</if>
<if test="progress != null and progress != ''">
progress = #{progress},
</if>
<if test="mayResultOpinion != null and mayResultOpinion != ''">
may_result_opinion = #{mayResultOpinion},
</if>
<if test="overStatus != null">
over_status = #{overStatus},
</if>
<if test="caseResult != null and caseResult != ''">
case_result = #{caseResult},
</if>
<if test="remarks != null and remarks != ''">
remarks = #{remarks},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier}
WHERE
report_id = #{reportId}
</update>
<!-- 详情 -->
<select id="get" parameterType="map" resultMap="problemClueDTO">
SELECT
t1.report_id,
t1.duty_index_lib_id,
t1.case_number,
t1.handover_number,
t1.be_reported_person,
t1.report_person,
t1.org_job,
t1.main_clue_content,
t1.accept_date_time,
t1.clue_source,
t1.need_result,
t1.limit_result_time,
t1.verify_problem,
t1.progress,
t1.may_result_opinion,
t1.over_status,
t1.case_result,
t1.remarks
FROM
t_problem_clue t1
WHERE
t1.is_delete = 0
<!-- 添加条件 -->
</select>
<!-- 详情 -->
<select id="getBO" parameterType="map" resultMap="problemClueBO">
SELECT
t1.report_id,
t1.duty_index_lib_id,
t1.case_number,
t1.handover_number,
t1.be_reported_person,
t1.report_person,
t1.org_job,
t1.main_clue_content,
t1.accept_date_time,
t1.clue_source,
t1.need_result,
t1.limit_result_time,
t1.verify_problem,
t1.progress,
t1.may_result_opinion,
t1.over_status,
t1.case_result,
t1.remarks,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
t_problem_clue t1
WHERE
t1.is_delete = 0
<!-- 添加条件 -->
</select>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="problemCluePO">
SELECT
t1.report_id,
t1.duty_index_lib_id,
t1.case_number,
t1.handover_number,
t1.be_reported_person,
t1.report_person,
t1.org_job,
t1.main_clue_content,
t1.accept_date_time,
t1.clue_source,
t1.need_result,
t1.limit_result_time,
t1.verify_problem,
t1.progress,
t1.may_result_opinion,
t1.over_status,
t1.case_result,
t1.remarks,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
t_problem_clue t1
WHERE
t1.is_delete = 0
<!-- 添加条件 -->
</select>
<!-- 列表 -->
<select id="list" parameterType="map" resultMap="problemClueDTO">
SELECT
t1.report_id,
t1.duty_index_lib_id,
t1.case_number,
t1.handover_number,
t1.be_reported_person,
t1.report_person,
t1.org_job,
t1.main_clue_content,
t1.accept_date_time,
t1.clue_source,
t1.need_result,
t1.limit_result_time,
t1.verify_problem,
t1.progress,
t1.may_result_opinion,
t1.over_status,
t1.case_result,
t1.remarks,
t1.creator,
t1.gmt_create
FROM
t_problem_clue 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="indexLibId != null and indexLibId != ''">
AND t1.duty_index_lib_id = #{indexLibId}
</if>
</select>
<!-- 列表 -->
<select id="listBO" parameterType="map" resultMap="problemClueBO">
SELECT
t1.report_id,
t1.duty_index_lib_id,
t1.case_number,
t1.handover_number,
t1.be_reported_person,
t1.report_person,
t1.org_job,
t1.main_clue_content,
t1.accept_date_time,
t1.clue_source,
t1.need_result,
t1.limit_result_time,
t1.verify_problem,
t1.progress,
t1.may_result_opinion,
t1.over_status,
t1.case_result,
t1.remarks,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
t_problem_clue 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>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="problemCluePO">
SELECT
t1.report_id,
t1.duty_index_lib_id,
t1.case_number,
t1.handover_number,
t1.be_reported_person,
t1.report_person,
t1.org_job,
t1.main_clue_content,
t1.accept_date_time,
t1.clue_source,
t1.need_result,
t1.limit_result_time,
t1.verify_problem,
t1.progress,
t1.may_result_opinion,
t1.over_status,
t1.case_result,
t1.remarks,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
t_problem_clue 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>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
t_problem_clue t1
WHERE
t1.is_delete = 0
</select>
</mapper>