SELECT
id,
customer_id,
agency_id,
closed_status
FROM
project
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND status = #{status}
ORDER BY created_time DESC
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
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
ID AS "projectId",
AGENCY_ID AS "agencyId",
ORIGIN_ID AS "issueId",
CLOSED_STATUS AS "status"
FROM project
WHERE
DEL_FLAG = '0'
AND (ORIGIN = 'issue' OR ORIGIN = 'resi_event')
AND STATUS = 'closed'
AND CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') #{date}
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' OR ORIGIN = 'resi_event')
AND STATUS = 'closed'
AND CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(UPDATED_TIME, '%Y-%m-%d') = #{date}
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 ID = #{projectId}
and CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(CREATED_TIME, '%Y%m%d') = #{date}
select
PARAMETER_VALUE
from
customer_project_parameter
where DEL_FLAG = '0'
and CUSTOMER_ID = #{customerId}
and PARAMETER_KEY ='detention_days'
select
IF(customer_id = 'default' PARAMETER_KEY = 'detention_days',PARAMETER_VALUE,null) as defaultExceedLimit,
IF(customer_id = 'default' PARAMETER_KEY = 'remind_time',PARAMETER_VALUE,null) as defaultAbout2ExceedLimit,
IF(customer_id = #{customerId} PARAMETER_KEY = 'detention_days',PARAMETER_VALUE,null) as exceedLimit,
IF(customer_id = #{customerId} 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 * from project
where del_flag = '0'
id = #{id}
select * from
`project_category`
where del_flag = '0'
project_id = #{id}
select * from
`project_category`
where del_flag = '0'
and customer_id = #{customerId}
AND DATE_FORMAT(CREATED_TIME,'%Y%m%d')=#{dateId}
select
distinct pc.CATEGORY_ID,
pc.CATEGORY_CODE,
pc.CATEGORY_PIDS,
pc.PROJECT_ID,
pc.CREATED_TIME
from
`project_category` pc
where pc.del_flag = '0'
AND pc.PROJECT_ID = #{projectId}
and pc.customer_id = #{customerId}
AND DATE_FORMAT(pc.CREATED_TIME,'%Y%m%d')=#{dateId}
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}
AND PROJECT_ID = #{projectId}
select
PARAMETER_VALUE
from
customer_project_parameter
where DEL_FLAG = '0'
and CUSTOMER_ID = #{customerId}
and PARAMETER_KEY = #{parameterKey}
SELECT * FROM project
WHERE customer_id = #{customerId}
AND ORIGIN = #{projectOrigin}
AND del_flag = '0'
AND DATE_FORMAT( CREATED_TIME, '%Y%m%d' ) = #{dateId}
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
,
80
) AS score
FROM
project_satisfaction_statistics s
WHERE
s.DEL_FLAG = '0'
AND s.CUSTOMER_ID = #{customerId}
and s.PROJECT_ID=#{projectId}
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
p.id
FROM
project p
WHERE
p.DEL_FLAG = '0'
AND p.CUSTOMER_ID = #{customerId}
AND p.`STATUS` =#{projectStatus}
AND p.ORIGIN =#{origin}
select rero.RESI_EVENT_ID,
rero.ORG_TYPE,
rero.ORG_ID,
rero.ORG_PID,
rero.ORG_PIDS,
re.CREATED_BY,
re.PROJECT_ID
from resi_event_report_org rero
inner join resi_event re on rero.RESI_EVENT_ID = re.id and re.SHIFT_PROJECT = 1 and re.DEL_FLAG = '0'
where rero.del_flag = '0'
AND re.PROJECT_ID = #{projectId}
and rero.CUSTOMER_ID = #{customerId}
UPDATE
project
SET
ORIGIN = 'work_event',
ORIGIN_ID = #{gridId}
WHERE
CREATED_BY = #{staffId}
AND CUSTOMER_ID = #{customerId}
AND AGENCY_ID = #{agencyId}
AND ORIGIN = 'agency'