2024-03-01 03:56:25 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
2024-03-01 06:47:57 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2024-03-01 03:56:25 +00:00
<mapper namespace= "com.xdadan.erp.emis.mapper.EmisWaybillAttachmentMapper" >
2024-03-01 06:47:57 +00:00
2024-06-02 02:57:46 +00:00
<resultMap type= "EmisWaybillAttachment" id= "EmisWaybillAttachmentResult" extends= "com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult" >
2024-03-01 03:56:25 +00:00
<result property= "id" column= "id" />
<result property= "waybillId" column= "waybill_id" />
2024-05-23 13:40:29 +00:00
<result property= "billCode" column= "bill_code" />
2024-03-01 06:47:57 +00:00
<result property= "attachType" column= "attach_type" />
2024-03-01 03:56:25 +00:00
<result property= "fileName" column= "file_name" />
<result property= "fileUrl" column= "file_url" />
2024-05-23 13:40:29 +00:00
<result property= "fileSiez" column= "file_siez" />
2024-03-01 03:56:25 +00:00
<result property= "fileDesc" column= "file_desc" />
<result property= "orderNum" column= "order_num" />
2024-05-24 07:37:09 +00:00
<result property= "dataFrom" column= "data_from" />
2024-06-02 02:57:46 +00:00
2024-03-01 03:56:25 +00:00
</resultMap>
<sql id= "selectEmisWaybillAttachmentVo" >
2024-05-24 07:37:09 +00:00
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_waybill_attachment
2024-03-01 03:56:25 +00:00
</sql>
<select id= "selectEmisWaybillAttachmentList" parameterType= "EmisWaybillAttachment" resultMap= "EmisWaybillAttachmentResult" >
<include refid= "selectEmisWaybillAttachmentVo" />
2024-03-01 06:47:57 +00:00
<where >
2024-05-16 05:31:02 +00:00
del_flag='0'
2024-03-01 03:56:25 +00:00
<if test= "id != null " > and id = #{id}</if>
<if test= "waybillId != null " > and waybill_id = #{waybillId}</if>
2025-03-31 02:37:37 +00:00
<if test= "billCode != null and billCode != ''" > and `bill_code` ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
2024-06-11 12:42:12 +00:00
<if test= "attachType != null and attachType != ''" > and FIND_IN_SET(attach_type,#{attachType})</if>
2024-03-01 03:56:25 +00:00
<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>
2024-05-23 13:40:29 +00:00
<if test= "fileSiez != null " > and file_siez = #{fileSiez}</if>
2024-03-01 03:56:25 +00:00
<if test= "fileDesc != null and fileDesc != ''" > and file_desc like concat('%', #{fileDesc}, '%')</if>
2024-04-25 09:42:49 +00:00
<if test= "orderNum != null " > and order_num like concat('%', #{orderNum}, '%')</if>
2024-05-24 07:37:09 +00:00
<if test= "dataFrom != null and dataFrom != ''" > and data_from like concat('%', #{dataFrom}, '%')</if>
2024-05-23 15:38:08 +00:00
<if test= "remark != null and remark != ''" > and remark like concat('%', #{remark}, '%')</if>
2024-03-01 03:56:25 +00:00
<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>
2024-06-05 13:30:37 +00:00
<if test= "createSite != null and createSite != ''" > and create_site=#{createSite}</if>
2024-05-23 15:38:08 +00:00
<if test= "updateSite != null and updateSite != ''" > and update_site like concat('%', #{updateSite}, '%')</if>
2024-06-05 13:30:37 +00:00
<if test= "params.beginCreateTime != null and params.beginCreateTime != ''" >
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test= "params.endCreateTime != null and params.endCreateTime != ''" >
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
2024-06-18 07:15:28 +00:00
<if test= "params.privSiteCode != null and params.privSiteCode != '88888'" >
and (
2025-03-18 03:03:03 +00:00
create_site=#{params.privSiteCode}
2024-06-18 07:15:28 +00:00
)
</if>
2024-03-01 03:56:25 +00:00
</where>
order by create_time desc
</select>
2024-03-01 06:47:57 +00:00
2024-07-02 03:13:57 +00:00
<select id= "selectAttachmentListByBillCode" parameterType= "String" resultMap= "EmisWaybillAttachmentResult" >
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_waybill_attachment a
2024-08-09 10:49:05 +00:00
where del_flag='0' and a.bill_code = #{billCode}
2024-07-02 03:13:57 +00:00
</select>
2024-05-23 13:40:29 +00:00
<select id= "checkUnique" parameterType= "EmisWaybillAttachment" resultType= "int" >
select count(1) from emis_waybill_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}
2024-05-24 07:37:09 +00:00
and data_from = #{dataFrom}
2024-05-23 15:38:08 +00:00
and remark = #{remark}
2024-05-23 13:40:29 +00:00
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
2024-05-23 15:38:08 +00:00
and create_site = #{createSite}
and update_site = #{updateSite}
2024-05-23 13:40:29 +00:00
limit 1
</select>
2024-03-01 03:56:25 +00:00
<select id= "selectEmisWaybillAttachmentById" parameterType= "Long" resultMap= "EmisWaybillAttachmentResult" >
2024-05-24 07:37:09 +00:00
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
2024-03-01 03:56:25 +00:00
from emis_waybill_attachment a
where a.id = #{id}
</select>
2024-03-01 06:47:57 +00:00
2024-05-23 13:40:29 +00:00
<insert id= "insertEmisWaybillAttachment" parameterType= "EmisWaybillAttachment" useGeneratedKeys= "true" keyProperty= "id" >
2024-03-01 03:56:25 +00:00
insert into emis_waybill_attachment
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "waybillId != null" > waybill_id,</if>
2024-05-23 13:40:29 +00:00
<if test= "billCode != null and billCode != ''" > bill_code,</if>
2024-03-01 06:47:57 +00:00
<if test= "attachType != null and attachType != ''" > attach_type,</if>
2024-03-01 03:56:25 +00:00
<if test= "fileName != null and fileName != ''" > file_name,</if>
<if test= "fileUrl != null and fileUrl != ''" > file_url,</if>
2024-05-23 13:40:29 +00:00
<if test= "fileSiez != null" > file_siez,</if>
2024-03-01 03:56:25 +00:00
<if test= "fileDesc != null and fileDesc != ''" > file_desc,</if>
2024-04-25 09:42:49 +00:00
<if test= "orderNum != null" > order_num,</if>
2024-05-24 07:37:09 +00:00
<if test= "dataFrom != null and dataFrom != ''" > data_from,</if>
2024-05-23 15:38:08 +00:00
<if test= "remark != null and remark != ''" > remark,</if>
2024-03-01 03:56:25 +00:00
<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>
2024-05-23 15:38:08 +00:00
<if test= "createSite != null and createSite != ''" > create_site,</if>
<if test= "updateSite != null and updateSite != ''" > update_site,</if>
2024-03-01 06:47:57 +00:00
</trim>
2024-03-01 03:56:25 +00:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "waybillId != null" > #{waybillId},</if>
2024-05-23 13:40:29 +00:00
<if test= "billCode != null and billCode != ''" > #{billCode},</if>
2024-03-01 06:47:57 +00:00
<if test= "attachType != null and attachType != ''" > #{attachType},</if>
2024-03-01 03:56:25 +00:00
<if test= "fileName != null and fileName != ''" > #{fileName},</if>
<if test= "fileUrl != null and fileUrl != ''" > #{fileUrl},</if>
2024-05-23 13:40:29 +00:00
<if test= "fileSiez != null" > #{fileSiez},</if>
2024-03-01 03:56:25 +00:00
<if test= "fileDesc != null and fileDesc != ''" > #{fileDesc},</if>
2024-04-25 09:42:49 +00:00
<if test= "orderNum != null" > #{orderNum},</if>
2024-05-24 07:37:09 +00:00
<if test= "dataFrom != null and dataFrom != ''" > #{dataFrom},</if>
2024-05-23 15:38:08 +00:00
<if test= "remark != null and remark != ''" > #{remark},</if>
2024-03-01 03:56:25 +00:00
<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>
2024-05-23 15:38:08 +00:00
<if test= "createSite != null and createSite != ''" > #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > #{updateSite},</if>
2024-03-01 06:47:57 +00:00
</trim>
2024-03-01 03:56:25 +00:00
</insert>
<update id= "updateEmisWaybillAttachment" parameterType= "EmisWaybillAttachment" >
update emis_waybill_attachment
<trim prefix= "SET" suffixOverrides= "," >
<if test= "waybillId != null" > waybill_id = #{waybillId},</if>
2024-05-23 13:40:29 +00:00
<if test= "billCode != null and billCode != ''" > bill_code = #{billCode},</if>
2024-03-01 06:47:57 +00:00
<if test= "attachType != null and attachType != ''" > attach_type = #{attachType},</if>
2024-03-01 03:56:25 +00:00
<if test= "fileName != null and fileName != ''" > file_name = #{fileName},</if>
<if test= "fileUrl != null and fileUrl != ''" > file_url = #{fileUrl},</if>
2024-05-23 13:40:29 +00:00
<if test= "fileSiez != null" > file_siez = #{fileSiez},</if>
2024-03-01 03:56:25 +00:00
<if test= "fileDesc != null and fileDesc != ''" > file_desc = #{fileDesc},</if>
2024-04-25 09:42:49 +00:00
<if test= "orderNum != null" > order_num = #{orderNum},</if>
2024-05-24 07:37:09 +00:00
<if test= "dataFrom != null and dataFrom != ''" > data_from = #{dataFrom},</if>
2024-05-23 15:38:08 +00:00
<if test= "remark != null and remark != ''" > remark = #{remark},</if>
2024-03-01 03:56:25 +00:00
<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>
2024-05-23 15:38:08 +00:00
<if test= "createSite != null and createSite != ''" > create_site = #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
2024-03-01 03:56:25 +00:00
</trim>
where id = #{id}
</update>
<delete id= "deleteEmisWaybillAttachmentById" parameterType= "Long" >
2024-06-15 12:15:30 +00:00
update emis_waybill_attachment set del_flag='1' where id = #{id}
2024-03-01 03:56:25 +00:00
</delete>
<delete id= "deleteEmisWaybillAttachmentByIds" parameterType= "String" >
2024-06-15 12:15:30 +00:00
update emis_waybill_attachment set del_flag='1' where id in
2024-03-01 03:56:25 +00:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
2024-06-15 12:15:30 +00:00
<delete id= "deleteByBillCodeAndAttachType" >
update emis_waybill_attachment set del_flag='1' where bill_code = #{billCode} and attach_type = #{attachType}
</delete>
2024-03-01 03:56:25 +00:00
</mapper>