<?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.zy.acs.manager.manager.mapper.TaskMapper">
|
|
<!-- 分页查询 -->
|
<select id="selectPageRel" resultType="com.zy.acs.manager.manager.entity.Task">
|
SELECT a.*
|
FROM man_task a
|
<where>
|
AND a.deleted = 0
|
<if test="param.id != null">
|
AND a.id = #{param.id}
|
</if>
|
<if test="param.busId != null">
|
AND a.bus_id = #{param.busId}
|
</if>
|
<if test="param.seqNum != null">
|
AND a.seq_num like concat('%',#{param.seqNum},'%')
|
</if>
|
<if test="param.taskType != null">
|
AND a.task_type = #{param.taskType}
|
</if>
|
<if test="param.taskSts != null">
|
AND a.task_sts = #{param.taskSts}
|
</if>
|
<if test="param.agvId != null">
|
AND a.agv_id = #{param.agvId}
|
</if>
|
<if test="param.oriSta != null">
|
AND a.ori_sta = #{param.oriSta}
|
</if>
|
<if test="param.oriLoc != null">
|
AND a.ori_loc = #{param.oriLoc}
|
</if>
|
<if test="param.destSta != null">
|
AND a.dest_sta = #{param.destSta}
|
</if>
|
<if test="param.destLoc != null">
|
AND a.dest_loc = #{param.destLoc}
|
</if>
|
<if test="param.destCode != null">
|
AND a.dest_code = #{param.destCode}
|
</if>
|
<if test="param.status != null">
|
AND a.status = #{param.status}
|
</if>
|
<if test="param.timeStart != null">
|
and a.create_time >= #{param.timeStart}
|
</if>
|
<if test="param.timeEnd != null">
|
and a.create_time < #{param.timeEnd}
|
</if>
|
<if test="param.keywords != null">
|
AND (
|
a.memo LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.seq_num LIKE CONCAT('%', #{param.keywords}, '%')
|
)
|
</if>
|
</where>
|
<choose>
|
<when test="param.orderBy != null and param.orderBy != '' ">
|
order by a.${param.orderBy}
|
</when>
|
<otherwise>
|
ORDER BY FIELD(a.task_sts, 18, 17, 16, 15, 20, 19), a.io_time DESC
|
</otherwise>
|
</choose>
|
</select>
|
|
<select id="selectStatByLastSevenDays" resultType="java.util.Map">
|
SELECT
|
DAYNAME(dates.date) AS weekday,
|
mtt.name AS type,
|
IFNULL(COUNT(mt.id), 0) AS count
|
FROM (
|
SELECT DATE_SUB(CURRENT_DATE(), INTERVAL unit.i DAY) AS DATE
|
FROM (
|
SELECT 0 AS i UNION ALL SELECT 1 UNION ALL SELECT 2
|
UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
|
UNION ALL SELECT 6
|
) unit
|
) dates
|
CROSS JOIN man_task_type mtt
|
LEFT JOIN man_task mt
|
ON mt.task_type = mtt.id AND DATE(mt.create_time) = dates.date
|
AND mt.create_time > DATE_SUB(NOW(), INTERVAL 1 WEEK)
|
WHERE mtt.deleted = 0
|
GROUP BY dates.date, mtt.name
|
ORDER BY dates.date ASC, mtt.name;
|
</select>
|
|
</mapper>
|