|
@@ -41,7 +41,7 @@
|
|
|
left join t_b_service_region r on r.service_id=s.id
|
|
|
left join t_b_service_region_detail rd on rd.service_region_id=r.id
|
|
|
<where>
|
|
|
- and s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.service_id is not null and r.id is not null
|
|
|
+ and s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.service_id is not null and r.id is not null
|
|
|
<if test="type != null and type != ''">
|
|
|
and cu.type = #{type}
|
|
|
</if>
|
|
@@ -66,35 +66,6 @@
|
|
|
order by count(DISTINCT c.id ) desc
|
|
|
</select>
|
|
|
<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
|
|
|
s.id,
|
|
@@ -112,6 +83,7 @@
|
|
|
|
|
|
<where>
|
|
|
s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.crm_no is not null
|
|
|
+ and c.service_id is not null and c.enable=1
|
|
|
<!-- <if test="year != null and year != ''">-->
|
|
|
<!-- and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}-->
|
|
|
<!-- </if>-->
|
|
@@ -147,6 +119,7 @@
|
|
|
<!-- and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}-->
|
|
|
<!-- </if>-->
|
|
|
and su.id is not null
|
|
|
+ and s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.service_id is not null and c.enable=1
|
|
|
<if test="startTime != null">
|
|
|
AND s.start_time >= #{startTime}
|
|
|
</if>
|
|
@@ -166,25 +139,27 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="monthly" resultType="java.util.Map">
|
|
|
- SELECT YEAR
|
|
|
+ SELECT
|
|
|
+ a.year,
|
|
|
+ a.month ,
|
|
|
+ count(DISTINCT a.id) count
|
|
|
+ FROM
|
|
|
(
|
|
|
- FROM_UNIXTIME( c.begin_time / 1000 )) year,
|
|
|
+ SELECT DISTINCT
|
|
|
+ CAST( YEAR ( FROM_UNIXTIME( c.begin_time / 1000 )) AS CHAR ) YEAR,
|
|
|
MONTH (
|
|
|
- FROM_UNIXTIME( c.begin_time / 1000 )) month,
|
|
|
- count(DISTINCT c.id ) count
|
|
|
+ FROM_UNIXTIME( c.begin_time / 1000 )) MONTH,
|
|
|
+ c.id
|
|
|
FROM
|
|
|
t_b_crm c
|
|
|
LEFT JOIN t_b_service s ON c.service_id = s.id
|
|
|
LEFT JOIN sys_custom cu ON cu.id = c.custom_id
|
|
|
<where>
|
|
|
- and s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.service_id is not null
|
|
|
+ and s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.service_id is not null and c.enable=1
|
|
|
<if test="type != null and type != ''">
|
|
|
and cu.type = #{type}
|
|
|
</if>
|
|
|
|
|
|
- <!-- <if test="year != null and year != ''">-->
|
|
|
- <!-- and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}-->
|
|
|
- <!-- </if>-->
|
|
|
<if test="startTime != null">
|
|
|
AND s.start_time >= #{startTime}
|
|
|
</if>
|
|
@@ -197,16 +172,14 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
</where>
|
|
|
+ ) a
|
|
|
GROUP BY
|
|
|
- YEAR (
|
|
|
- FROM_UNIXTIME( c.begin_time / 1000 )),
|
|
|
- MONTH (
|
|
|
- FROM_UNIXTIME( c.begin_time / 1000 ))
|
|
|
+ a.YEAR,
|
|
|
+ a.MONTH
|
|
|
ORDER BY
|
|
|
- YEAR (
|
|
|
- FROM_UNIXTIME( c.begin_time / 1000 )),
|
|
|
- MONTH (
|
|
|
- FROM_UNIXTIME( c.begin_time / 1000 ))
|
|
|
+ a.YEAR,
|
|
|
+ a.MONTH
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -217,12 +190,10 @@
|
|
|
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-->
|
|
|
- <!-- YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}-->
|
|
|
+
|
|
|
<where>
|
|
|
- <!-- <if test="year != null and year != ''">-->
|
|
|
- <!-- and YEAR ( FROM_UNIXTIME( s.start_time / 1000 ))= #{year}-->
|
|
|
- <!-- </if>-->
|
|
|
+
|
|
|
+ and s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.service_id is not null and c.enable=1
|
|
|
<if test="startTime != null">
|
|
|
AND s.start_time <![CDATA[ >= ]]> #{startTime}
|
|
|
</if>
|
|
@@ -267,16 +238,16 @@
|
|
|
LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
|
|
|
LEFT JOIN sys_supplier su ON su.id = us.supplier_id
|
|
|
<where>
|
|
|
-
|
|
|
+ and tbs.`status` IN ( 'PUBLISH', 'FINISH' ) and a.service_id is not null and a.enable=1
|
|
|
<if test="serviceId != null and serviceId != ''">
|
|
|
- tbs.`status` IN ( 'PUBLISH', 'FINISH' ) and a.crm_no is not null
|
|
|
+ and a.crm_no is not null
|
|
|
and a.service_id = #{serviceId}
|
|
|
</if>
|
|
|
<!-- <if test="regionId != null and regionId != ''">-->
|
|
|
<!-- and r.id = #{regionId}-->
|
|
|
<!-- </if>-->
|
|
|
<if test="province != null and province != ''">
|
|
|
- and tbs.`status` IN ( 'PUBLISH', 'FINISH' ) and a.service_id is not null and r.id is not null
|
|
|
+ and r.id is not null
|
|
|
and rd.province = #{province}
|
|
|
</if>
|
|
|
<if test="type != null and type != ''">
|
|
@@ -285,12 +256,6 @@
|
|
|
<if test="supplierId != null and supplierId != ''">
|
|
|
and su.id = #{supplierId}
|
|
|
</if>
|
|
|
- <!-- <if test="supplierId == null or supplierId = ''">-->
|
|
|
- <!-- and su.id is null-->
|
|
|
- <!-- </if>-->
|
|
|
- <!-- <if test="year != null and year != ''">-->
|
|
|
- <!-- and YEAR ( FROM_UNIXTIME( tbs.start_time / 1000 ))= #{year}-->
|
|
|
- <!-- </if>-->
|
|
|
<if test="startTime != null">
|
|
|
AND tbs.start_time <![CDATA[ >= ]]> #{startTime}
|
|
|
</if>
|
|
@@ -303,7 +268,6 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="crmYear != null and crmYear != ''">
|
|
|
- and tbs.`status` IN ( 'PUBLISH', 'FINISH' ) and a.service_id is not null
|
|
|
and YEAR (FROM_UNIXTIME( a.begin_time / 1000))= #{crmYear}
|
|
|
</if>
|
|
|
<if test="month != null and month != ''">
|
|
@@ -322,6 +286,7 @@
|
|
|
LEFT JOIN t_b_crm c ON c.service_id = s.id
|
|
|
LEFT JOIN t_b_user_archives_allocation a ON a.service_id = s.id
|
|
|
<where>
|
|
|
+ and s.`status` IN ( 'PUBLISH', 'FINISH' ) and c.service_id is not null and c.enable=1
|
|
|
<if test="startTime != null">
|
|
|
AND s.start_time >= #{startTime}
|
|
|
</if>
|