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-08-19 10:14:06 +08:00
|
|
|
,sum(case when process_status='1' and is_er=1 then 1 else 0 end ) as reloadReviewNUm
|
2024-07-30 16:41:24 +08:00
|
|
|
,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 (
|
2024-07-31 13:37:27 +08:00
|
|
|
select tt.team_name as teamName,ts.id,te.amount
|
2024-07-31 08:39:19 +08:00
|
|
|
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
|
2024-07-26 11:22:44 +08:00
|
|
|
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-31 13:36:54 +08:00
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
(
|
2024-07-31 15:29:34 +08:00
|
|
|
SELECT
|
|
|
|
|
aa.id,
|
|
|
|
|
aa.custom_name AS userName,
|
|
|
|
|
aa.custom_user AS contacts,
|
|
|
|
|
aa.custom_phone AS contactPhone,
|
|
|
|
|
SUM( te.dev_num ) AS orderNum,
|
|
|
|
|
MAX( te.update_time ) AS cooperateDate,
|
|
|
|
|
SUM( te.dev_num * bb.amount ) + SUM(IFNULL( ted.amount, 0 )) AS totalCost
|
2024-07-31 13:36:54 +08:00
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
ec.id,
|
|
|
|
|
ec.custom_name,
|
|
|
|
|
ec.custom_user,
|
|
|
|
|
ec.custom_phone
|
|
|
|
|
FROM
|
|
|
|
|
tb_custom ec
|
|
|
|
|
WHERE
|
|
|
|
|
ec.del_flag = 0
|
|
|
|
|
AND ec.dept_id = 0
|
|
|
|
|
) aa
|
|
|
|
|
LEFT JOIN tb_exper te ON te.submit_unit = aa.id
|
|
|
|
|
AND te.del_flag = 0
|
2024-07-31 15:29:34 +08:00
|
|
|
LEFT JOIN(
|
|
|
|
|
SELECT
|
|
|
|
|
exper_id,
|
|
|
|
|
SUM(amount) as amount
|
|
|
|
|
FROM
|
|
|
|
|
tb_exper_dev
|
|
|
|
|
GROUP BY exper_id
|
|
|
|
|
) ted ON ted.exper_id = te.id
|
2024-07-31 13:36:54 +08:00
|
|
|
LEFT JOIN ( SELECT exper_id, SUM( IFNULL( amount, 0 ) ) AS amount FROM tb_exper_items GROUP BY exper_id ) bb ON bb.exper_id = te.id
|
|
|
|
|
GROUP BY
|
|
|
|
|
te.submit_unit
|
|
|
|
|
) cc
|
|
|
|
|
WHERE
|
|
|
|
|
cc.cooperateDate IS NOT NULL
|
|
|
|
|
ORDER BY
|
|
|
|
|
cc.totalCost DESC
|
2024-07-31 15:29:34 +08:00
|
|
|
LIMIT 5
|
2024-07-26 11:22:44 +08:00
|
|
|
</select>
|
|
|
|
|
</mapper>
|