2024-07-26 11:22:44 +08:00
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.bonus.aqgqj.basis.dao.HomeDao">
|
|
|
|
|
<select id="getApprovalNum" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
2024-07-30 16:41:24 +08:00
|
|
|
select
|
2024-07-29 10:26:01 +08:00
|
|
|
sum(case when team_id is null then 1 else 0 end ) as dispatchWorkNum
|
2024-07-26 11:22:44 +08:00
|
|
|
,sum(case when team_id is not null and process_status is null then 1 else 0 end ) as testNum
|
2024-07-30 16:41:24 +08:00
|
|
|
,sum(case when process_status='1' and is_er=0 then 1 else 0 end ) as reloadReviewNUm
|
|
|
|
|
,sum(case when process_status='1' and is_er is null and audti_status!='2' then 1 else 0 end ) as reviewNUm
|
|
|
|
|
,sum(case when process_status='2' and audti_status!='2' then 1 else 0 end ) as examineNum
|
|
|
|
|
,sum(case when process_status='3' and audti_status!='2' then 1 else 0 end ) as approvalNum
|
2024-07-26 11:22:44 +08:00
|
|
|
,DATE_FORMAT(NOW(), '%Y-%m-%d') as updateDate
|
2024-07-30 16:41:24 +08:00
|
|
|
from (
|
|
|
|
|
select * from tb_sample where del_flag='0'
|
|
|
|
|
) ts
|
2024-07-26 11:22:44 +08:00
|
|
|
</select>
|
|
|
|
|
<select id="getATeamNumForEcharts" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
2024-07-26 14:30:00 +08:00
|
|
|
SELECT testData,COUNT(1) AS testNum from (
|
|
|
|
|
select tt.team_name as teamName,ts.id,DATE_FORMAT(ts.dispatch_time, '%Y-%m-%d') as testData from tb_sample ts
|
|
|
|
|
LEFT JOIN tb_team tt on ts.team_id=tt.id
|
|
|
|
|
where ts.del_flag='0' and tt.id=#{id}
|
|
|
|
|
) aa group by testData
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getTeams" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
|
|
|
|
select id,team_name as teamname from tb_team where del_flag='0'
|
2024-07-26 11:22:44 +08:00
|
|
|
</select>
|
|
|
|
|
<select id="getATeamCostForEcharts" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
|
|
|
|
select
|
|
|
|
|
teamName,sum(amount) as testCost
|
|
|
|
|
from (
|
|
|
|
|
select tt.team_name as teamName,ts.id,teis.amount from tb_exper te
|
|
|
|
|
left join tb_sample ts on te.sample_id=ts.id
|
|
|
|
|
left join tb_team tt on ts.team_id=tt.id
|
|
|
|
|
left join tb_exper_items teis on te.id=teis.exper_id
|
|
|
|
|
where ts.del_flag='0'
|
|
|
|
|
) aa group by teamName
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getCostRank" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
2024-07-26 14:30:00 +08:00
|
|
|
select aa.custom_name userName,aa.custom_user as contacts,aa.custom_phone as contactPhone,aa.orderNum,bb.totalCost,cc.cooperateDate from (
|
|
|
|
|
select ec.id,ec.custom_name,ec.custom_user,ec.custom_phone,sum(te.dev_num) as orderNum from
|
|
|
|
|
tb_custom ec
|
|
|
|
|
left join tb_sample ts on ec.id=ts.custom_id
|
|
|
|
|
left join tb_exper te on ts.id=te.sample_id
|
|
|
|
|
left join tb_exper_items teis on te.id=teis.exper_id
|
|
|
|
|
group by ec.custom_name,ec.custom_user,ec.custom_phone
|
|
|
|
|
) aa
|
|
|
|
|
left join (
|
|
|
|
|
select ec.id,ec.custom_name,ec.custom_user,ec.custom_phone,sum(teis.amount) as totalCost from
|
|
|
|
|
tb_custom ec
|
|
|
|
|
left join tb_sample ts on ec.id=ts.custom_id
|
|
|
|
|
left join tb_exper te on ts.id=te.sample_id
|
|
|
|
|
left join tb_exper_items teis on te.id=teis.exper_id
|
|
|
|
|
group by ec.custom_name,ec.custom_user,ec.custom_phone
|
|
|
|
|
) bb on aa.id=bb.id
|
|
|
|
|
left join (
|
|
|
|
|
select ec.id,ec.custom_name,ec.custom_user,ec.custom_phone,max(ts.create_time) as cooperateDate from
|
|
|
|
|
tb_custom ec
|
|
|
|
|
left join tb_sample ts on ec.id=ts.custom_id
|
|
|
|
|
left join tb_exper te on ts.id=te.sample_id
|
|
|
|
|
left join tb_exper_items teis on te.id=teis.exper_id
|
|
|
|
|
group by ec.custom_name,ec.custom_user,ec.custom_phone
|
|
|
|
|
) cc on aa.id=cc.id
|
|
|
|
|
where cooperateDate is not null order by totalCost desc
|
2024-07-26 11:22:44 +08:00
|
|
|
</select>
|
|
|
|
|
</mapper>
|