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.

196 lines
10 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.op.device.mapper.EquOrderMapper">
<resultMap type="EquOrder" id="EquOrderResult">
<result property="orderId" column="order_id" />
<result property="planId" column="plan_id" />
<result property="planCode" column="plan_code" />
<result property="planType" column="plan_type" />
<result property="orderCode" column="order_code" />
<result property="planWorkshop" column="plan_workshop" />
<result property="planProdLine" column="plan_prod_line" />
<result property="planLoop" column="plan_loop" />
<result property="planLoopType" column="plan_loop_type" />
<result property="planLoopStart" column="plan_loop_start" />
<result property="planLoopEnd" column="plan_loop_end" />
<result property="orderStart" column="order_start" />
<result property="orderEnd" column="order_end" />
<result property="equipmentCode" column="equipment_code" />
<result property="orderStatus" column="order_status" />
<result property="orderCost" column="order_cost" />
<result property="planPerson" column="plan_person" />
<result property="orderCostTime" column="order_cost_time" />
<result property="orderSignPerson" column="order_sign_person" />
<result property="factoryCode" column="factory_code" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="delFlag" column="del_flag" />
<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="selectEquOrderVo">
select order_id, plan_id, plan_code, plan_type, order_code, plan_workshop, plan_prod_line, plan_loop, plan_loop_type, plan_loop_start, plan_loop_end, order_start, order_end, equipment_code, order_status, order_cost, plan_person, order_cost_time, order_sign_person, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_order
</sql>
<select id="selectEquOrderList" parameterType="EquOrder" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
<where>
<if test="planId != null and planId != ''"> and plan_id = #{planId}</if>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="planType != null and planType != ''"> and plan_type = #{planType}</if>
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
<if test="planWorkshop != null and planWorkshop != ''"> and plan_workshop = #{planWorkshop}</if>
<if test="planProdLine != null and planProdLine != ''"> and plan_prod_line = #{planProdLine}</if>
<if test="planLoop != null and planLoop != ''"> and plan_loop = #{planLoop}</if>
<if test="planLoopType != null and planLoopType != ''"> and plan_loop_type = #{planLoopType}</if>
<if test="planLoopStart != null "> and plan_loop_start = #{planLoopStart}</if>
<if test="planLoopEnd != null "> and plan_loop_end = #{planLoopEnd}</if>
<if test="orderStart != null "> and order_start = #{orderStart}</if>
<if test="orderEnd != null "> and order_end = #{orderEnd}</if>
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code = #{equipmentCode}</if>
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
<if test="orderCost != null "> and order_cost = #{orderCost}</if>
<if test="planPerson != null and planPerson != ''"> and plan_person = #{planPerson}</if>
<if test="orderCostTime != null and orderCostTime != ''"> and order_cost_time = #{orderCostTime}</if>
<if test="orderSignPerson != null and orderSignPerson != ''"> and order_sign_person = #{orderSignPerson}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
</where>
</select>
<select id="selectEquOrderByOrderCode" parameterType="String" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where order_code = #{orderCode}
</select>
<select id="selectPlanNameByPlanCode" resultType="java.lang.String">
select plan_name AS 'planName' from equ_plan where del_flag = '0' and plan_code = #{orderCode}
</select>
<select id="selectCenterNameByCenterCode" resultType="java.lang.String">
select workshop_name from base_equipment where del_flag = '0' and workshop_code = #{planWorkshop}
</select>
<insert id="insertEquOrder" parameterType="EquOrder">
insert into equ_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,</if>
<if test="planId != null">plan_id,</if>
<if test="planCode != null">plan_code,</if>
<if test="planType != null">plan_type,</if>
<if test="orderCode != null">order_code,</if>
<if test="planWorkshop != null">plan_workshop,</if>
<if test="planProdLine != null">plan_prod_line,</if>
<if test="planLoop != null">plan_loop,</if>
<if test="planLoopType != null">plan_loop_type,</if>
<if test="planLoopStart != null">plan_loop_start,</if>
<if test="planLoopEnd != null">plan_loop_end,</if>
<if test="orderStart != null">order_start,</if>
<if test="orderEnd != null">order_end,</if>
<if test="equipmentCode != null">equipment_code,</if>
<if test="orderStatus != null">order_status,</if>
<if test="orderCost != null">order_cost,</if>
<if test="planPerson != null">plan_person,</if>
<if test="orderCostTime != null">order_cost_time,</if>
<if test="orderSignPerson != null">order_sign_person,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="delFlag != null">del_flag,</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="orderId != null">#{orderId},</if>
<if test="planId != null">#{planId},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planType != null">#{planType},</if>
<if test="orderCode != null">#{orderCode},</if>
<if test="planWorkshop != null">#{planWorkshop},</if>
<if test="planProdLine != null">#{planProdLine},</if>
<if test="planLoop != null">#{planLoop},</if>
<if test="planLoopType != null">#{planLoopType},</if>
<if test="planLoopStart != null">#{planLoopStart},</if>
<if test="planLoopEnd != null">#{planLoopEnd},</if>
<if test="orderStart != null">#{orderStart},</if>
<if test="orderEnd != null">#{orderEnd},</if>
<if test="equipmentCode != null">#{equipmentCode},</if>
<if test="orderStatus != null">#{orderStatus},</if>
<if test="orderCost != null">#{orderCost},</if>
<if test="planPerson != null">#{planPerson},</if>
<if test="orderCostTime != null">#{orderCostTime},</if>
<if test="orderSignPerson != null">#{orderSignPerson},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="delFlag != null">#{delFlag},</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>
<update id="updateEquOrder" parameterType="EquOrder">
update equ_order
<trim prefix="SET" suffixOverrides=",">
<if test="planId != null">plan_id = #{planId},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planType != null">plan_type = #{planType},</if>
<if test="orderCode != null">order_code = #{orderCode},</if>
<if test="planWorkshop != null">plan_workshop = #{planWorkshop},</if>
<if test="planProdLine != null">plan_prod_line = #{planProdLine},</if>
<if test="planLoop != null">plan_loop = #{planLoop},</if>
<if test="planLoopType != null">plan_loop_type = #{planLoopType},</if>
<if test="planLoopStart != null">plan_loop_start = #{planLoopStart},</if>
<if test="planLoopEnd != null">plan_loop_end = #{planLoopEnd},</if>
<if test="orderStart != null">order_start = #{orderStart},</if>
<if test="orderEnd != null">order_end = #{orderEnd},</if>
<if test="equipmentCode != null">equipment_code = #{equipmentCode},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if>
<if test="orderCost != null">order_cost = #{orderCost},</if>
<if test="planPerson != null">plan_person = #{planPerson},</if>
<if test="orderCostTime != null">order_cost_time = #{orderCostTime},</if>
<if test="orderSignPerson != null">order_sign_person = #{orderSignPerson},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where order_id = #{orderId}
</update>
<delete id="deleteEquOrderByOrderId" parameterType="String">
delete from equ_order where order_id = #{orderId}
</delete>
<delete id="deleteEquOrderByOrderIds" parameterType="String">
delete from equ_order where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
</mapper>