You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
5.1 KiB

<?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 ORIGIN = 'issue'
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 ORIGIN = 'issue'
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>
5 years ago
<select id="selectProjectInfo" resultType="com.epmet.dto.ProjectDTO">
SELECT
ID,
CUSTOMER_ID,
AGENCY_ID,
ORIGIN_ID,
STATUS,
CLOSED_STATUS,
ORG_ID_PATH,
CREATED_TIME,
UPDATED_TIME
FROM project
WHERE
DEL_FLAG = '0'
AND ORIGIN = 'issue'
AND CUSTOMER_ID = #{customerId}
<if test="date != null and date.trim() != ''">
5 years ago
AND DATE_FORMAT(CREATED_TIME, '%Y%m%d') = #{date}
5 years ago
</if>
</select>
5 years ago
<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>
</mapper>