187 lines
11 KiB
XML
187 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.EmisTmsSiteBatchDtlMapper">
|
|
|
|
<resultMap type="EmisTmsSiteBatchDtl" id="BaseEmisTmsSiteBatchDtlResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id" />
|
|
<result property="billCode" column="bill_code" />
|
|
<result property="batchNo" column="batch_no" />
|
|
<result property="scanDate" column="scan_date" />
|
|
<result property="scanStatus" column="scan_status" />
|
|
<result property="groupStatus" column="group_status" />
|
|
<result property="scanMan" column="scan_man" />
|
|
<result property="scanSite" column="scan_site" />
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="EmisTmsSiteBatchDtlResult" type="EmisTmsSiteBatchDtl" extends="BaseEmisTmsSiteBatchDtlResult" >
|
|
<association property="waybillDetail"
|
|
column="bill_code"
|
|
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
|
|
fetchType="lazy"
|
|
/>
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisTmsSiteBatchDtlVo">
|
|
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_site_batch_dtl
|
|
</sql>
|
|
|
|
<select id="selectEmisTmsSiteBatchDtlList" parameterType="EmisTmsSiteBatchDtl" resultMap="EmisTmsSiteBatchDtlResult">
|
|
<include refid="selectEmisTmsSiteBatchDtlVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') )</if>
|
|
<if test="batchNo != null and batchNo != ''"> and ( FIND_IN_SET(`batch_no`,#{batchNo}) or batch_no like concat('%', #{batchNo}, '%') )</if>
|
|
<if test="scanDate != null "> and scan_date = #{scanDate}</if>
|
|
<if test="scanStatus != null and scanStatus != ''"> and scan_status=#{scanStatus}</if>
|
|
<if test="groupStatus != null and groupStatus != ''"> and group_status=#{groupStatus}</if>
|
|
<if test="scanMan != null and scanMan != ''"> and scan_man like concat('%', #{scanMan}, '%')</if>
|
|
<if test="scanSite != null and scanSite != ''"> and scan_site =#{scanSite}</if>
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</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=#{updateSite}</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="checkUnique" parameterType="EmisTmsSiteBatchDtl" resultType="int">
|
|
select count(1) from emis_tms_site_batch_dtl
|
|
where del_flag='0'
|
|
and id = #{id}
|
|
and bill_code = #{billCode}
|
|
and batch_no = #{batchNo}
|
|
and scan_date = #{scanDate}
|
|
and scan_status = #{scanStatus}
|
|
and group_status = #{groupStatus}
|
|
and scan_man = #{scanMan}
|
|
and scan_site = #{scanSite}
|
|
and remark = #{remark}
|
|
and tenant_id = #{tenantId}
|
|
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="selectEmisTmsSiteBatchDtlById" parameterType="Long" resultMap="EmisTmsSiteBatchDtlResult">
|
|
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_tms_site_batch_dtl a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmisTmsSiteBatchDtl" parameterType="EmisTmsSiteBatchDtl" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_tms_site_batch_dtl
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="billCode != null and billCode != ''">bill_code,</if>
|
|
<if test="batchNo != null and batchNo != ''">batch_no,</if>
|
|
<if test="scanDate != null">scan_date,</if>
|
|
<if test="scanStatus != null and scanStatus != ''">scan_status,</if>
|
|
<if test="groupStatus != null and groupStatus != ''">group_status,</if>
|
|
<if test="scanMan != null and scanMan != ''">scan_man,</if>
|
|
<if test="scanSite != null and scanSite != ''">scan_site,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="tenantId != null and tenantId != ''">tenant_id,</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="billCode != null and billCode != ''">#{billCode},</if>
|
|
<if test="batchNo != null and batchNo != ''">#{batchNo},</if>
|
|
<if test="scanDate != null">#{scanDate},</if>
|
|
<if test="scanStatus != null and scanStatus != ''">#{scanStatus},</if>
|
|
<if test="groupStatus != null and groupStatus != ''">#{groupStatus},</if>
|
|
<if test="scanMan != null and scanMan != ''">#{scanMan},</if>
|
|
<if test="scanSite != null and scanSite != ''">#{scanSite},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="tenantId != null and tenantId != ''">#{tenantId},</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="updateEmisTmsSiteBatchDtl" parameterType="EmisTmsSiteBatchDtl">
|
|
update emis_tms_site_batch_dtl
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
|
|
<if test="batchNo != null and batchNo != ''">batch_no = #{batchNo},</if>
|
|
<if test="scanDate != null">scan_date = #{scanDate},</if>
|
|
<if test="scanStatus != null and scanStatus != ''">scan_status = #{scanStatus},</if>
|
|
<if test="groupStatus != null and groupStatus != ''">group_status = #{groupStatus},</if>
|
|
<if test="scanMan != null and scanMan != ''">scan_man = #{scanMan},</if>
|
|
<if test="scanSite != null and scanSite != ''">scan_site = #{scanSite},</if>
|
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
|
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</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="deleteEmisTmsSiteBatchDtlById" parameterType="Long">
|
|
delete from emis_tms_site_batch_dtl where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsSiteBatchDtlByIds" parameterType="String">
|
|
delete from emis_tms_site_batch_dtl where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 根据批次号查询批次明细 -->
|
|
<select id="selectEmisTmsSiteBatchDtlByBatchNo" parameterType="String" resultMap="EmisTmsSiteBatchDtlResult">
|
|
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_tms_site_batch_dtl
|
|
where batch_no = #{batchNo}
|
|
and del_flag = '0'
|
|
</select>
|
|
</mapper> |