135 lines
4.6 KiB
XML
135 lines
4.6 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.gear.mes.production.mapper.GearProductionTaskMapper">
|
|
|
|
<select id="selectTaskList" parameterType="com.gear.mes.production.domain.GearProductionTask" resultType="com.gear.mes.production.domain.vo.GearProductionTaskListVo">
|
|
SELECT
|
|
t.task_id AS taskId,
|
|
t.task_code AS taskCode,
|
|
t.task_name AS taskName,
|
|
t.status AS status,
|
|
t.plan_start_time AS planStartTime,
|
|
t.plan_end_time AS planEndTime,
|
|
t.remark AS remark,
|
|
t.create_by AS createBy,
|
|
t.create_time AS createTime,
|
|
t.update_by AS updateBy,
|
|
t.update_time AS updateTime,
|
|
IFNULL(SUM(p.plan_qty), 0) AS planQty,
|
|
IFNULL(SUM(p.finished_qty), 0) AS finishedQty,
|
|
IFNULL(SUM(p.bad_qty), 0) AS badQty,
|
|
GREATEST(IFNULL(SUM(p.plan_qty), 0) - IFNULL(SUM(p.finished_qty), 0), 0) AS unfinishedQty
|
|
FROM gear_production_task t
|
|
LEFT JOIN gear_production_task_product p ON t.task_id = p.task_id
|
|
<where>
|
|
t.del_flag = '0'
|
|
<if test="status != null and status != ''"> AND t.status = #{status}</if>
|
|
<if test="taskCode != null and taskCode != ''"> AND t.task_code LIKE CONCAT('%', #{taskCode}, '%')</if>
|
|
<if test="taskName != null and taskName != ''"> AND t.task_name LIKE CONCAT('%', #{taskName}, '%')</if>
|
|
<if test="beginTime != null"> AND t.plan_start_time <![CDATA[>=]]> #{beginTime}</if>
|
|
<if test="endTime != null"> AND t.plan_start_time <![CDATA[<=]]> #{endTime}</if>
|
|
</where>
|
|
GROUP BY
|
|
t.task_id,
|
|
t.task_code,
|
|
t.task_name,
|
|
t.status,
|
|
t.plan_start_time,
|
|
t.plan_end_time,
|
|
t.remark,
|
|
t.create_by,
|
|
t.create_time,
|
|
t.update_by,
|
|
t.update_time
|
|
ORDER BY t.update_time DESC, t.create_time DESC
|
|
</select>
|
|
|
|
<select id="selectTaskById" resultType="com.gear.mes.production.domain.GearProductionTask">
|
|
SELECT
|
|
task_id AS taskId,
|
|
task_code AS taskCode,
|
|
task_name AS taskName,
|
|
status AS status,
|
|
plan_start_time AS planStartTime,
|
|
plan_end_time AS planEndTime,
|
|
remark AS remark,
|
|
create_by AS createBy,
|
|
create_time AS createTime,
|
|
update_by AS updateBy,
|
|
update_time AS updateTime
|
|
FROM gear_production_task
|
|
WHERE task_id = #{taskId}
|
|
AND del_flag = '0'
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<insert id="insertTask" parameterType="com.gear.mes.production.domain.GearProductionTask">
|
|
INSERT INTO gear_production_task (
|
|
task_id,
|
|
task_code,
|
|
task_name,
|
|
status,
|
|
plan_start_time,
|
|
plan_end_time,
|
|
remark,
|
|
del_flag,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time
|
|
) VALUES (
|
|
#{taskId},
|
|
#{taskCode},
|
|
#{taskName},
|
|
#{status},
|
|
#{planStartTime},
|
|
#{planEndTime},
|
|
#{remark},
|
|
#{delFlag},
|
|
#{createBy},
|
|
#{createTime},
|
|
#{updateBy},
|
|
#{updateTime}
|
|
)
|
|
</insert>
|
|
|
|
<update id="updateTask" parameterType="com.gear.mes.production.domain.GearProductionTask">
|
|
UPDATE gear_production_task
|
|
SET
|
|
task_code = #{taskCode},
|
|
task_name = #{taskName},
|
|
status = #{status},
|
|
plan_start_time = #{planStartTime},
|
|
plan_end_time = #{planEndTime},
|
|
remark = #{remark},
|
|
update_by = #{updateBy},
|
|
update_time = #{updateTime}
|
|
WHERE task_id = #{taskId}
|
|
AND del_flag = '0'
|
|
</update>
|
|
|
|
<update id="updateTaskStatus">
|
|
UPDATE gear_production_task
|
|
SET
|
|
status = #{status},
|
|
update_by = #{updateBy},
|
|
update_time = #{updateTime}
|
|
WHERE task_id = #{taskId}
|
|
AND del_flag = '0'
|
|
AND status <![CDATA[<>]]> #{status}
|
|
</update>
|
|
|
|
<update id="updateDelFlag">
|
|
UPDATE gear_production_task
|
|
SET
|
|
del_flag = #{delFlag},
|
|
update_by = #{updateBy},
|
|
update_time = #{updateTime}
|
|
WHERE task_id = #{taskId}
|
|
AND del_flag = '0'
|
|
</update>
|
|
|
|
</mapper>
|