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.
243 lines
17 KiB
XML
243 lines
17 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.hw.mes.mapper.MesProduceStatisticsDetailMapper">
|
|
|
|
<resultMap type="MesProduceStatisticsDetail" id="MesProduceStatisticsDetailResult">
|
|
<result property="statisticsDetailId" column="statistics_detail_id" />
|
|
<result property="productOrderId" column="product_order_id" />
|
|
<result property="productOrderStatus" column="product_order_status" />
|
|
<result property="dispatchType" column="dispatch_type" />
|
|
<result property="dispatchId" column="dispatch_id" />
|
|
<result property="saleOrderId" column="sale_order_id" />
|
|
<result property="saleorderCode" column="saleorder_code" />
|
|
<result property="planId" column="plan_id" />
|
|
<result property="planCode" column="plan_code" />
|
|
<result property="planDetailId" column="plan_detail_id" />
|
|
<result property="planDetailCode" column="plan_detail_code" />
|
|
<result property="productId" column="product_id" />
|
|
<result property="productCode" column="product_code" />
|
|
<result property="productName" column="product_name" />
|
|
<result property="productSpec" column="product_spec" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="nickName" column="nick_name" />
|
|
<result property="processId" column="process_id" />
|
|
<result property="processName" column="process_name" />
|
|
<result property="planBeginTime" column="plan_begin_time" />
|
|
<result property="planEndTime" column="plan_end_time" />
|
|
<result property="realBeginTime" column="real_begin_time" />
|
|
<result property="realEndTime" column="real_end_time" />
|
|
<result property="produceTime" column="produce_time" />
|
|
<result property="createTime" column="create_time" />
|
|
</resultMap>
|
|
|
|
<resultMap id="MesProduceStatisticsDetailMesProduceStatisticsDetailMaterialResult" type="MesProduceStatisticsDetail" extends="MesProduceStatisticsDetailResult">
|
|
<collection property="mesProduceStatisticsDetailMaterialList" notNullColumn="sub_statistics_detail_material_id" javaType="java.util.List" resultMap="MesProduceStatisticsDetailMaterialResult" />
|
|
</resultMap>
|
|
|
|
<resultMap type="MesProduceStatisticsDetailMaterial" id="MesProduceStatisticsDetailMaterialResult">
|
|
<result property="statisticsDetailMaterialId" column="sub_statistics_detail_material_id" />
|
|
<result property="statisticsDetailId" column="sub_statistics_detail_id" />
|
|
<result property="materialId" column="sub_material_id" />
|
|
<result property="materialCode" column="sub_material_code" />
|
|
<result property="materialName" column="sub_material_name" />
|
|
<result property="materialSpec" column="sub_material_spec" />
|
|
<result property="usedAmount" column="sub_used_amount" />
|
|
</resultMap>
|
|
|
|
<sql id="selectMesProduceStatisticsDetailVo">
|
|
select statistics_detail_id, product_order_id, dispatch_type,dispatch_id,sale_order_id, saleorder_code, plan_id, plan_code, plan_detail_id, plan_detail_code, product_id, product_code, product_name, product_spec, user_id, nick_name, process_id, process_name, plan_begin_time, plan_end_time, real_begin_time, real_end_time, produce_time, create_time from mes_produce_statistics_detail
|
|
</sql>
|
|
|
|
<select id="selectMesProduceStatisticsDetailList" parameterType="MesProduceStatisticsDetail" resultMap="MesProduceStatisticsDetailResult">
|
|
<include refid="selectMesProduceStatisticsDetailVo"/>
|
|
<where>
|
|
<if test="productOrderId != null "> and product_order_id = #{productOrderId}</if>
|
|
<if test="saleOrderId != null "> and sale_order_id = #{saleOrderId}</if>
|
|
<if test="saleorderCode != null and saleorderCode != ''"> and saleorder_code = #{saleorderCode}</if>
|
|
<if test="planId != null "> and plan_id = #{planId}</if>
|
|
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
|
|
<if test="planDetailId != null "> and plan_detail_id = #{planDetailId}</if>
|
|
<if test="planDetailCode != null and planDetailCode != ''"> and plan_detail_code = #{planDetailCode}</if>
|
|
<if test="productId != null "> and product_id = #{productId}</if>
|
|
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if>
|
|
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
|
<if test="productSpec != null and productSpec != ''"> and product_spec = #{productSpec}</if>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
|
|
<if test="processId != null "> and process_id = #{processId}</if>
|
|
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
|
|
<if test="planBeginTime != null "> and plan_begin_time = #{planBeginTime}</if>
|
|
<if test="planEndTime != null "> and plan_end_time = #{planEndTime}</if>
|
|
<if test="realBeginTime != null "> and real_begin_time = #{realBeginTime}</if>
|
|
<if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
|
|
<if test="produceTime != null "> and produce_time = #{produceTime}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectMesProduceStatisticsDetailByStatisticsDetailId" parameterType="Long" resultMap="MesProduceStatisticsDetailMesProduceStatisticsDetailMaterialResult">
|
|
select a.statistics_detail_id, a.product_order_id, a.sale_order_id, a.saleorder_code, a.plan_id, a.plan_code, a.plan_detail_id, a.plan_detail_code, a.product_id, a.product_code, a.product_name, a.product_spec, a.user_id, a.nick_name, a.process_id, a.process_name, a.plan_begin_time, a.plan_end_time, a.real_begin_time, a.real_end_time, a.produce_time, a.create_time,
|
|
b.statistics_detail_material_id as sub_statistics_detail_material_id, b.statistics_detail_id as sub_statistics_detail_id, b.material_id as sub_material_id, b.material_code as sub_material_code, b.material_name as sub_material_name, b.material_spec as sub_material_spec, b.used_amount as sub_used_amount
|
|
from mes_produce_statistics_detail a
|
|
left join mes_produce_statistics_detail_material b on b.statistics_detail_id = a.statistics_detail_id
|
|
where a.statistics_detail_id = #{statisticsDetailId}
|
|
</select>
|
|
|
|
<insert id="insertMesProduceStatisticsDetail" parameterType="MesProduceStatisticsDetail" useGeneratedKeys="true" keyProperty="statisticsDetailId">
|
|
insert into mes_produce_statistics_detail
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="productOrderId != null">product_order_id,</if>
|
|
<if test="productOrderStatus != null">product_order_status,</if>
|
|
<if test="dispatchType != null">dispatch_type,</if>
|
|
<if test="dispatchId != null">dispatch_id,</if>
|
|
<if test="saleOrderId != null">sale_order_id,</if>
|
|
<if test="saleorderCode != null">saleorder_code,</if>
|
|
<if test="planId != null">plan_id,</if>
|
|
<if test="planCode != null and planCode != ''">plan_code,</if>
|
|
<if test="planDetailId != null">plan_detail_id,</if>
|
|
<if test="planDetailCode != null and planDetailCode != ''">plan_detail_code,</if>
|
|
<if test="productId != null">product_id,</if>
|
|
<if test="productCode != null">product_code,</if>
|
|
<if test="productName != null">product_name,</if>
|
|
<if test="productSpec != null">product_spec,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="nickName != null">nick_name,</if>
|
|
<if test="processId != null">process_id,</if>
|
|
<if test="processName != null">process_name,</if>
|
|
<if test="planBeginTime != null">plan_begin_time,</if>
|
|
<if test="planEndTime != null">plan_end_time,</if>
|
|
<if test="realBeginTime != null">real_begin_time,</if>
|
|
<if test="realEndTime != null">real_end_time,</if>
|
|
<if test="produceTime != null">produce_time,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="productOrderId != null">#{productOrderId},</if>
|
|
<if test="productOrderStatus != null">#{productOrderStatus},</if>
|
|
<if test="dispatchType != null">#{dispatchType},</if>
|
|
<if test="dispatchId != null">#{dispatchId},</if>
|
|
<if test="saleOrderId != null">#{saleOrderId},</if>
|
|
<if test="saleorderCode != null">#{saleorderCode},</if>
|
|
<if test="planId != null">#{planId},</if>
|
|
<if test="planCode != null and planCode != ''">#{planCode},</if>
|
|
<if test="planDetailId != null">#{planDetailId},</if>
|
|
<if test="planDetailCode != null and planDetailCode != ''">#{planDetailCode},</if>
|
|
<if test="productId != null">#{productId},</if>
|
|
<if test="productCode != null">#{productCode},</if>
|
|
<if test="productName != null">#{productName},</if>
|
|
<if test="productSpec != null">#{productSpec},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="nickName != null">#{nickName},</if>
|
|
<if test="processId != null">#{processId},</if>
|
|
<if test="processName != null">#{processName},</if>
|
|
<if test="planBeginTime != null">#{planBeginTime},</if>
|
|
<if test="planEndTime != null">#{planEndTime},</if>
|
|
<if test="realBeginTime != null">#{realBeginTime},</if>
|
|
<if test="realEndTime != null">#{realEndTime},</if>
|
|
<if test="produceTime != null">#{produceTime},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateMesProduceStatisticsDetail" parameterType="MesProduceStatisticsDetail">
|
|
update mes_produce_statistics_detail
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="productOrderId != null">product_order_id = #{productOrderId},</if>
|
|
<if test="saleOrderId != null">sale_order_id = #{saleOrderId},</if>
|
|
<if test="saleorderCode != null">saleorder_code = #{saleorderCode},</if>
|
|
<if test="planId != null">plan_id = #{planId},</if>
|
|
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
|
|
<if test="planDetailId != null">plan_detail_id = #{planDetailId},</if>
|
|
<if test="planDetailCode != null and planDetailCode != ''">plan_detail_code = #{planDetailCode},</if>
|
|
<if test="productId != null">product_id = #{productId},</if>
|
|
<if test="productCode != null">product_code = #{productCode},</if>
|
|
<if test="productName != null">product_name = #{productName},</if>
|
|
<if test="productSpec != null">product_spec = #{productSpec},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="nickName != null">nick_name = #{nickName},</if>
|
|
<if test="processId != null">process_id = #{processId},</if>
|
|
<if test="processName != null">process_name = #{processName},</if>
|
|
<if test="planBeginTime != null">plan_begin_time = #{planBeginTime},</if>
|
|
<if test="planEndTime != null">plan_end_time = #{planEndTime},</if>
|
|
<if test="realBeginTime != null">real_begin_time = #{realBeginTime},</if>
|
|
<if test="realEndTime != null">real_end_time = #{realEndTime},</if>
|
|
<if test="produceTime != null">produce_time = #{produceTime},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
</trim>
|
|
where statistics_detail_id = #{statisticsDetailId}
|
|
</update>
|
|
|
|
<delete id="deleteMesProduceStatisticsDetailByStatisticsDetailId" parameterType="Long">
|
|
delete from mes_produce_statistics_detail where statistics_detail_id = #{statisticsDetailId}
|
|
</delete>
|
|
|
|
<delete id="deleteMesProduceStatisticsDetailByStatisticsDetailIds" parameterType="String">
|
|
delete from mes_produce_statistics_detail where statistics_detail_id in
|
|
<foreach item="statisticsDetailId" collection="array" open="(" separator="," close=")">
|
|
#{statisticsDetailId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteMesProduceStatisticsDetailMaterialByStatisticsDetailIds" parameterType="String">
|
|
delete from mes_produce_statistics_detail_material where statistics_detail_id in
|
|
<foreach item="statisticsDetailId" collection="array" open="(" separator="," close=")">
|
|
#{statisticsDetailId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteMesProduceStatisticsDetailMaterialByStatisticsDetailId" parameterType="Long">
|
|
delete from mes_produce_statistics_detail_material where statistics_detail_id = #{statisticsDetailId}
|
|
</delete>
|
|
|
|
<insert id="batchMesProduceStatisticsDetailMaterial">
|
|
insert into mes_produce_statistics_detail_material( statistics_detail_material_id, statistics_detail_id, material_id, material_code, material_name, material_spec, used_amount) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
( #{item.statisticsDetailMaterialId}, #{item.statisticsDetailId}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.materialSpec}, #{item.usedAmount})
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<sql id="selectMesProduceStatisticsDetailJoinVo">
|
|
select mpsd.statistics_detail_id, mpsd.product_order_id, mpsd.dispatch_type,mpsd.dispatch_id,mpsd.sale_order_id, mpsd.saleorder_code, mpsd.plan_id,
|
|
mpsd.plan_code, mpsd.plan_detail_id, mpsd.plan_detail_code, mpsd.product_id,
|
|
mpsd.user_id, mpsd.nick_name, mpsd.process_id, mpsd.plan_begin_time, mpsd.plan_end_time, mpsd.real_begin_time,
|
|
mpsd.real_end_time, mpsd.produce_time, mpsd.create_time,
|
|
mbmi.material_code as product_code,mbmi.material_name as product_name,mbmi.material_spec as product_spec,mbpi.process_name
|
|
from mes_produce_statistics_detail mpsd
|
|
left join mes_base_material_info mbmi on mpsd.product_id = mbmi.material_id
|
|
left join mes_base_process_info mbpi on mpsd.process_id=mbpi.process_id
|
|
|
|
</sql>
|
|
|
|
<select id="selectMesProduceStatisticsDetailJoinList" parameterType="MesProduceStatisticsDetail" resultMap="MesProduceStatisticsDetailResult">
|
|
<include refid="selectMesProduceStatisticsDetailJoinVo"/>
|
|
<where>
|
|
<if test="productOrderId != null "> and mpsd.product_order_id = #{productOrderId}</if>
|
|
<if test="saleOrderId != null "> and mpsd.sale_order_id = #{saleOrderId}</if>
|
|
<if test="saleorderCode != null and saleorderCode != ''"> and mpsd.saleorder_code like concat('%', #{saleorderCode},'%')</if>
|
|
<if test="planId != null "> and mpsd.plan_id = #{planId}</if>
|
|
<if test="planCode != null and planCode != ''"> and mpsd.plan_code like concat('%', #{planCode},'%')</if>
|
|
<if test="planDetailCode != null and planDetailCode != ''"> and mpsd.plan_detail_code like concat('%', #{planDetailCode},'%')</if>
|
|
<if test="productId != null "> and mpsd.product_id = #{productId}</if>
|
|
<if test="productCode != null and productCode != ''"> and mbmi.material_code like concat('%', #{productCode},'%')</if>
|
|
<if test="productName != null and productName != ''"> and mbmi.material_name like concat('%', #{productName}, '%')</if>
|
|
<if test="productSpec != null and productSpec != ''"> and mbmi.material_spec like concat('%', #{productSpec},'%')</if>
|
|
<if test="userId != null "> and mpsd.user_id = #{userId}</if>
|
|
<if test="nickName != null and nickName != ''"> and mpsd.nick_name like concat('%', #{nickName}, '%')</if>
|
|
<if test="processId != null "> and mpsd.process_id = #{processId}</if>
|
|
<if test="processName != null and processName != ''"> and mpsd.process_name like concat('%', #{processName}, '%')</if>
|
|
<if test="planBeginTime != null "> and mpsd.plan_begin_time = #{planBeginTime}</if>
|
|
<if test="planEndTime != null "> and mpsd.plan_end_time = #{planEndTime}</if>
|
|
<if test="realBeginTime != null "> and mpsd.real_begin_time = #{realBeginTime}</if>
|
|
<if test="realEndTime != null "> and mpsd.real_end_time = #{realEndTime}</if>
|
|
<if test="produceTime != null "> and mpsd.produce_time = #{produceTime}</if>
|
|
</where>
|
|
</select>
|
|
</mapper> |