| | |
| | | <?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="cn.exrick.xboot.your.mapper.OrderTaskMapper"> |
| | | <select id="countStatus" resultType="cn.exrick.xboot.your.entity.OrderStatusCount"> |
| | | |
| | | </mapper> |
| | | SELECT |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '1'.toString()"> |
| | | DATE(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, |
| | | </if> |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '2'.toString()"> |
| | | WEEK(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, |
| | | </if> |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '3'.toString()"> |
| | | MONTH(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, |
| | | </if> |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '4'.toString()"> |
| | | YEAR(DATE_FORMAT(DATE_SUB(a.send_date,INTERVAL 1 DAY),'%Y-%m-%d')) warntime, |
| | | </if> |
| | | b.car_no AS carName, |
| | | c.NAME AS line, |
| | | d.NAME AS batch, |
| | | a.send_date, |
| | | e.nickname as username, |
| | | a.id, |
| | | count( a.area_section_id ) AS amount, |
| | | sum( CASE WHEN a.STATUS = 0 THEN 1 ELSE 0 END ) AS notSignCount, |
| | | sum( CASE WHEN a.STATUS = 1 THEN 1 ELSE 0 END ) AS signCount , |
| | | ( count( a.status = 1 OR NULL )/ count(a.status >= 0 OR NULL ) * 100 ) AS proportion |
| | | |
| | | FROM |
| | | t_order_task a |
| | | LEFT JOIN t_car b ON a.car_id = b.id |
| | | LEFT JOIN t_area c ON a.area_id = c.id |
| | | LEFT JOIN t_area_ection d ON a.area_section_id = d.id |
| | | LEFT JOIN t_user e ON e.id = b.user_id |
| | | <where> |
| | | 1=1 |
| | | <if test="carId != null and carId != ''" > |
| | | AND a.car_id = #{carId} |
| | | </if> |
| | | <if test="carNo != null and carNo != ''" > |
| | | AND b.car_no = #{carNo} |
| | | </if> |
| | | <if test="name != null and name != ''" > |
| | | AND d.NAME = #{name} |
| | | </if> |
| | | <if test="sendDate != null and sendDate != ''"> |
| | | AND DATE_FORMAT(a.send_date,'%Y-%m-%d') = #{sendDate} |
| | | </if> |
| | | <if test="sendDateStart != null and sendDateStart != ''"> |
| | | AND send_date >= #{createTimeFrom} |
| | | </if> |
| | | <if test="sendDateEnd != null and sendDateEnd != ''"> |
| | | AND send_date < #{createTimeTo} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '1'.toString()"> |
| | | DATE(a.send_date), |
| | | </if> |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '2'.toString()"> |
| | | WEEK(a.send_date,1), |
| | | </if> |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '3'.toString()"> |
| | | MONTH(a.send_date), |
| | | </if> |
| | | <if test="StatisticalType!=null and StatisticalType !='' and StatisticalType == '4'.toString()"> |
| | | YEAR(a.send_date), |
| | | </if> |
| | | a.area_section_id, |
| | | b.car_no, |
| | | c.NAME, |
| | | d.NAME, |
| | | a.send_date, |
| | | e.nickname, |
| | | a.id |
| | | ORDER BY |
| | | c.NAME ASC, |
| | | a.send_date asc |
| | | </select> |
| | | </mapper> |