You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

96 lines
4.4 KiB

<?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.inspect.img.mapper.InspectionReportImgMapper">
<resultMap type="InspectionReportImg" id="InspectionReportImgResult">
<result property="lineId" column="line_id"/>
<result property="reportInfoId" column="report_info_id"/>
<result property="img" column="img"/>
<result property="imgSrc" column="img_src"/>
<result property="imageNormalUrlPath" column="image_normal_url_path"/>
<result property="creatTime" column="creat_time"/>
<result property="imgType" column="img_type"/>
</resultMap>
<sql id="selectInspectionReportImgVo">
select line_id, report_info_id, img, img_src, image_normal_url_path, creat_time, img_type
from inspection_report_img
</sql>
<select id="selectInspectionReportImgList" parameterType="InspectionReportImg"
resultMap="InspectionReportImgResult">
<include refid="selectInspectionReportImgVo"/>
<where>
<if test="reportInfoId != null and reportInfoId != ''">and report_info_id = #{reportInfoId}</if>
<if test="img != null and img != ''">and img = #{img}</if>
<if test="imgSrc != null and imgSrc != ''">and img_src = #{imgSrc}</if>
<if test="creatTime != null ">and creat_time = #{creatTime}</if>
<if test="imgType != null and imgType != ''">and img_type = #{imgType}</if>
</where>
</select>
<select id="selectInspectionReportImgByLineId" parameterType="Long" resultMap="InspectionReportImgResult">
<include refid="selectInspectionReportImgVo"/>
where line_id = #{lineId}
</select>
<select id="selectByReportInfoIds" resultMap="InspectionReportImgResult">
<include refid="selectInspectionReportImgVo"/>
where report_info_id in
<foreach collection="lineIds" item="lineId" open="(" separator="," close=")">
#{lineId}
</foreach>
</select>
<insert id="insertInspectionReportImg" parameterType="InspectionReportImg" useGeneratedKeys="true"
keyProperty="lineId">
insert into inspection_report_img
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="reportInfoId != null">report_info_id,</if>
<if test="img != null">img,</if>
<if test="imgSrc != null">img_src,</if>
<if test="creatTime != null">creat_time,</if>
<if test="imgType != null">img_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="reportInfoId != null">#{reportInfoId},</if>
<if test="img != null">#{img},</if>
<if test="imgSrc != null">#{imgSrc},</if>
<if test="creatTime != null">#{creatTime},</if>
<if test="imgType != null">#{imgType},</if>
</trim>
</insert>
<update id="updateInspectionReportImg" parameterType="InspectionReportImg">
update inspection_report_img
<trim prefix="SET" suffixOverrides=",">
<if test="reportInfoId != null">report_info_id = #{reportInfoId},</if>
<if test="img != null">img = #{img},</if>
<if test="imgSrc != null">img_src = #{imgSrc},</if>
<if test="creatTime != null">creat_time = #{creatTime},</if>
<if test="imgType != null">img_type = #{imgType},</if>
</trim>
where line_id = #{lineId}
</update>
<delete id="deleteInspectionReportImgByLineId" parameterType="Long">
delete
from inspection_report_img
where line_id = #{lineId}
</delete>
<delete id="deleteInspectionReportImgByLineIds" parameterType="String">
delete from inspection_report_img where line_id in
<foreach item="lineId" collection="array" open="(" separator="," close=")">
#{lineId}
</foreach>
</delete>
<insert id="batchInsertInspectionReportImg" parameterType="java.util.List">
insert into inspection_report_img (line_id, report_info_id, img, img_src, image_normal_url_path, creat_time, img_type) values
<foreach collection="list" item="t" index="index" separator=",">
(#{t.lineId}, #{t.reportInfoId}, #{t.img}, #{t.imgSrc}, #{t.imageNormalUrlPath}, #{t.creatTime}, #{t.imgType})
</foreach>
</insert>
</mapper>