btyjj-inspection/src/main/resources/mybatis/mapper/industrycheckitem/industrycheckitem-mapper.xml

136 lines
4.7 KiB
XML
Raw Normal View History

2020-03-27 22:30:02 +08:00
<?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.inspection.dao.industrycheckitem.IIndustryCheckItemDao">
<resultMap id="industryCheckItemDTO" type="com.cm.inspection.pojo.dtos.industrycheckitem.IndustryCheckItemDTO">
<id column="industry_check_item_id" property="industryCheckItemId"/>
<result column="industry_id" property="industryId"/>
<result column="industry_id_dictionary_name" property="industryIdDictionaryName"/>
<result column="check_item_id" property="checkItemId"/>
<result column="name_join_by_check_item_id" property="nameJoinByCheckItemId"/>
<result column="summary_join_by_check_item_id" property="summaryJoinByCheckItemId"/>
<result column="type_join_by_check_item_id" property="typeJoinByCheckItemId"/>
</resultMap>
<!-- 新增行业检查项 -->
<insert id="saveIndustryCheckItem" parameterType="map">
INSERT INTO gen_industry_check_item(
industry_check_item_id,
industry_id,
check_item_id,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{industryCheckItemId},
#{industryId},
#{checkItemId},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除行业检查项 -->
<update id="removeIndustryCheckItem" parameterType="map">
UPDATE
gen_industry_check_item
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
industry_check_item_id IN
<foreach collection="industryCheckItemIds" index="index" open="(" separator="," close=")">
#{industryCheckItemIds[${index}]}
</foreach>
</update>
<!-- 修改行业检查项 -->
<update id="updateIndustryCheckItem" parameterType="map">
UPDATE
gen_industry_check_item
SET
<if test="industryId != null and industryId != ''">
industry_id = #{industryId},
</if>
<if test="checkItemId != null and checkItemId != ''">
check_item_id = #{checkItemId},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
industry_check_item_id = #{industryCheckItemId}
</update>
<!-- 行业检查项详情 -->
<select id="getIndustryCheckItem" parameterType="map" resultMap="industryCheckItemDTO">
SELECT
t1.industry_id,
t1.check_item_id,
t1.industry_check_item_id
FROM
gen_industry_check_item t1
WHERE
t1.is_delete = 0
<if test="industryCheckItemId != null and industryCheckItemId != ''">
AND
t1.industry_check_item_id = #{industryCheckItemId}
</if>
</select>
<!-- 行业检查项列表 -->
<select id="listIndustryCheckItem" parameterType="map" resultMap="industryCheckItemDTO">
SELECT
t1.industry_id,
2020-03-30 17:08:24 +08:00
t1.check_item_id,
dt1.dictionary_name industry_id_dictionary_name,
2020-03-27 22:30:02 +08:00
jt1.name name_join_by_check_item_id,
jt1.summary summary_join_by_check_item_id,
jt1.type type_join_by_check_item_id,
t1.industry_check_item_id
FROM
gen_industry_check_item t1
LEFT JOIN
data_dictionary dt1
ON
2020-03-30 17:08:24 +08:00
dt1.dictionary_id = t1.industry_id
2020-03-27 22:30:02 +08:00
AND
dt1.is_delete = 0
LEFT JOIN
gen_check_item jt1
ON
t1.check_item_id = jt1.check_item_id
AND
jt1.is_delete = 0
WHERE
t1.is_delete = 0
<if test="keywords != null and 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>
2020-03-30 17:08:24 +08:00
<if test="industryId != null and industryId != ''">
AND
t1.industry_id = #{industryId}
</if>
2020-03-27 22:30:02 +08:00
<if test="industryCheckItemIds != null and industryCheckItemIds.size > 0">
AND
t1.industry_check_item_id IN
<foreach collection="industryCheckItemIds" index="index" open="(" separator="," close=")">
#{industryCheckItemIds[${index}]}
</foreach>
</if>
</select>
</mapper>