196 lines
11 KiB
XML
196 lines
11 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.xdadan.erp.emis.mapper.EmisWaybillAttachmentMapper">
|
|
|
|
<resultMap type="EmisWaybillAttachment" id="EmisWaybillAttachmentResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<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="selectEmisWaybillAttachmentVo">
|
|
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
|
|
</sql>
|
|
|
|
<select id="selectEmisWaybillAttachmentList" parameterType="EmisWaybillAttachment" resultMap="EmisWaybillAttachmentResult">
|
|
<include refid="selectEmisWaybillAttachmentVo"/>
|
|
<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 ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
|
|
<if test="attachType != null and attachType != ''"> and FIND_IN_SET(attach_type,#{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 like concat('%', #{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=#{createSite}</if>
|
|
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
|
|
|
<if test="params.blIsClear != null and params.blIsClear == 1 ">
|
|
and attach_type in ('3','4')
|
|
</if>
|
|
|
|
<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>
|
|
|
|
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
|
and (
|
|
create_site in (
|
|
SELECT t1.site_code FROM (
|
|
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
|
|
#{params.privSiteCode} ) pd
|
|
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
|
|
UNION
|
|
SELECT #{params.privSiteCode} FROM dual
|
|
)
|
|
)
|
|
</if>
|
|
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
|
|
<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
|
|
where del_flag='0' and a.bill_code = #{billCode}
|
|
</select>
|
|
|
|
<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}
|
|
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="selectEmisWaybillAttachmentById" parameterType="Long" 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
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmisWaybillAttachment" parameterType="EmisWaybillAttachment" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_waybill_attachment
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<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="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="updateEmisWaybillAttachment" parameterType="EmisWaybillAttachment">
|
|
update emis_waybill_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="deleteEmisWaybillAttachmentById" parameterType="Long">
|
|
update emis_waybill_attachment set del_flag='1' where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisWaybillAttachmentByIds" parameterType="String">
|
|
update emis_waybill_attachment set del_flag='1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteByBillCodeAndAttachType">
|
|
update emis_waybill_attachment set del_flag='1' where bill_code = #{billCode} and attach_type = #{attachType}
|
|
</delete>
|
|
|
|
|
|
</mapper> |