You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
3.4 KiB
72 lines
3.4 KiB
<?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.zilber.boot.intelligencesite.mapper.IResourceScheduleMapper">
|
|
|
|
<resultMap id="IResourceScheduleResult" type="com.zilber.boot.intelligencesite.entity.IResourceSchedule">
|
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
|
<result property="planId" column="plan_id" jdbcType="INTEGER"/>
|
|
<result property="planName" column="plan_name" jdbcType="VARCHAR"/>
|
|
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
|
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
|
<result property="currentProgress" column="current_progress" jdbcType="INTEGER"/>
|
|
<result property="advises" column="advises" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectIResourceScheduleVo">
|
|
select
|
|
id, plan_id, plan_name, start_time, end_time, create_time, creator, current_progress, advises from i_resource_schedule
|
|
</sql>
|
|
|
|
<select id="queryList" parameterType="com.zilber.boot.intelligencesite.entity.IResourceSchedule" resultMap="IResourceScheduleResult">
|
|
<include refid="selectIResourceScheduleVo"/>
|
|
<where>
|
|
<if test="planId != null"> and plan_id=#{planId}</if>
|
|
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
|
|
<if test="startTime != null"> and start_time=#{startTime}</if>
|
|
<if test="endTime != null"> and end_time=#{endTime}</if>
|
|
<if test="createTime != null"> and create_time=#{createTime}</if>
|
|
<if test="creator != null and creator != ''"> and creator=#{creator}</if>
|
|
<if test="currentProgress != null"> and current_progress=#{currentProgress}</if>
|
|
<if test="advises != null and advises != ''"> and advises=#{advises}</if>
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="removeAll">
|
|
DELETE FROM i_resource_schedule
|
|
</select>
|
|
|
|
<select id="listCheckedPlan"
|
|
parameterType="java.util.Date"
|
|
resultType="com.zilber.boot.intelligencesite.schedule.dto.PlanDTO">
|
|
SELECT
|
|
id AS id,
|
|
plan_name AS planName,
|
|
start_time AS startTime,
|
|
end_time AS endTime,
|
|
duration AS duration,
|
|
IF(100/duration*DATEDIFF(NOW(),start_time) >= 100,100,FLOOR(duration*DATEDIFF(NOW(),start_time))) AS diff,
|
|
IFNULL(accumulative_progress, 0) AS accumulativeProgress
|
|
FROM
|
|
( SELECT
|
|
id, plan_name, start_time, end_time, duration
|
|
FROM i_production_plan
|
|
WHERE parent_id = 0
|
|
AND start_time <= #{date}
|
|
) a
|
|
INNER JOIN
|
|
( SELECT
|
|
plan_id, accumulative_progress, process_date
|
|
FROM i_progress_new ba
|
|
INNER JOIN (SELECT plan_id AS bbId,MAX(process_date) AS real_date FROM i_progress_new GROUP BY plan_id) bb
|
|
ON ba.plan_id = bb.bbId AND ba.process_date = bb.real_date
|
|
WHERE process_date = (SELECT MAX(process_date) FROM i_progress bb WHERE bb.plan_id = ba.plan_id)
|
|
) b ON a.id = b.plan_id
|
|
</select>
|
|
|
|
</mapper>
|
|
|
|
|