123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <?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.zkqy.business.mapper.DetailsOfTheRefuelingPlanMapper">
-
- <resultMap type="com.zkqy.business.domain.DetailsOfTheRefuelingPlan" id="DetailsOfTheRefuelingPlanResult">
- <result property="id" column="id" />
- <result property="timestampRandomCode" column="timestamp_random_code" />
- <result property="macId" column="mac_id" />
- <result property="machineId" column="machine_id" />
- <result property="currentColorCode" column="current_color_code" />
- <result property="currentSpecification" column="current_specification" />
- <result property="currentLotNumber" column="current_lot_number" />
- <result property="currentSpindleCount" column="current_spindle_count" />
- <result property="startTime" column="start_time" />
- <result property="plannedEndTime" column="planned_end_time" />
- <result property="planStatus" column="plan_status" />
- <result property="number" column="number" />
- <result property="productType" column="productType" />
- <result property="productTypeName" column="productTypeName"/>
- </resultMap>
- <sql id="selectDetailsOfTheRefuelingPlanVo">
- select id, timestamp_random_code, mac_id,machine_id, current_color_code, current_specification, current_lot_number, current_spindle_count, start_time, planned_end_time,plan_status,number,productType,product_id,salesman_id,productTypeName from {DBNAME}.details_of_the_refueling_plan
- </sql>
- <select id="selectDetailsOfTheRefuelingPlanList" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlan" resultMap="DetailsOfTheRefuelingPlanResult">
- <include refid="selectDetailsOfTheRefuelingPlanVo"/>
- <where>
- <if test="timestampRandomCode != null and timestampRandomCode != ''"> and timestamp_random_code = #{timestampRandomCode}</if>
- <if test="macId != null "> and mac_id = #{macId}</if>
- <if test="machineId != null "> and machine_id = #{machineId}</if>
- <if test="currentColorCode != null and currentColorCode != ''"> and current_color_code = #{currentColorCode}</if>
- <if test="currentSpecification != null and currentSpecification != ''"> and current_specification = #{currentSpecification}</if>
- <if test="currentLotNumber != null "> and current_lot_number = #{currentLotNumber}</if>
- <if test="currentSpindleCount != null and currentSpindleCount != ''"> and current_spindle_count = #{currentSpindleCount}</if>
- <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
- <if test="plannedEndTime != null and plannedEndTime != ''"> and planned_end_time = #{plannedEndTime}</if>
- <if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if>
- <if test="number != null and number != ''"> and `number` = #{number}</if>
- <if test="productType != null and productType != ''"> and `productType` = #{productType}</if>
- <if test="productId != null and productId != ''"> and `product_id` = #{productId}</if>
- <if test="salesmanId != null and salesmanId != ''"> and `salesman_id` = #{salesmanId}</if>
- </where>
- ORDER BY productType
- </select>
- <select id="selectDetailsOfTheRefuelingPlanListDetiles" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlan" resultMap="DetailsOfTheRefuelingPlanResult">
- <include refid="selectDetailsOfTheRefuelingPlanVo"/>
- <where>
- <if test="timestampRandomCode != null and timestampRandomCode != ''"> and timestamp_random_code = #{timestampRandomCode}</if>
- <if test="macId != null "> and mac_id = #{macId}</if>
- <if test="machineId != null "> and machine_id = #{machineId}</if>
- <if test="currentColorCode != null and currentColorCode != ''"> and current_color_code = #{currentColorCode}</if>
- <if test="currentSpecification != null and currentSpecification != ''"> and current_specification = #{currentSpecification}</if>
- <if test="currentLotNumber != null "> and current_lot_number = #{currentLotNumber}</if>
- <if test="currentSpindleCount != null and currentSpindleCount != ''"> and current_spindle_count = #{currentSpindleCount}</if>
- <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
- <if test="plannedEndTime != null and plannedEndTime != ''"> and planned_end_time = #{plannedEndTime}</if>
- <if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if>
- <if test="number != null and number != ''"> and `number` = #{number}</if>
- <if test="productType != null and productType != ''"> and `productType` = #{productType}</if>
- and plan_status!=3
- </where>
- ORDER BY CASE WHEN plan_status = 1 THEN 0 ELSE 1 END, plan_status;
- </select>
-
- <select id="selectDetailsOfTheRefuelingPlanById" parameterType="Long" resultMap="DetailsOfTheRefuelingPlanResult">
- <include refid="selectDetailsOfTheRefuelingPlanVo"/>
- where id = #{id}
- </select>
- <select id="selectDetailsOfTheRefuelingPlanListCount" resultType="java.lang.Integer">
- select count(`id`) from {DBNAME}.details_of_the_refueling_plan
- </select>
- <insert id="insertDetailsOfTheRefuelingPlan" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlan">
- insert into {DBNAME}.details_of_the_refueling_plan
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="timestampRandomCode != null">timestamp_random_code,</if>
- <if test="machineId != null">machine_id,</if>
- <if test="currentColorCode != null and currentColorCode != ''">current_color_code,</if>
- <if test="currentSpecification != null">current_specification,</if>
- <if test="currentLotNumber != null">current_lot_number,</if>
- <if test="currentSpindleCount != null">current_spindle_count,</if>
- <if test="startTime != null">start_time,</if>
- <if test="plannedEndTime != null">planned_end_time,</if>
- <if test="planStatus != null">plan_status,</if>
- <if test="number != null">`number`,</if>
- <if test="productType != null and productType != ''">`productType`</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="timestampRandomCode != null">#{timestampRandomCode},</if>
- <if test="machineId != null">#{machineId},</if>
- <if test="currentColorCode != null and currentColorCode != ''">#{currentColorCode},</if>
- <if test="currentSpecification != null">#{currentSpecification},</if>
- <if test="currentLotNumber != null">#{currentLotNumber},</if>
- <if test="currentSpindleCount != null">#{currentSpindleCount},</if>
- <if test="startTime != null">#{startTime},</if>
- <if test="plannedEndTime != null">#{plannedEndTime},</if>
- <if test="planStatus != null">#{planStatus},</if>
- <if test="number != null">#{number},</if>
- <if test="productType != null and productType != ''"> #{productType}</if>
- </trim>
- </insert>
- <insert id="insertBatchDetailsOfTheRefuelingPlan" parameterType="java.util.List">
- INSERT INTO {DBNAME}.details_of_the_refueling_plan
- <trim prefix="(" suffix=")" suffixOverrides=",">
- timestamp_random_code,
- mac_id,
- machine_id,
- current_color_code,
- current_specification,
- current_lot_number,
- current_spindle_count,
- start_time,
- planned_end_time,
- plan_status,
- `number`,
- `productType`,
- `product_id`,
- `salesman_id`,
- `productTypeName`
- </trim>
- VALUES
- <foreach collection="list" item="item" separator=",">
- <trim prefix="(" suffix=")" suffixOverrides=",">
- #{item.timestampRandomCode},
- #{item.macId},
- #{item.machineId},
- #{item.currentColorCode},
- #{item.currentSpecification},
- #{item.currentLotNumber},
- #{item.currentSpindleCount},
- #{item.startTime},
- #{item.plannedEndTime},
- #{item.planStatus},
- #{item.number},
- #{item.productType},
- #{item.productId},
- #{item.salesmanId},
- #{item.productTypeName}
- </trim>
- </foreach>
- </insert>
- <update id="updateDetailsOfTheRefuelingPlan" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlan">
- update {DBNAME}.details_of_the_refueling_plan
- <trim prefix="SET" suffixOverrides=",">
- <if test="timestampRandomCode != null">timestamp_random_code = #{timestampRandomCode},</if>
- <if test="machineId != null">machine_id = #{machineId},</if>
- <if test="currentColorCode != null and currentColorCode != ''">current_color_code = #{currentColorCode},</if>
- <if test="currentSpecification != null">current_specification = #{currentSpecification},</if>
- <if test="currentLotNumber != null">current_lot_number = #{currentLotNumber},</if>
- <if test="currentSpindleCount != null">current_spindle_count = #{currentSpindleCount},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="plannedEndTime != null">planned_end_time = #{plannedEndTime},</if>
- <if test="planStatus != null">plan_status = #{planStatus},</if>
- <if test="number != null">`number` = #{number},</if>
- <if test="productType != null and productType != ''">`productType`= #{productType},</if>
- <if test="productId != null and productId != ''">`product_id`= #{productId},</if>
- <if test="salesmanId != null and salesmanId != ''">`salesman_id`= #{salesmanId},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateDetailsOfTheRefuelingPlanByMachineIdAndProductType" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlan">
- update {DBNAME}.details_of_the_refueling_plan
- <trim prefix="SET" suffixOverrides=",">
- <if test="timestampRandomCode != null">timestamp_random_code = #{timestampRandomCode},</if>
- <if test="machineId != null">machine_id = #{machineId},</if>
- <if test="currentColorCode != null and currentColorCode != ''">current_color_code = #{currentColorCode},</if>
- <if test="currentSpecification != null">current_specification = #{currentSpecification},</if>
- <if test="currentLotNumber != null">current_lot_number = #{currentLotNumber},</if>
- <if test="currentSpindleCount != null">current_spindle_count = #{currentSpindleCount},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="plannedEndTime != null">planned_end_time = #{plannedEndTime},</if>
- <if test="planStatus != null">plan_status = #{planStatus},</if>
- <if test="number != null">`number` = #{number},</if>
- <if test="productType != null and productType != ''">`productType`= #{productType},</if>
- <if test="productId != null and productId != ''">`product_id`= #{productId},</if>
- <if test="salesmanId != null and salesmanId != ''">`salesman_id`= #{salesmanId},</if>
- </trim>
- where machine_id = #{machineId} and productType=#{productType}
- <if test="planStatusOld != null and planStatusOld != ''">
- and plan_status=#{planStatusOld}
- </if>
- </update>
- <delete id="deleteDetailsOfTheRefuelingPlanById" parameterType="Long">
- delete from {DBNAME}.details_of_the_refueling_plan where id = #{id}
- </delete>
- <delete id="deleteDetailsOfTheRefuelingPlanByIds" parameterType="String">
- delete from {DBNAME}.details_of_the_refueling_plan where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <delete id="deleteDetailsOfTheRefuelingPlanByMachineId">
- delete from {DBNAME}.details_of_the_refueling_plan where machine_id = #{machineId} and timestamp_random_code='停机';
- </delete>
- </mapper>
|