1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?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.wise.sc.acquisition.business.mapper.DataStatisticsMapper">
<select id="countByPhoto" resultType="cn.wise.sc.acquisition.business.model.vo.DataStatisticsVo">
SELECT Convert(varchar(10),tw.Rq,120) as name, SUM(tw.Jz) as value
FROM T_Weight tw
where 1=1
<if test="params.TruckID != null and params.TruckID != ''">
and tw.TruckID = #{params.TruckID}
</if>
<if test="params.startDate != null and params.startDate != ''">
and Convert(varchar(10),tw.Rq,120) <![CDATA[ >= ]]> #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and Convert(varchar(10),tw.Rq,120) <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.startDate == null and params.endDate == null">
and datediff(week, tw.Rq,getdate())=0
</if>
group by Convert(varchar(10),tw.Rq,120)
</select>
<select id="countByTable" resultType="cn.wise.sc.acquisition.business.model.vo.DataStatisticsTableVo">
SELECT tw.ID as Uid,Convert(varchar(19),tw.Rq,120)as Rq,tw.TruckID,'发货单位' as clientName,tpt.WorkType,tw.Mz,tw.Pz,tw.Jz
FROM T_Weight tw
left join T_Processes_Truck tpt on tpt.TruckID = tw.TruckID
where 1=1
<if test="params.TruckID != null and params.TruckID != ''">
and tw.TruckID = #{params.TruckID}
</if>
<if test="params.startDate != null and params.startDate != ''">
and Convert(varchar(10),tw.Rq,120) <![CDATA[ >= ]]> #{params.startDate}
</if>
<if test="params.endDate != null and params.endDate != ''">
and Convert(varchar(10),tw.Rq,120) <![CDATA[ <= ]]> #{params.endDate}
</if>
<if test="params.startDate == null and params.endDate == null">
and datediff(week, tw.Rq,getdate())=0
</if>
</select>
</mapper>