Commit 39aab3f4 authored by 竹天卫's avatar 竹天卫

统计报表 筛选条件优化 日期优化

parent 6c5f0023
...@@ -3,9 +3,12 @@ ...@@ -3,9 +3,12 @@
<mapper namespace="cn.wise.sc.acquisition.business.mapper.DataStatisticsMapper"> <mapper namespace="cn.wise.sc.acquisition.business.mapper.DataStatisticsMapper">
<select id="countByPhoto" resultType="cn.wise.sc.acquisition.business.model.vo.DataStatisticsVo"> <select id="countByPhoto" resultType="cn.wise.sc.acquisition.business.model.vo.DataStatisticsVo">
SELECT tw.Rq as name, SUM(tw.Jz) as value SELECT Convert(varchar(10),tw.Rq,120) as name, SUM(tw.Jz) as value
FROM T_Weight tw FROM T_Weight tw
where 1=1 where 1=1
<if test="params.TruckID != null and params.TruckID != ''">
and tw.TruckID = #{params.TruckID}
</if>
<if test="params.cycle == 1 "> <if test="params.cycle == 1 ">
and datediff(week, tw.Rq,getdate())=0 and datediff(week, tw.Rq,getdate())=0
</if> </if>
...@@ -19,23 +22,26 @@ ...@@ -19,23 +22,26 @@
and datediff(year, tw.Rq,getdate())=0 and datediff(year, tw.Rq,getdate())=0
</if> </if>
<if test="params.startDate != null and params.startDate != ''"> <if test="params.startDate != null and params.startDate != ''">
and tw.Rq > &gt;= #{params.startDate} and Convert(varchar(10),tw.Rq,120) <![CDATA[ >= ]]> #{params.startDate}
</if> </if>
<if test="params.endDate != null and params.endDate != ''"> <if test="params.endDate != null and params.endDate != ''">
and tw.Rq > &lt;= #{params.endDate} and Convert(varchar(10),tw.Rq,120) <![CDATA[ <= ]]> #{params.endDate}
</if> </if>
<!--<if test="params.startDate == null and params.endDate == null"> <if test="params.startDate == null and params.endDate == null">
and datediff(week, tw.Rq,getdate())=0 and datediff(week, tw.Rq,getdate())=0
</if>--> </if>
group by tw.Rq group by Convert(varchar(10),tw.Rq,120)
</select> </select>
<select id="countByTable" resultType="cn.wise.sc.acquisition.business.model.vo.DataStatisticsTableVo"> <select id="countByTable" resultType="cn.wise.sc.acquisition.business.model.vo.DataStatisticsTableVo">
SELECT tw.Uid,tw.Rq,tw.TruckID,'发货单位' as clientName,tpt.WorkType,tw.Mz,tw.Pz,tw.Jz SELECT tw.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 FROM T_Weight tw
left join T_Processes_Truck tpt on tpt.TruckID = tw.TruckID left join T_Processes_Truck tpt on tpt.TruckID = tw.TruckID
where 1=1 where 1=1
<if test="params.TruckID != null and params.TruckID != ''">
and tw.TruckID = #{params.TruckID}
</if>
<if test="params.cycle == 1 "> <if test="params.cycle == 1 ">
and datediff(week, tw.Rq,getdate())=0 and datediff(week, tw.Rq,getdate())=0
</if> </if>
...@@ -49,14 +55,14 @@ ...@@ -49,14 +55,14 @@
and datediff(year, tw.Rq,getdate())=0 and datediff(year, tw.Rq,getdate())=0
</if> </if>
<if test="params.startDate != null and params.startDate != ''"> <if test="params.startDate != null and params.startDate != ''">
and tw.Rq > &gt;= #{params.startDate} and Convert(varchar(10),tw.Rq,120) <![CDATA[ >= ]]> #{params.startDate}
</if> </if>
<if test="params.endDate != null and params.endDate != ''"> <if test="params.endDate != null and params.endDate != ''">
and tw.Rq > &lt;= #{params.endDate} and Convert(varchar(10),tw.Rq,120) <![CDATA[ <= ]]> #{params.endDate}
</if> </if>
<!--<if test="params.startDate == null and params.endDate == null"> <if test="params.startDate == null and params.endDate == null">
and datediff(week, tw.Rq,getdate())=0 and datediff(week, tw.Rq,getdate())=0
</if>--> </if>
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment