You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.2 KiB
113 lines
4.2 KiB
<?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.nov.KgLowDurable.mapper.LdOnePutStorageDetailMapper"> |
|
|
|
<resultMap id="ldOnePutStorageDetailResultMap" type="com.nov.KgLowDurable.pojo.entity.LdOnePutStorageDetail"> |
|
<!-- 主键 --> |
|
<id column="id" property="id" /> |
|
<result column="inbound_detail_code" property="inboundDetailCode" /> |
|
<result column="one_put_storage_id" property="onePutStorageId" /> |
|
<result column="one_put_storage_no" property="onePutStorageNo" /> |
|
<result column="ld_purchase_end_id" property="ldPurchaseEndId" /> |
|
<result column="material_id" property="materialId" /> |
|
<result column="material_name" property="materialName" /> |
|
<result column="material_code" property="materialCode" /> |
|
<result column="model" property="model" /> |
|
<result column="type" property="type" /> |
|
<result column="unit" property="unit" /> |
|
<result column="required_quantity" property="requiredQuantity" /> |
|
<result column="inbound_quantity" property="inboundQuantity" /> |
|
<result column="unit_price" property="unitPrice" /> |
|
<result column="amount" property="amount" /> |
|
<result column="inbound_status" property="inboundStatus" /> |
|
<result column="inbound_person" property="inboundPerson" /> |
|
<result column="inbound_time" property="inboundTime" /> |
|
<result column="remark" property="remark" /> |
|
</resultMap> |
|
|
|
<!-- 基础查询SQL --> |
|
<sql id="baseColumnList"> |
|
id, |
|
inbound_detail_code, |
|
one_put_storage_id, |
|
one_put_storage_no, |
|
ld_purchase_end_id, |
|
material_id, |
|
material_name, |
|
material_code, |
|
model, |
|
type, |
|
unit, |
|
required_quantity, |
|
inbound_quantity, |
|
unit_price, |
|
amount, |
|
inbound_status, |
|
inbound_person, |
|
inbound_time, |
|
remark |
|
</sql> |
|
|
|
<select id="selectById" resultMap="ldOnePutStorageDetailResultMap"> |
|
SELECT |
|
<include refid="baseColumnList" /> |
|
FROM ld_one_put_storage_detail |
|
WHERE id = #{id} |
|
</select> |
|
|
|
<select id="selectByMaterialId" resultType="com.nov.KgLowDurable.pojo.entity.LdOnePutStorageDetail"> |
|
SELECT |
|
<include refid="baseColumnList" /> |
|
FROM ld_one_put_storage_detail |
|
WHERE one_put_storage_id = #{onePutStorageId} |
|
AND material_id = #{materialId} |
|
</select> |
|
|
|
<select id="selectMaxOrderNo" resultType="java.lang.String"> |
|
SELECT MAX(inbound_detail_code) |
|
FROM ld_one_put_storage_detail |
|
WHERE inbound_detail_code LIKE CONCAT(#{prefix}, #{date}, '%') |
|
</select> |
|
|
|
<select id="selectSummaryData" resultType="com.nov.KgLowDurable.pojo.entity.LdOnePutStorageDetail"> |
|
SELECT |
|
ld_purchase_end_id, |
|
material_id, |
|
material_name, |
|
material_code, |
|
model, |
|
type, |
|
unit, |
|
required_quantity, |
|
SUM(inbound_quantity) as inbound_quantity |
|
FROM ld_one_put_storage_detail |
|
WHERE ld_purchase_end_id IS NOT NULL |
|
and one_put_storage_id in |
|
<foreach collection="collect" item="id" open="(" separator="," close=")"> |
|
#{id} |
|
</foreach> |
|
GROUP BY |
|
ld_purchase_end_id, |
|
material_id, |
|
material_name, |
|
material_code, |
|
model, |
|
type, |
|
unit, |
|
required_quantity |
|
ORDER BY ld_purchase_end_id, material_id; |
|
</select> |
|
|
|
<select id="selectByOnePutStorageId" resultType="com.nov.KgLowDurable.pojo.entity.LdOnePutStorageDetail"> |
|
SELECT |
|
<include refid="baseColumnList" /> |
|
FROM ld_one_put_storage_detail |
|
WHERE one_put_storage_id = #{onePutStorageId} |
|
</select> |
|
<select id="selectByLdPurchaseEndId" resultType="com.nov.KgLowDurable.pojo.entity.LdOnePutStorageDetail"> |
|
SELECT |
|
<include refid="baseColumnList" /> |
|
FROM ld_one_put_storage_detail where ld_purchase_end_id = #{ldPurchaseEndId} and inbound_status = 2 |
|
</select> |
|
|
|
</mapper>
|
|
|