2024-04-27 07:34:00 +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.EmisWarehouseInMapper" >
2024-07-28 23:31:47 +00:00
<resultMap type= "EmisWarehouseIn" id= "BaseEmisWarehouseInResult" extends= "com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult" >
2024-04-27 07:34:00 +00:00
<result property= "id" column= "id" />
2024-05-22 00:24:16 +00:00
<result property= "serialNo" column= "serial_no" />
2024-04-27 07:34:00 +00:00
<result property= "inNo" column= "in_no" />
2024-05-22 00:24:16 +00:00
<result property= "orderSn" column= "order_sn" />
<result property= "billCode" column= "bill_code" />
2024-04-27 07:34:00 +00:00
<result property= "customerCode" column= "customer_code" />
<result property= "customerName" column= "customer_name" />
2024-05-22 00:24:16 +00:00
<result property= "entryDate" column= "entry_date" />
<result property= "confirmStatus" column= "confirm_status" />
<result property= "confirmDate" column= "confirm_date" />
<result property= "usedStatus" column= "used_status" />
<result property= "status" column= "status" />
2024-09-08 03:42:33 +00:00
<result property= "stockInFlag" column= "stock_in_flag" />
2024-06-02 02:57:46 +00:00
2024-04-27 07:34:00 +00:00
</resultMap>
2024-07-28 23:31:47 +00:00
<resultMap id= "EmisWarehouseInResult" type= "EmisWarehouseIn" extends= "BaseEmisWarehouseInResult" >
<association property= "waybillDetail"
column="bill_code"
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
fetchType="lazy"
/>
2024-07-30 02:26:20 +00:00
</resultMap>
2024-09-01 09:12:59 +00:00
<!-- <resultMap id="EmisWarehouseInDetailWithBatchListResult" type="EmisWarehouseIn" extends="BaseEmisWarehouseInResult" > -->
<!-- <association property="stockInBatchList" -->
<!-- column="in_no" -->
<!-- select="com.xdadan.erp.emis.mapper.EmisWarehouseInBatchMapper.selectInBatchListByInNo" -->
<!-- fetchType="lazy" -->
<!-- /> -->
<!-- </resultMap> -->
2024-08-21 14:27:17 +00:00
2024-04-27 07:34:00 +00:00
<sql id= "selectEmisWarehouseInVo" >
2024-09-08 03:42:33 +00:00
select id, serial_no, in_no, order_sn, bill_code, customer_code, customer_name, entry_date, confirm_status, confirm_date, used_status, status, stock_in_flag, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_warehouse_in
2024-04-27 07:34:00 +00:00
</sql>
2024-09-08 10:17:41 +00:00
<select id= "selectEmisWarehouseInListByOms" parameterType= "EmisWarehouseIn" resultMap= "EmisWarehouseInResult" >
2024-09-08 10:41:39 +00:00
select id, serial_no, in_no, order_sn, bill_code, customer_code, customer_name, entry_date, confirm_status, confirm_date, used_status, status, stock_in_flag, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_warehouse_in a
2024-09-08 10:17:41 +00:00
<where >
del_flag='0'
<if test= "id != null " > and id = #{id}</if>
<if test= "serialNo != null and serialNo != ''" > and serial_no like concat('%', #{serialNo}, '%')</if>
<if test= "inNo != null and inNo != ''" >
and ( FIND_IN_SET(`in_no`,#{inNo}) or in_no like concat('%', #{inNo}, '%') )
</if>
<if test= "orderSn != null and orderSn != ''" > and order_sn like concat('%', #{orderSn}, '%')</if>
<if test= "billCode != null and billCode != ''" > and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') )</if>
<if test= "customerCode != null and customerCode != ''" > and customer_code=#{customerCode}</if>
<if test= "customerName != null and customerName != ''" > and customer_name like concat('%', #{customerName}, '%')</if>
<if test= "entryDate != null " > and entry_date = #{entryDate}</if>
<if test= "confirmStatus != null and confirmStatus != ''" > and confirm_status=#{confirmStatus}</if>
<if test= "confirmDate != null " > and confirm_date = #{confirmDate}</if>
<if test= "status != null and status != ''" > and status=#{status}</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 like concat('%', #{createSite}, '%')</if>
<if test= "updateSite != null and updateSite != ''" > and update_site like concat('%', #{updateSite}, '%')</if>
<if test= "stockInFlag != null and stockInFlag != ''" > and stock_in_flag=#{stockInFlag}</if>
2024-09-08 10:41:39 +00:00
<if test= "params.queryStatusType != null and params.queryStatusType == 0" >
2024-09-08 10:49:30 +00:00
and confirm_status= '0'
2024-09-08 10:17:41 +00:00
</if>
2024-09-08 10:41:39 +00:00
<if test= "params.queryStatusType != null and params.queryStatusType == 1" >
2024-09-08 10:49:30 +00:00
and confirm_status= '1'
2024-09-08 10:17:41 +00:00
</if>
2024-09-08 10:41:39 +00:00
<if test= "params.queryStatusType != null and params.queryStatusType == 2" >
2024-09-08 10:49:30 +00:00
and confirm_status= '2'
2024-09-08 10:17:41 +00:00
</if>
2024-09-08 10:41:39 +00:00
<if test= "params.searchValue != null and params.searchValue !='' " >
and (
a.in_no like concat('%', #{params.searchValue}, '%')
or a.bill_code like concat('%', #{params.searchValue}, '%')
or a.order_sn like concat('%', #{params.searchValue}, '%')
or exists (
select 1 from emis_waybill ew where a.bill_code=ew.bill_code and (
ew.receive_name like concat('%', #{params.searchValue}, '%') or ew.receive_mobile like concat('%', #{params.searchValue}, '%')
)
)
)
</if>
2024-12-29 05:47:41 +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-09-08 10:17:41 +00:00
</where>
order by create_time desc
</select>
2024-04-27 07:34:00 +00:00
<select id= "selectEmisWarehouseInList" parameterType= "EmisWarehouseIn" resultMap= "EmisWarehouseInResult" >
2024-12-29 05:42:41 +00:00
select id, serial_no, in_no, order_sn, bill_code, customer_code, customer_name, entry_date, confirm_status, confirm_date, used_status, status, stock_in_flag, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_warehouse_in a
2024-04-27 07:34:00 +00:00
<where >
2024-05-22 00:24:16 +00:00
del_flag='0'
2024-04-27 07:34:00 +00:00
<if test= "id != null " > and id = #{id}</if>
2024-05-22 00:24:16 +00:00
<if test= "serialNo != null and serialNo != ''" > and serial_no like concat('%', #{serialNo}, '%')</if>
2024-07-28 23:31:47 +00:00
<if test= "inNo != null and inNo != ''" >
2024-12-28 09:16:33 +00:00
and FIND_IN_SET(`in_no`,#{inNo})
2024-07-28 23:31:47 +00:00
</if>
2024-05-22 00:24:16 +00:00
<if test= "orderSn != null and orderSn != ''" > and order_sn like concat('%', #{orderSn}, '%')</if>
2024-12-28 09:16:33 +00:00
<if test= "billCode != null and billCode != ''" > and FIND_IN_SET(`bill_code`,#{billCode}) </if>
2024-06-19 14:44:32 +00:00
<if test= "customerCode != null and customerCode != ''" > and customer_code=#{customerCode}</if>
2024-04-27 07:34:00 +00:00
<if test= "customerName != null and customerName != ''" > and customer_name like concat('%', #{customerName}, '%')</if>
2024-05-22 00:24:16 +00:00
<if test= "entryDate != null " > and entry_date = #{entryDate}</if>
2024-06-19 14:44:32 +00:00
<if test= "confirmStatus != null and confirmStatus != ''" > and confirm_status=#{confirmStatus}</if>
2024-05-22 00:24:16 +00:00
<if test= "confirmDate != null " > and confirm_date = #{confirmDate}</if>
2024-06-19 15:59:34 +00:00
2024-06-19 14:44:32 +00:00
<if test= "status != null and status != ''" > and status=#{status}</if>
2024-04-27 07:34:00 +00:00
<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 like concat('%', #{createSite}, '%')</if>
<if test= "updateSite != null and updateSite != ''" > and update_site like concat('%', #{updateSite}, '%')</if>
2024-06-19 15:59:34 +00:00
2024-09-08 03:42:33 +00:00
<if test= "stockInFlag != null and stockInFlag != ''" > and stock_in_flag=#{stockInFlag}</if>
2024-06-19 15:59:34 +00:00
<if test= "usedStatus != null and usedStatus == 1" >
and used_status= '1'
</if>
<if test= "usedStatus != null and usedStatus == 0" >
and used_status= '0'
</if>
2024-12-29 05:09:51 +00:00
<if test= "stockInFlag != null and stockInFlag != ''" > and stock_in_flag=#{stockInFlag}</if>
<if test= "params.queryStatusType != null and params.queryStatusType == 0" >
and confirm_status= '0'
</if>
<if test= "params.queryStatusType != null and params.queryStatusType == 1" >
and confirm_status= '1'
</if>
<if test= "params.queryStatusType != null and params.queryStatusType == 2" >
and confirm_status= '2'
</if>
<if test= "params.searchValue != null and params.searchValue !='' " >
and (
a.in_no like concat('%', #{params.searchValue}, '%')
or a.bill_code like concat('%', #{params.searchValue}, '%')
or a.order_sn like concat('%', #{params.searchValue}, '%')
or exists (
select 1 from emis_waybill ew where a.bill_code=ew.bill_code and (
ew.receive_name like concat('%', #{params.searchValue}, '%') or ew.receive_mobile like concat('%', #{params.searchValue}, '%')
)
)
)
</if>
2024-12-29 05:24:25 +00:00
<if test= "params.privSiteCode != null and params.privSiteCode != '88888'" >
2024-12-29 05:34:20 +00:00
and EXISTS (
select 1 from emis_waybill ewb where a.bill_code=ewb.bill_code and ewb.pickup_method in('1','3') and ewb.order_status in ('0','1','3') and ewb.into_warehouse_code=#{params.privSiteCode}
)
2024-12-29 05:24:25 +00:00
</if>
2024-12-29 05:37:43 +00:00
<if test= "params.privSiteCode != null and params.privSiteCode == '88888'" >
and EXISTS (
select 1 from emis_waybill ewb where a.bill_code=ewb.bill_code and ewb.pickup_method in('1','3') and ewb.order_status in ('0','1','3')
)
</if>
2024-12-29 05:47:41 +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-12-29 05:37:43 +00:00
2024-04-27 07:34:00 +00:00
</where>
order by create_time desc
</select>
2024-08-21 14:27:17 +00:00
<select id= "selectEmisWarehouseInById" parameterType= "Long" resultMap= "EmisWarehouseInResult" >
2024-09-08 03:42:33 +00:00
select id, serial_no, in_no, order_sn, bill_code, customer_code, customer_name, entry_date, confirm_status, confirm_date, used_status, status, stock_in_flag, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-04-27 07:34:00 +00:00
from emis_warehouse_in a
where a.id = #{id}
</select>
2024-07-30 02:26:20 +00:00
2024-08-21 14:27:17 +00:00
<select id= "selectEmisWarehouseInByInNo" parameterType= "String" resultMap= "EmisWarehouseInResult" >
2024-09-08 03:42:33 +00:00
select id, serial_no, in_no, order_sn, bill_code, customer_code, customer_name, entry_date, confirm_status, confirm_date, used_status, status, stock_in_flag, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-07-30 02:26:20 +00:00
from emis_warehouse_in a
where a.in_no = #{inNo}
</select>
2024-09-08 03:42:33 +00:00
2024-05-22 00:24:16 +00:00
<insert id= "insertEmisWarehouseIn" parameterType= "EmisWarehouseIn" useGeneratedKeys= "true" keyProperty= "id" >
2024-04-27 07:34:00 +00:00
insert into emis_warehouse_in
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
2024-05-22 00:24:16 +00:00
<if test= "serialNo != null and serialNo != ''" > serial_no,</if>
2024-04-27 07:34:00 +00:00
<if test= "inNo != null and inNo != ''" > in_no,</if>
2024-05-22 00:24:16 +00:00
<if test= "orderSn != null and orderSn != ''" > order_sn,</if>
<if test= "billCode != null and billCode != ''" > bill_code,</if>
2024-04-27 07:34:00 +00:00
<if test= "customerCode != null and customerCode != ''" > customer_code,</if>
<if test= "customerName != null and customerName != ''" > customer_name,</if>
2024-05-22 00:24:16 +00:00
<if test= "entryDate != null" > entry_date,</if>
<if test= "confirmStatus != null and confirmStatus != ''" > confirm_status,</if>
<if test= "confirmDate != null" > confirm_date,</if>
<if test= "usedStatus != null and usedStatus != ''" > used_status,</if>
<if test= "status != null and status != ''" > status,</if>
2024-09-08 03:42:33 +00:00
<if test= "stockInFlag != null and stockInFlag != ''" > stock_in_flag,</if>
2024-04-27 07:34:00 +00:00
<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>
2024-09-08 03:42:33 +00:00
</trim>
2024-04-27 07:34:00 +00:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
2024-05-22 00:24:16 +00:00
<if test= "serialNo != null and serialNo != ''" > #{serialNo},</if>
2024-04-27 07:34:00 +00:00
<if test= "inNo != null and inNo != ''" > #{inNo},</if>
2024-05-22 00:24:16 +00:00
<if test= "orderSn != null and orderSn != ''" > #{orderSn},</if>
<if test= "billCode != null and billCode != ''" > #{billCode},</if>
2024-04-27 07:34:00 +00:00
<if test= "customerCode != null and customerCode != ''" > #{customerCode},</if>
<if test= "customerName != null and customerName != ''" > #{customerName},</if>
2024-05-22 00:24:16 +00:00
<if test= "entryDate != null" > #{entryDate},</if>
<if test= "confirmStatus != null and confirmStatus != ''" > #{confirmStatus},</if>
<if test= "confirmDate != null" > #{confirmDate},</if>
<if test= "usedStatus != null and usedStatus != ''" > #{usedStatus},</if>
<if test= "status != null and status != ''" > #{status},</if>
2024-09-08 03:42:33 +00:00
<if test= "stockInFlag != null and stockInFlag != ''" > #{stockInFlag},</if>
2024-04-27 07:34:00 +00:00
<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>
2024-09-08 03:42:33 +00:00
</trim>
2024-04-27 07:34:00 +00:00
</insert>
<update id= "updateEmisWarehouseIn" parameterType= "EmisWarehouseIn" >
update emis_warehouse_in
<trim prefix= "SET" suffixOverrides= "," >
2024-05-22 00:24:16 +00:00
<if test= "serialNo != null and serialNo != ''" > serial_no = #{serialNo},</if>
2024-04-27 07:34:00 +00:00
<if test= "inNo != null and inNo != ''" > in_no = #{inNo},</if>
2024-05-22 00:24:16 +00:00
<if test= "orderSn != null and orderSn != ''" > order_sn = #{orderSn},</if>
<if test= "billCode != null and billCode != ''" > bill_code = #{billCode},</if>
2024-04-27 07:34:00 +00:00
<if test= "customerCode != null and customerCode != ''" > customer_code = #{customerCode},</if>
<if test= "customerName != null and customerName != ''" > customer_name = #{customerName},</if>
2024-05-22 00:24:16 +00:00
<if test= "entryDate != null" > entry_date = #{entryDate},</if>
<if test= "confirmStatus != null and confirmStatus != ''" > confirm_status = #{confirmStatus},</if>
<if test= "confirmDate != null" > confirm_date = #{confirmDate},</if>
<if test= "usedStatus != null and usedStatus != ''" > used_status = #{usedStatus},</if>
<if test= "status != null and status != ''" > status = #{status},</if>
2024-09-08 03:42:33 +00:00
<if test= "stockInFlag != null and stockInFlag != ''" > stock_in_flag = #{stockInFlag},</if>
2024-04-27 07:34:00 +00:00
<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>
2024-06-19 16:13:05 +00:00
<update id= "changeUseStatusByUse" parameterType= "EmisWarehouseIn" >
2024-06-19 14:44:32 +00:00
update emis_warehouse_in
<trim prefix= "SET" suffixOverrides= "," >
2024-06-19 16:13:05 +00:00
bill_code = #{billCode},
used_status ='1',
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
where in_no = #{inNo}
</update>
<update id= "changeUseStatusByUnUse" parameterType= "EmisWarehouseIn" >
update emis_warehouse_in
<trim prefix= "SET" suffixOverrides= "," >
bill_code =null,
used_status ='0',
2024-06-19 14:44:32 +00:00
<if test= "updateBy != null and updateBy != ''" > update_by = #{updateBy},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
</trim>
2024-06-19 16:13:05 +00:00
where in_no = #{inNo}
2024-06-19 14:44:32 +00:00
</update>
2024-09-08 03:42:33 +00:00
<update id= "updateHasStockInFlag" parameterType= "String" >
update emis_warehouse_in set stock_in_flag = '1' where in_no = #{inNo}
</update>
2024-06-19 14:44:32 +00:00
<update id= "useInNo" parameterType= "EmisWarehouseIn" >
update emis_warehouse_in set used_status='1'
where bill_code = #{billCode} and in_no = #{inNo}
</update>
2024-04-27 07:34:00 +00:00
<delete id= "deleteEmisWarehouseInById" parameterType= "Long" >
delete from emis_warehouse_in where id = #{id}
</delete>
<delete id= "deleteEmisWarehouseInByIds" parameterType= "String" >
delete from emis_warehouse_in where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
</mapper>