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.
 
 
 
 
 

130 lines
5.5 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.IssueApplicationDao">
<select id="applicationDetail" resultType="com.epmet.resi.group.dto.group.result.ApplicationDetailResultDTO">
SELECT
ID AS issueApplicationId,
ISSUE_TITLE,
GRID_ID,
topic_id,
CREATED_BY AS userId,
suggestion AS issueSuggestion
FROM issue_application
WHERE DEL_FLAG = '0'
AND ID = #{issueApplicationId}
</select>
<!-- 分页按条件查询issue_application -->
<select id="selectList" resultType="com.epmet.dto.result.IssueApplicationResDTO" parameterType="com.epmet.dto.form.IssueAppQueryFormDTO">
SELECT
ia.id AS issueApplicationId,
ia.ISSUE_TITLE,
unix_timestamp( ia.UPDATED_TIME ) AS latestTime,
ia.SUGGESTION,
ia.APPLY_STATUS
FROM
issue_application ia
WHERE
ia.DEL_FLAG = '0'
<if test="applyStatus != null and applyStatus.trim() != ''">
AND ia.APPLY_STATUS = #{applyStatus}
</if>
<if test="gridId != null and gridId.trim() != ''">
AND ia.GRID_ID = #{gridId}
</if>
<if test="groupId != null and groupId.trim() != ''">
AND ia.GROUP_ID = #{groupId}
</if>
ORDER BY
ia.UPDATED_TIME DESC
</select>
<!-- 查询某个用户发起的议题列表-审核中列表(待审核+已驳回) -->
<select id="selectUserPubAuditingIssues" parameterType="com.epmet.dto.form.UserPubAuditingIssueFormDTO"
resultType="com.epmet.dto.result.UserPubAuditingIssueResDTO">
SELECT
ia.id AS issueApplicationId,
ia.APPLY_STATUS AS applyStatus,
ia.ISSUE_TITLE AS issueTitle,
ia.SUGGESTION AS issueSuggestion,
'' AS gridName,
'' AS groupName,
unix_timestamp( ia.CREATED_TIME ) AS publishTime,
ia.GRID_ID AS gridId,
ia.GROUP_ID AS groupId
FROM
issue_application ia
WHERE
ia.DEL_FLAG = '0'
AND ia.CREATED_BY =#{userId}
AND (
ia.APPLY_STATUS = 'under_auditing'
OR ia.APPLY_STATUS = 'rejected')
order by ia.CREATED_TIME desc
</select>
<select id="selectByTopicId" resultType="com.epmet.dto.IssueApplicationDTO">
SELECT
*
FROM issue_application
WHERE DEL_FLAG = '0'
AND TOPIC_ID = #{topicId}
ORDER BY CREATED_TIME DESC
</select>
<select id="selectTopicIdList" resultType="java.lang.String">
SELECT
topic_id
FROM
issue_application
WHERE
del_flag = '0'
AND apply_status = 'under_auditing'
<foreach collection="topicIdList" item="topicId" open="AND (" close=")" separator=" OR ">
topic_id = #{topicId}
</foreach>
</select>
<!-- 查询议题审核列表 -->
<select id="auditList" resultType="com.epmet.dto.result.AuditListResultDTO">
SELECT * FROM (
SELECT
h.CREATED_TIME,
ia.ID AS issueApplicationId,
ia.ISSUE_TITLE,
ia.SUGGESTION,
ia.APPLY_STATUS,
(CASE WHEN ia.APPLY_STATUS = 'under_auditing' THEN '待审核'
WHEN ia.APPLY_STATUS = 'rejected' THEN '已驳回'
ELSE '已驳回' END) AS applyStatusName,
ia.GRID_ID
FROM issue_application ia
LEFT JOIN issue_application_history h ON h.ISSUE_APPLICATION_ID = ia.ID AND h.DEL_FLAG = '0'
WHERE ia.DEL_FLAG = '0'
<if test='null == applyStatus or applyStatus == "" '>
AND ia.apply_status in ('rejected','under_auditing')
</if>
<if test='null != applyStatus or applyStatus != "" '>
AND ia.apply_status = #{applyStatus}
</if>
<if test='null != startTime and startTime = "" '>
AND DATE_FORMAT(h.CREATED_TIME,'%Y%m%d') <![CDATA[ >= ]]> #{startTime}
</if>
<if test='null != endTime and endTime = "" '>
AND DATE_FORMAT(h.CREATED_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
</if>
<if test='null != issueTitle and issueTitle = "" '></if>
<choose>
<when test='orgType == "agency"'>
AND ia.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</when>
<otherwise>
AND ia.GRID_ID = #{orgId}
</otherwise>
</choose>
ORDER BY h.CREATED_TIME DESC)t
GROUP BY issueApplicationId
</select>
</mapper>