|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
|
|
|
<mapper namespace="com.epmet.dao.project.ProjectDao">
|
|
|
|
|
|
|
|
<select id="selectProjectList" resultType="com.epmet.entity.project.ProjectEntity">
|
|
|
|
SELECT
|
|
|
|
*
|
|
|
|
FROM
|
|
|
|
project
|
|
|
|
WHERE
|
|
|
|
del_flag = '0'
|
|
|
|
AND customer_id = #{customerId}
|
|
|
|
AND status = #{status}
|
|
|
|
<![CDATA[AND DATE_FORMAT(created_time, "%Y-%m-%d") <= DATE_FORMAT(#{createdTime}, "%Y-%m-%d")]]>
|
|
|
|
ORDER BY created_time DESC
|
|
|
|
</select>
|
|
|
|
<select id="selectAgencyClosedProjectTotal" resultType="com.epmet.dto.project.ProjectAgencyDTO">
|
|
|
|
SELECT
|
|
|
|
AGENCY_ID AS "agencyId",
|
|
|
|
ORG_ID_PATH AS "pIds",
|
|
|
|
CLOSED_STATUS AS "status",
|
|
|
|
COUNT(ID) AS "count"
|
|
|
|
FROM project
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = '0'
|
|
|
|
AND STATUS = 'closed'
|
|
|
|
AND CUSTOMER_ID = #{customerId}
|
|
|
|
AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') <![CDATA[ <= ]]> #{date}
|
|
|
|
GROUP BY
|
|
|
|
AGENCY_ID, CLOSED_STATUS
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectAgencyClosedProjectInc" resultType="com.epmet.dto.project.ProjectAgencyDTO">
|
|
|
|
SELECT
|
|
|
|
AGENCY_ID AS "agencyId",
|
|
|
|
ORG_ID_PATH AS "pIds",
|
|
|
|
CLOSED_STATUS AS "status",
|
|
|
|
COUNT(ID) AS "count"
|
|
|
|
FROM project
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = '0'
|
|
|
|
AND STATUS = 'closed'
|
|
|
|
AND CUSTOMER_ID = #{customerId}
|
|
|
|
AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') = #{date}
|
|
|
|
GROUP BY
|
|
|
|
AGENCY_ID, CLOSED_STATUS
|
|
|
|
</select>
|
|
|
|
<select id="selectGridClosedProjectTotal" resultType="com.epmet.dto.project.ProjectGridDTO">
|
|
|
|
SELECT
|
|
|
|
ID AS "projectId",
|
|
|
|
AGENCY_ID AS "agencyId",
|
|
|
|
ORIGIN_ID AS "issueId",
|
|
|
|
CLOSED_STATUS AS "status"
|
|
|
|
FROM project
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = '0'
|
|
|
|
AND ORIGIN = 'issue'
|
|
|
|
AND STATUS = 'closed'
|
|
|
|
AND CUSTOMER_ID = #{customerId}
|
|
|
|
AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') <![CDATA[ <= ]]> #{date}
|
|
|
|
</select>
|
|
|
|
<select id="selectGridClosedProjectInc" resultType="com.epmet.dto.project.ProjectGridDTO">
|
|
|
|
SELECT
|
|
|
|
ID AS "projectId",
|
|
|
|
AGENCY_ID AS "agencyId",
|
|
|
|
ORIGIN_ID AS "issueId",
|
|
|
|
CLOSED_STATUS AS "status"
|
|
|
|
FROM project
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = '0'
|
|
|
|
AND ORIGIN = 'issue'
|
|
|
|
AND STATUS = 'closed'
|
|
|
|
AND CUSTOMER_ID = #{customerId}
|
|
|
|
AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') = #{date}
|
|
|
|
</select>
|
|
|
|
<select id="selectProjectInfo" resultType="com.epmet.dto.ProjectDTO">
|
|
|
|
SELECT
|
|
|
|
ID,
|
|
|
|
CUSTOMER_ID,
|
|
|
|
AGENCY_ID,
|
|
|
|
ORIGIN,
|
|
|
|
ORIGIN_ID,
|
|
|
|
TITLE,
|
|
|
|
BACK_GROUND,
|
|
|
|
STATUS,
|
|
|
|
CLOSED_STATUS,
|
|
|
|
ORG_ID_PATH,
|
|
|
|
CREATED_BY,
|
|
|
|
CREATED_TIME,
|
|
|
|
UPDATED_TIME
|
|
|
|
FROM project
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = '0'
|
|
|
|
AND CUSTOMER_ID = #{customerId}
|
|
|
|
<if test="date != null and date.trim() != ''">
|
|
|
|
AND DATE_FORMAT(CREATED_TIME, '%Y%m%d') = #{date}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="selectParameterValueByKey" resultType="java.lang.String">
|
|
|
|
select
|
|
|
|
PARAMETER_VALUE
|
|
|
|
from
|
|
|
|
customer_project_parameter
|
|
|
|
where DEL_FLAG = '0'
|
|
|
|
and CUSTOMER_ID = #{customerId}
|
|
|
|
and PARAMETER_KEY ='detention_days'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectProjectExceedParams" resultType="com.epmet.dto.project.result.ProjectExceedParamsResultDTO">
|
|
|
|
select
|
|
|
|
IF(customer_id = 'default' <![CDATA[&&]]> PARAMETER_KEY = 'detention_days',PARAMETER_VALUE,null) as defaultExceedLimit,
|
|
|
|
IF(customer_id = 'default' <![CDATA[&&]]> PARAMETER_KEY = 'remind_time',PARAMETER_VALUE,null) as defaultAbout2ExceedLimit,
|
|
|
|
IF(customer_id = #{customerId} <![CDATA[&&]]> PARAMETER_KEY = 'detention_days',PARAMETER_VALUE,null) as exceedLimit,
|
|
|
|
IF(customer_id = #{customerId} <![CDATA[&&]]> PARAMETER_KEY = 'remind_time',PARAMETER_VALUE,null) as about2ExceedLimit
|
|
|
|
from `customer_project_parameter` where del_flag = '0' and (customer_id = 'default' or customer_id = #{customerId}
|
|
|
|
)and (PARAMETER_KEY = 'detention_days' OR PARAMETER_KEY = 'remind_time')
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="batchSelectProjectInfo" resultType="com.epmet.entity.project.ProjectEntity">
|
|
|
|
select * from project
|
|
|
|
where del_flag = '0'
|
|
|
|
<if test="null != ids and ids.size() > 0">
|
|
|
|
<foreach collection="ids" item="id" open=" AND (" separator=" OR " close=" )">
|
|
|
|
id = #{id}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectProjectCategory" resultType="com.epmet.dto.project.ProjectCategoryDTO">
|
|
|
|
select * from
|
|
|
|
`project_category`
|
|
|
|
where del_flag = '0'
|
|
|
|
<foreach collection="list" item="id" open="AND (" separator=" OR " close=" )">
|
|
|
|
project_id = #{id}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getProjectCategoryData" resultType="com.epmet.dto.ProjectCategoryDTO">
|
|
|
|
select * from
|
|
|
|
`project_category`
|
|
|
|
where del_flag = '0'
|
|
|
|
and customer_id = #{customerId}
|
|
|
|
<if test="dateId != null">
|
|
|
|
AND DATE_FORMAT(CREATED_TIME,'%Y%m%d')=#{dateId}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="selectProjectSatisfaction" resultType="com.epmet.dto.project.ProjectPointDTO">
|
|
|
|
SELECT
|
|
|
|
PROJECT_ID,
|
|
|
|
( PERFECT_COUNT * 100 + (SHOULD_EVALUATE_COUNT-PERFECT_COUNT-BAD_COUNT) * 80 + BAD_COUNT * 60 ) DIV SHOULD_EVALUATE_COUNT AS point
|
|
|
|
FROM
|
|
|
|
project_satisfaction_statistics
|
|
|
|
WHERE CUSTOMER_ID = #{customerId}
|
|
|
|
</select>
|
|
|
|
<select id="selectValueByKey" resultType="java.lang.String">
|
|
|
|
select
|
|
|
|
PARAMETER_VALUE
|
|
|
|
from
|
|
|
|
customer_project_parameter
|
|
|
|
where DEL_FLAG = '0'
|
|
|
|
and CUSTOMER_ID = #{customerId}
|
|
|
|
and PARAMETER_KEY = #{parameterKey}
|
|
|
|
</select>
|
|
|
|
<select id="selectProjectListByDateId" resultType="com.epmet.dto.ProjectDTO">
|
|
|
|
SELECT * FROM project
|
|
|
|
WHERE customer_id = #{customerId}
|
|
|
|
AND ORIGIN = #{projectOrigin}
|
|
|
|
AND del_flag = '0'
|
|
|
|
AND DATE_FORMAT( CREATED_TIME, '%Y%m%d' ) = #{dateId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 计算某个项目的群满意度得分 -->
|
|
|
|
<select id="selectProjectSatisfactionScore" parameterType="map" resultType="java.math.BigDecimal">
|
|
|
|
SELECT
|
|
|
|
IFNULL(
|
|
|
|
(
|
|
|
|
(s.SHOULD_EVALUATE_COUNT - s.GOOD_COUNT - s.BAD_COUNT - s.PERFECT_COUNT) * 80
|
|
|
|
+ s.BAD_COUNT * 60
|
|
|
|
+ s.GOOD_COUNT * 80
|
|
|
|
+ s.PERFECT_COUNT * 100
|
|
|
|
)/s.SHOULD_EVALUATE_COUNT
|
|
|
|
,
|
|
|
|
0
|
|
|
|
) AS score
|
|
|
|
FROM
|
|
|
|
project_satisfaction_statistics s
|
|
|
|
WHERE
|
|
|
|
s.DEL_FLAG = '0'
|
|
|
|
AND s.CUSTOMER_ID = #{customerId}
|
|
|
|
and s.PROJECT_ID=#{projectId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 查询当天(dateId)有评价记录的项目id -->
|
|
|
|
<select id="selectEvaluateProjectIds" parameterType="map" resultType="java.lang.String">
|
|
|
|
SELECT
|
|
|
|
distinct psd.PROJECT_ID
|
|
|
|
FROM
|
|
|
|
project_satisfaction_detail psd
|
|
|
|
WHERE
|
|
|
|
psd.DEL_FLAG = '0'
|
|
|
|
AND psd.CUSTOMER_ID = #{customerId}
|
|
|
|
AND DATE_FORMAT(psd.CREATED_TIME,'%Y%m%d')=#{dateId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 可根据状态筛选项目id -->
|
|
|
|
<select id="selectClosedProjectIds" parameterType="map" resultType="java.lang.String">
|
|
|
|
SELECT
|
|
|
|
p.id
|
|
|
|
FROM
|
|
|
|
project p
|
|
|
|
WHERE
|
|
|
|
p.DEL_FLAG = '0'
|
|
|
|
AND p.CUSTOMER_ID = #{customerId}
|
|
|
|
<if test="projectStatus != null and projectStatus.trim() != ''">
|
|
|
|
AND p.`STATUS` =#{projectStatus}
|
|
|
|
</if>
|
|
|
|
<if test="origin != null and origin.trim() != ''">
|
|
|
|
AND p.ORIGIN =#{origin}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
</mapper>
|