You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-wms-java/src/main/resources/mybatis/mapper/inv/InvCountOrderDetailMapper.xml

118 lines
4.5 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.glxp.api.dao.inv.InvCountOrderDetailMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.inv.InvCountOrderDetailEntity">
<!--@mbg.generated-->
<!--@Table inv_count_order_detail-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="orderIdFk" jdbcType="VARCHAR" property="orderIdFk"/>
<result column="productId" jdbcType="VARCHAR" property="productId"/>
<result column="nameCode" jdbcType="VARCHAR" property="nameCode"/>
<result column="batchNo" jdbcType="VARCHAR" property="batchNo"/>
<result column="produceDate" jdbcType="VARCHAR" property="produceDate"/>
<result column="expireDate" jdbcType="VARCHAR" property="expireDate"/>
<result column="serialNo" jdbcType="VARCHAR" property="serialNo"/>
<result column="countNum" jdbcType="INTEGER" property="countNum"/>
<result column="invNum" jdbcType="INTEGER" property="invNum"/>
<result column="profitNum" jdbcType="INTEGER" property="profitNum"/>
<result column="lossNum" jdbcType="INTEGER" property="lossNum"/>
<result column="status" jdbcType="BOOLEAN" property="status"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, orderIdFk, productId, nameCode, batchNo, produceDate, expireDate, serialNo, countNum,
invNum, profitNum, lossNum, `status`
</sql>
<delete id="deleteByOrderId">
delete
from inv_count_order_detail
where orderIdFk = #{orderId}
</delete>
<select id="filterList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_count_order_detail
where orderIdFk = #{orderIdFk}
</select>
<select id="countByOrderIdFk" resultType="java.lang.Long">
select count(*)
from inv_count_order_detail
where orderIdFk = #{orderIdFk}
</select>
<select id="filterCountDetail" resultType="com.glxp.api.res.inv.InvCountOrderDetailResponse">
select od.*, ip.productsName productName, ip.ggxh, ip.ylqxzcrbarmc, ip.zczbhhzbapzbh
from inv_count_order_detail od
left join inv_count_order ico on od.orderIdFk = ico.orderId
left join inv_product ip on od.productId = ip.relIdFk
where od.orderIdFk = #{orderIdFk}
and ip.invStorageCode = ico.invStorageCode
and ip.invWarehouseCode = ico.invWarehouseCode
group by od.id
</select>
<delete id="deleteByOrderIdAndProductId">
delete
from inv_count_codes
where orderIdFk = #{orderIdFk}
and productId = #{productId}
</delete>
<select id="selectOrderDetail" resultMap="BaseResultMap">
select *
from inv_count_order_detail
<where>
<if test="productId != null and productId != ''">
AND productId = #{productId}
</if>
<if test="nameCode != null and nameCode != ''">
AND nameCode = #{nameCode}
</if>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="produceDate != null and produceDate != ''">
AND produceDate = #{produceDate}
</if>
<if test="expireDate != null and expireDate != ''">
AND expireDate = #{expireDate}
</if>
</where>
</select>
<select id="selectByOrderId" resultMap="BaseResultMap">
select *
from inv_count_order_detail
where orderIdFk = #{orderId}
</select>
<update id="resetCountFiledValue">
update inv_count_order_detail
set profitNum = null,
lossNum = null,
status = null
where orderIdFk = #{orderId}
</update>
<select id="selectDetailList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_count_order_detail
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="status != null">
AND status = #{status}
</if>
</where>
</select>
</mapper>