|
@@ -31,7 +31,7 @@
|
|
<!-- r.region_name-->
|
|
<!-- r.region_name-->
|
|
<!-- order by count( c.id )-->
|
|
<!-- order by count( c.id )-->
|
|
SELECT
|
|
SELECT
|
|
-<!-- r.id,-->
|
|
|
|
|
|
+ <!-- r.id,-->
|
|
rd.province name,
|
|
rd.province name,
|
|
count(DISTINCT c.id ) count
|
|
count(DISTINCT c.id ) count
|
|
FROM
|
|
FROM
|
|
@@ -61,21 +61,57 @@
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
GROUP BY
|
|
GROUP BY
|
|
-<!-- r.id,-->
|
|
|
|
|
|
+ <!-- r.id,-->
|
|
rd.province
|
|
rd.province
|
|
order by count(DISTINCT c.id ) desc
|
|
order by count(DISTINCT c.id ) desc
|
|
</select>
|
|
</select>
|
|
- <select id="project" resultType="com.qmth.sop.business.bean.result.CrmAnalyseResult">
|
|
|
|
|
|
+ <select id="project" resultType="java.util.Map">
|
|
|
|
+ <!-- SELECT-->
|
|
|
|
+ <!-- s.id,-->
|
|
|
|
+ <!-- s.`name`,-->
|
|
|
|
+ <!-- sum(case when c.`status`='FINISH' then 1 else 0 end)/count( c.id ) count-->
|
|
|
|
+ <!-- FROM-->
|
|
|
|
+ <!-- t_b_service s-->
|
|
|
|
+ <!-- LEFT JOIN t_b_crm c ON c.service_id = s.id-->
|
|
|
|
+ <!-- LEFT JOIN sys_custom cu ON cu.id = c.custom_id-->
|
|
|
|
+ <!-- <where>-->
|
|
|
|
+ <!-- s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.status is not null-->
|
|
|
|
+ <!-- <!– <if test="year != null and year != ''">–>-->
|
|
|
|
+ <!-- <!– and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}–>-->
|
|
|
|
+ <!-- <!– </if>–>-->
|
|
|
|
+ <!-- <if test="startTime != null">-->
|
|
|
|
+ <!-- AND s.start_time <![CDATA[ >= ]]> #{startTime}-->
|
|
|
|
+ <!-- </if>-->
|
|
|
|
+ <!-- <if test="endTime != null">-->
|
|
|
|
+ <!-- AND s.start_time <![CDATA[ <= ]]> #{endTime}-->
|
|
|
|
+ <!-- </if>-->
|
|
|
|
+ <!-- <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">-->
|
|
|
|
+ <!-- <if test="dpr.hasBusiness">-->
|
|
|
|
+ <!-- AND s.service_lead_id = #{dpr.requestUserId}-->
|
|
|
|
+ <!-- </if>-->
|
|
|
|
+ <!-- </if>-->
|
|
|
|
+ <!-- </where>-->
|
|
|
|
+ <!-- GROUP BY-->
|
|
|
|
+ <!-- s.id,-->
|
|
|
|
+ <!-- s.`name`-->
|
|
|
|
+
|
|
|
|
+
|
|
SELECT
|
|
SELECT
|
|
s.id,
|
|
s.id,
|
|
s.`name`,
|
|
s.`name`,
|
|
- sum(case when c.`status`='FINISH' then 1 else 0 end)/count( c.id ) count
|
|
|
|
|
|
+ c.crm_no,
|
|
|
|
+ si.sop_no,
|
|
|
|
+ tffa.`status`
|
|
FROM
|
|
FROM
|
|
t_b_service s
|
|
t_b_service s
|
|
LEFT JOIN t_b_crm c ON c.service_id = s.id
|
|
LEFT JOIN t_b_crm c ON c.service_id = s.id
|
|
LEFT JOIN sys_custom cu ON cu.id = c.custom_id
|
|
LEFT JOIN sys_custom cu ON cu.id = c.custom_id
|
|
|
|
+ LEFT JOIN t_b_sop_info si ON si.crm_no = c.crm_no
|
|
|
|
+ LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = si.sop_no
|
|
|
|
+ LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
|
|
|
|
+
|
|
<where>
|
|
<where>
|
|
- s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.status is not null
|
|
|
|
|
|
+ s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.crm_no is not null
|
|
<!-- <if test="year != null and year != ''">-->
|
|
<!-- <if test="year != null and year != ''">-->
|
|
<!-- and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}-->
|
|
<!-- and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}-->
|
|
<!-- </if>-->
|
|
<!-- </if>-->
|
|
@@ -91,9 +127,6 @@
|
|
</if>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- GROUP BY
|
|
|
|
- s.id,
|
|
|
|
- s.`name`
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="supplier" resultType="com.qmth.sop.business.bean.result.CrmAnalyseResult">
|
|
<select id="supplier" resultType="com.qmth.sop.business.bean.result.CrmAnalyseResult">
|
|
@@ -205,7 +238,7 @@
|
|
<select id="crmDetail" resultType="com.qmth.sop.business.bean.result.TBCrmResult">
|
|
<select id="crmDetail" resultType="com.qmth.sop.business.bean.result.TBCrmResult">
|
|
SELECT
|
|
SELECT
|
|
distinct a.id as crmId,a.crm_no as crmNo,
|
|
distinct a.id as crmId,a.crm_no as crmNo,
|
|
- a.begin_time as beginTime,
|
|
|
|
|
|
+ a.begin_time as beginTime,
|
|
a.name,
|
|
a.name,
|
|
tbs.id,
|
|
tbs.id,
|
|
tbs.name service,
|
|
tbs.name service,
|
|
@@ -218,8 +251,8 @@
|
|
tbs.status serviceUnitStatus,
|
|
tbs.status serviceUnitStatus,
|
|
u.real_name regionCoordinator,
|
|
u.real_name regionCoordinator,
|
|
su.name supplier
|
|
su.name supplier
|
|
- from t_b_service tbs
|
|
|
|
- LEFT JOIN t_b_crm a ON a.service_id = tbs.id
|
|
|
|
|
|
+ from t_b_crm a
|
|
|
|
+ LEFT JOIN t_b_service tbs ON a.service_id = tbs.id
|
|
left join t_b_service_region r on r.service_id=tbs.id
|
|
left join t_b_service_region r on r.service_id=tbs.id
|
|
left join t_b_service_region_detail rd on rd.service_region_id=r.id
|
|
left join t_b_service_region_detail rd on rd.service_region_id=r.id
|
|
LEFT JOIN t_b_product p ON p.id = a.product_id
|
|
LEFT JOIN t_b_product p ON p.id = a.product_id
|
|
@@ -236,9 +269,9 @@
|
|
<if test="serviceId != null and serviceId != ''">
|
|
<if test="serviceId != null and serviceId != ''">
|
|
and a.service_id = #{serviceId}
|
|
and a.service_id = #{serviceId}
|
|
</if>
|
|
</if>
|
|
-<!-- <if test="regionId != null and regionId != ''">-->
|
|
|
|
-<!-- and r.id = #{regionId}-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
|
|
+ <!-- <if test="regionId != null and regionId != ''">-->
|
|
|
|
+ <!-- and r.id = #{regionId}-->
|
|
|
|
+ <!-- </if>-->
|
|
<if test="province != null and province != ''">
|
|
<if test="province != null and province != ''">
|
|
and tbs.`status`='PUBLISH' and a.service_id is not null and r.id is not null
|
|
and tbs.`status`='PUBLISH' and a.service_id is not null and r.id is not null
|
|
and rd.province = #{province}
|
|
and rd.province = #{province}
|
|
@@ -249,9 +282,9 @@
|
|
<if test="supplierId != null and supplierId != ''">
|
|
<if test="supplierId != null and supplierId != ''">
|
|
and su.id = #{supplierId}
|
|
and su.id = #{supplierId}
|
|
</if>
|
|
</if>
|
|
-<!-- <if test="supplierId == null or supplierId = ''">-->
|
|
|
|
-<!-- and su.id is null-->
|
|
|
|
-<!-- </if>-->
|
|
|
|
|
|
+ <!-- <if test="supplierId == null or supplierId = ''">-->
|
|
|
|
+ <!-- and su.id is null-->
|
|
|
|
+ <!-- </if>-->
|
|
<!-- <if test="year != null and year != ''">-->
|
|
<!-- <if test="year != null and year != ''">-->
|
|
<!-- and YEAR ( FROM_UNIXTIME( tbs.start_time / 1000 ))= #{year}-->
|
|
<!-- and YEAR ( FROM_UNIXTIME( tbs.start_time / 1000 ))= #{year}-->
|
|
<!-- </if>-->
|
|
<!-- </if>-->
|