Commit ac7366d5 authored by libin's avatar libin

Merge branch 'staff-statistics' into dev

parents bea2486a b773e1c1
...@@ -19,10 +19,20 @@ import java.util.List; ...@@ -19,10 +19,20 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class StaffStatisticsFindDTO extends PageParam { public class StaffStatisticsFindDTO extends PageParam {
private Date startDate; private Date startDate;
private Long startTime;
private Long endTime;
private Date endDate; private Date endDate;
private String companyName; private String companyName;
private String postionName; private String postionName;
private Integer userPostionId; private Integer userPostionId;
private Integer companyId; private Integer companyId;
private List<Integer> userIds; private List<Integer> userIds;
public Long getStartTime() {
return startDate==null?0:startDate.getTime();
}
public Long getEndTime() {
return endDate==null?0:endDate.getTime();
}
} }
...@@ -282,33 +282,44 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id= ...@@ -282,33 +282,44 @@ from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=
</if>) as `saff` </if>) as `saff`
left join ( left join (
select auswp.user_id, IFNULL(auswp.upIncome, 0) - IFNULL(auswd.dowIncome, 0) as `sellAmount` select auswp.user_id, IFNULL(auswp.upIncome, 0) - IFNULL(auswd.dowIncome, 0) as `sellAmount`
from (select `user_id`, sum(price) as `upIncome` from (select `user_id`, sum(commission / (extract/100.0)) as `upIncome`
from `app_user_selling_water` from `app_user_selling_water`
where <![CDATA[position_id<>6]]> where <![CDATA[position_id<>6]]>
and status = 0 and status = 0
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
and `crt_time` between #{startDate} and #{endDate} and `crt_time` between #{startTime} and #{endTime}
</if> </if>
<if test="startDate!=null and endDate==null"> <if test="startDate!=null and endDate==null">
and <![CDATA[ and <![CDATA[
`crt_time` >=#{startDate} `crt_time` >=#{startTime}
]]> ]]>
</if> </if>
<if test="startDate==null and endDate!=null"> <if test="startDate==null and endDate!=null">
and <![CDATA[ and <![CDATA[
`crt_time` <=#{endDate} `crt_time` <=#{endTime}
]]> ]]>
</if> </if>
group by user_id) as auswp group by user_id) as auswp
left join (select `user_id`, sum(price) as `dowIncome` left join (select `user_id`, sum(commission / (extract/100.0)) as `dowIncome`
from `app_user_selling_water` from `app_user_selling_water`
where <![CDATA[position_id<>6]]> where <![CDATA[position_id<>6]]>
and status = 1 and status = 1
<if test="startDate!=null and endDate!=null">
and `crt_time` between #{startTime} and #{endTime}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`crt_time` >=#{startTime}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`crt_time` <=#{endTime}
]]>
</if>
group by user_id) as auswd group by user_id) as auswd
on auswd.user_id = auswp.user_id on auswd.user_id = auswp.user_id
) as `sell` on sell.user_id=saff.userId ) as `sell` on sell.user_id=saff.userId
order by sell.sellAmount desc order by sell.sellAmount desc
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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