@ -39,12 +39,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "plannedOutsourceAmount" column= "planned_outsource_amount" />
<result property= "outsourceProcessType" column= "outsource_process_type" />
<result property= "outsourceProcessAmount" column= "outsource_process_amount" />
<result property= "level" column= "level" />
<result property= "parentId" column= "parent_id" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
</resultMap>
<sql id= "selectOutsourcePlanVo" >
select outsource_plan_id, outsource_plan_code, associate_order_no, applicant, status, material_amount, total_amount, outsource_process_type, outsource_process_amount, source, create_by, create_time, update_by, update_time from outsource_plan
</sql>
<sql id= "selectOutsourcePlanDetail" >
select outsource_plan_detail_id, outsource_plan_code,
material_no, material_name, material_type, material_photoUrl,
description, brand, process_method, unit, planned_outsource_amount,
outsource_process_type, outsource_process_amount, `level`, parent_id,
create_by,create_time,update_by,update_time
from outsource_plan_detail
</sql>
<select id= "selectOutsourcePlanList" parameterType= "OutsourcePlan" resultMap= "OutsourcePlanResult" >
<include refid= "selectOutsourcePlanVo" />
<where >
@ -57,6 +72,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''" > and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
</select>
<select id= "selectOutsourcePlanDetail" parameterType= "OutsourcePlanDetail" resultMap= "OutsourcePlanDetailResult" >
<include refid= "selectOutsourcePlanDetail" />
<where >
<if test= "outsourcePlanCode != null and outsourcePlanCode != ''" > and outsource_plan_code = #{outsourcePlanCode}</if>
<if test= "outsourcePlanDetailId != null and outsourcePlanDetailId != ''" > and outsource_plan_detail_id = #{outsourcePlanDetailId}</if>
<if test= "parentId != null and parentId != ''" > and parent_id = #{parentId}</if>
</where>
</select>
<select id= "selectOutsourcePlanByOutsourcePlanId" parameterType= "Long" resultMap= "OutsourcePlanOutsourcePlanDetailResult" >
select outsource_plan_id, outsource_plan_code, associate_order_no, applicant, status, material_amount, total_amount, outsource_process_type, outsource_process_amount, source, create_by, create_time, update_by, update_time
@ -65,8 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id= "selectOutsourcePlanDetailList" resultType= "OutsourcePlanDetail" resultMap= "OutsourcePlanDetailResult" >
select outsource_plan_detail_id, outsource_plan_code, material_no, material_name, material_type, material_photoUrl, description, brand, process_method, unit, planned_outsource_amount, outsource_process_type, outsource_process_amount
from outsource_plan_detail
<include refid= "selectOutsourcePlanDetail" />
where outsource_plan_code = #{outsource_plan_code}
</select>
@ -136,8 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<!-- 按委外计划单编号批量查询详情 -->
<select id= "selectOutsourcePlanDetailByCodes" parameterType= "String" resultMap= "OutsourcePlanDetailResult" >
select outsource_plan_detail_id, outsource_plan_code, material_no, material_name, material_type, material_photoUrl, description, brand, process_method, unit, planned_outsource_amount, outsource_process_type, outsource_process_amount
from outsource_plan_detail
<include refid= "selectOutsourcePlanDetail" />
where outsource_plan_code in
<foreach item= "outsourcePlanCode" collection= "array" open= "(" separator= "," close= ")" >
#{outsourcePlanCode}
@ -165,10 +187,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<insert id= "batchOutsourcePlanDetail" >
insert into outsource_plan_detail( outsource_plan_detail_id, outsource_plan_code, material_no, material_name, material_type, material_photoUrl, description, brand, process_method, unit, planned_outsource_amount, outsource_process_type, outsource_process_amount) values
insert into outsource_plan_detail( outsource_plan_detail_id, outsource_plan_code,
material_no, material_name, material_type, material_photoUrl,
description, brand, process_method, unit, planned_outsource_amount,
outsource_process_type, outsource_process_amount,`level`,parent_id) values
<foreach item= "item" index= "index" collection= "list" separator= "," >
( #{item.outsourcePlanDetailId}, #{item.outsourcePlanCode}, #{item.materialNo}, #{item.materialName}, #{item.materialType}, #{item.materialPhotourl}, #{item.description}, #{item.brand}, #{item.processMethod}, #{item.unit}, #{item.plannedOutsourceAmount}, #{item.outsourceProcessType}, #{item.outsourceProcessAmount})
( #{item.outsourcePlanDetailId}, #{item.outsourcePlanCode},
#{item.materialNo}, #{item.materialName}, #{item.materialType},
#{item.materialPhotourl}, #{item.description}, #{item.brand},
#{item.processMethod}, #{item.unit}, #{item.plannedOutsourceAmount},
#{item.outsourceProcessType}, #{item.outsourceProcessAmount},
#{item.level}, #{item.parentId})
</foreach>
</insert>
<insert id= "insertOutsourcePlanDetail" parameterType= "OutsourcePlanDetail" useGeneratedKeys= "true" keyProperty= "outsourcePlanDetailId" >
insert into outsource_plan_detail
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "outsourcePlanCode != null and outsourcePlanCode != ''" > outsource_plan_code,</if>
<if test= "materialNo != null" > material_no,</if>
<if test= "materialName != null" > material_name,</if>
<if test= "materialType != null" > material_type,</if>
<if test= "materialPhotourl != null" > material_photoUrl,</if>
<if test= "description != null" > description,</if>
<if test= "brand != null" > brand,</if>
<if test= "processMethod != null" > process_method,</if>
<if test= "unit != null" > unit,</if>
<if test= "plannedOutsourceAmount != null" > planned_outsource_amount,</if>
<if test= "outsourceProcessType != null" > outsource_process_type,</if>
<if test= "outsourceProcessAmount != null" > outsource_process_amount,</if>
<if test= "level != null" > `level`,</if>
<if test= "parentId != null" > parent_id,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "outsourcePlanCode != null and outsourcePlanCode != ''" > #{outsourcePlanCode},</if>
<if test= "materialNo != null" > #{materialNo},</if>
<if test= "materialName != null" > #{materialName},</if>
<if test= "materialType != null" > #{materialType},</if>
<if test= "materialPhotourl != null" > #{materialPhotourl},</if>
<if test= "description != null" > #{description},</if>
<if test= "brand != null" > #{brand},</if>
<if test= "processMethod != null" > #{processMethod},</if>
<if test= "unit != null" > #{unit},</if>
<if test= "plannedOutsourceAmount != null" > #{plannedOutsourceAmount},</if>
<if test= "outsourceProcessType != null" > #{outsourceProcessType},</if>
<if test= "outsourceProcessAmount != null" > #{outsourceProcessAmount},</if>
<if test= "level != null" > #{level},</if>
<if test= "parentId != null" > #{parentId},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
</trim>
</insert>
</mapper>