emis-service/emis-biz/src/main/resources/mapper/EmisOrderAttachmentMapper.xml

158 lines
9.3 KiB
XML
Raw Normal View History

2024-06-30 07:16:16 +00: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.xdadan.erp.emis.mapper.EmisOrderAttachmentMapper">
<resultMap type="EmisOrderAttachment" id="EmisOrderAttachmentResult">
<result property="id" column="id" />
<result property="waybillId" column="waybill_id" />
<result property="billCode" column="bill_code" />
<result property="attachType" column="attach_type" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="fileSiez" column="file_siez" />
<result property="fileDesc" column="file_desc" />
<result property="orderNum" column="order_num" />
<result property="dataFrom" column="data_from" />
</resultMap>
<sql id="selectEmisOrderAttachmentVo">
select id, waybill_id, bill_code, attach_type, file_name, file_url, file_siez, file_desc, order_num, data_from, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_order_attachment
</sql>
<select id="selectEmisOrderAttachmentList" parameterType="EmisOrderAttachment" resultMap="EmisOrderAttachmentResult">
<include refid="selectEmisOrderAttachmentVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="waybillId != null "> and waybill_id = #{waybillId}</if>
<if test="billCode != null and billCode != ''"> and bill_code like concat('%', #{billCode}, '%')</if>
<if test="attachType != null and attachType != ''"> and attach_type like concat('%', #{attachType}, '%')</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url like concat('%', #{fileUrl}, '%')</if>
<if test="fileSiez != null "> and file_siez = #{fileSiez}</if>
<if test="fileDesc != null and fileDesc != ''"> and file_desc like concat('%', #{fileDesc}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="dataFrom != null and dataFrom != ''"> and data_from like concat('%', #{dataFrom}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisOrderAttachment" resultType="int">
select count(1) from emis_order_attachment
where del_flag='0'
and id = #{id}
and waybill_id = #{waybillId}
and bill_code = #{billCode}
and attach_type = #{attachType}
and file_name = #{fileName}
and file_url = #{fileUrl}
and file_siez = #{fileSiez}
and file_desc = #{fileDesc}
and order_num = #{orderNum}
and data_from = #{dataFrom}
and remark = #{remark}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisOrderAttachmentById" parameterType="Long" resultMap="EmisOrderAttachmentResult">
select id, waybill_id, bill_code, attach_type, file_name, file_url, file_siez, file_desc, order_num, data_from, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_order_attachment a
where a.id = #{id}
</select>
<insert id="insertEmisOrderAttachment" parameterType="EmisOrderAttachment" useGeneratedKeys="true" keyProperty="id">
insert into emis_order_attachment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="waybillId != null">waybill_id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="attachType != null and attachType != ''">attach_type,</if>
<if test="fileName != null and fileName != ''">file_name,</if>
<if test="fileUrl != null and fileUrl != ''">file_url,</if>
<if test="fileSiez != null">file_siez,</if>
<if test="fileDesc != null and fileDesc != ''">file_desc,</if>
<if test="orderNum != null">order_num,</if>
<if test="dataFrom != null and dataFrom != ''">data_from,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="waybillId != null">#{waybillId},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="attachType != null and attachType != ''">#{attachType},</if>
<if test="fileName != null and fileName != ''">#{fileName},</if>
<if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if>
<if test="fileSiez != null">#{fileSiez},</if>
<if test="fileDesc != null and fileDesc != ''">#{fileDesc},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="dataFrom != null and dataFrom != ''">#{dataFrom},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisOrderAttachment" parameterType="EmisOrderAttachment">
update emis_order_attachment
<trim prefix="SET" suffixOverrides=",">
<if test="waybillId != null">waybill_id = #{waybillId},</if>
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="attachType != null and attachType != ''">attach_type = #{attachType},</if>
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
<if test="fileUrl != null and fileUrl != ''">file_url = #{fileUrl},</if>
<if test="fileSiez != null">file_siez = #{fileSiez},</if>
<if test="fileDesc != null and fileDesc != ''">file_desc = #{fileDesc},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="dataFrom != null and dataFrom != ''">data_from = #{dataFrom},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisOrderAttachmentById" parameterType="Long">
delete from emis_order_attachment where id = #{id}
</delete>
<delete id="deleteEmisOrderAttachmentByIds" parameterType="String">
delete from emis_order_attachment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>