<?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.IssueDao" >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <resultMap  type= "com.epmet.entity.IssueEntity"  id= "issueMap" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "id"  column= "ID" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "issueStatus"  column= "ISSUE_STATUS" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "sourceType"  column= "SOURCE_TYPE" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "sourceId"  column= "SOURCE_ID" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "closeReason"  column= "CLOSE_REASON" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "resolveType"  column= "RESOLVE_TYPE" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "issueTitle"  column= "ISSUE_TITLE" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "suggestion"  column= "SUGGESTION" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "customerId"  column= "CUSTOMER_ID" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "gridId"  column= "GRID_ID" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "orgIdPath"  column= "ORG_ID_PATH" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "orgId"  column= "ORG_ID" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "votingDeadline"  column= "VOTING_DEADLINE" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "decidedTime"  column= "DECIDED_TIME" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "shiftedTime"  column= "SHIFTED_TIME" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "closedTime"  column= "CLOSED_TIME" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "delFlag"  column= "DEL_FLAG" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "revision"  column= "REVISION" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "createdBy"  column= "CREATED_BY" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "createdTime"  column= "CREATED_TIME" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "updatedBy"  column= "UPDATED_BY" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "updatedTime"  column= "UPDATED_TIME" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </resultMap> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  议题详情  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "issueDetail"  parameterType= "com.epmet.dto.form.IssueDetailFormDTO"  resultType= "com.epmet.dto.result.IssueResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            source_id AS topicId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue_title AS issueTitle,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue_status AS issueStatus,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            suggestion AS issueSuggestion,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            grid_id AS gridId,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            created_by AS userId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            CREATED_TIME as shiftIssueTime
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            id = #{issueId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND del_flag = 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectIssueListByGridId"  parameterType= "com.epmet.dto.form.ShiftProjectListFromDTO"  resultType= "com.epmet.entity.IssueEntity" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            *
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND GRID_ID = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND ISSUE_STATUS = 'shift_project'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ORDER BY UPDATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        LIMIT #{pageNo},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            #{pageSize}
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  新增议题  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <insert  id= "insertOne"  useGeneratedKeys= "true"  keyColumn= "id"  keyProperty= "id"  parameterType= "com.epmet.dto.IssueDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <selectKey  keyProperty= "id"  resultType= "java.lang.String"  order= "BEFORE" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SELECT replace(uuid(),'-','') AS ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </selectKey> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        INSERT INTO issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <trim  prefix= "("  suffix= ")"  suffixOverrides= "," > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != issueStatus' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                issue_status,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != sourceType' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                source_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != sourceId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                source_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != closeReason' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                close_reason,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != resolveType' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                resolve_type,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != issueTitle' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                issue_title,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != suggestion' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                suggestion,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != customerId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                customer_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != gridId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                grid_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != orgIdPath' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                org_id_path,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != orgId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                org_id,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != votingDeadline' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                voting_deadline,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != decidedTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                decided_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != shiftedTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                shifted_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != closedTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                closed_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdBy' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                created_by,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                created_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdBy' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                updated_by,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                updated_time,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            del_flag,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            revision
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </trim> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <trim  prefix= "values ("  suffix= ")"  suffixOverrides= "," > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            <choose > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                <when  test= 'null != issueId and "" != issueId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    #{issueId},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                </when> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                <otherwise > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    #{id},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                </otherwise> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </choose> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            <if  test = 'null != issueStatus' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{issueStatus},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != sourceType' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{sourceType},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != sourceId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{sourceId},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != closeReason' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{closeReason},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != resolveType' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{resolveType},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != issueTitle' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{issueTitle},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != suggestion' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{suggestion},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != customerId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{customerId},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != gridId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{gridId},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != orgIdPath' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{orgIdPath},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != orgId' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{orgId},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != votingDeadline' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{votingDeadline},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != decidedTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{decidedTime},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != shiftedTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{shiftedTime},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != closedTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{closedTime},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdBy' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{createdBy},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{createdTime},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdBy' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{createdBy},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test = 'null != createdTime' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                #{createdTime},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            '0',
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </trim> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </insert> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <resultMap  id= "VotingIssueListResultDTOMap"  type= "com.epmet.dto.result.VotingIssueListResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <id  column= "issueId"  property= "issueId"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "issueTitle"  property= "issueTitle" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "suggestion"  property= "suggestion" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "issuePublishTime"  property= "issuePublishTime" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "sourceId"  property= "sourceId" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "sourceType"  property= "sourceType" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <collection  property= "issueImgs"  ofType= "java.lang.String" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <result  column= "url" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </collection> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </resultMap> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  查询表决中议题列表  --> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectVotingList"  parameterType= "com.epmet.dto.form.CommonIssueListFormDTO"  resultMap= "VotingIssueListResultDTOMap" > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(i.ISSUE_TITLE,'') AS issueTitle,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(i.SUGGESTION,'')AS suggestion,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            UNIX_TIMESTAMP( i.created_time ) AS issuePublishTime,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.SOURCE_ID                    AS sourceId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.SOURCE_TYPE as sourceType,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            ia.url
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            issue i
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        left join  issue_attachment  ia
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        on(i.id=ia.BUSINESS_ID and ia.del_flag='0')
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.GRID_ID = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.ISSUE_STATUS = 'voting'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ORDER BY
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.created_time DESC,ia.SORT asc
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <resultMap  id= "ClosedIssueListResultDTOMap"  type= "com.epmet.dto.result.ClosedIssueListResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <id  column= "issueId"  property= "issueId"  /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "issueTitle"  property= "issueTitle" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "solution"  property= "solution" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "issueClosedTime"  property= "issueClosedTime" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "sourceId"  property= "sourceId" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  column= "SOURCE_TYPE"  property= "sourceType" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <collection  property= "issueImgs"  ofType= "java.lang.String" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <result  column= "url" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </collection> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </resultMap> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  查询已关闭议题列表  --> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectClosedList"  parameterType= "com.epmet.dto.form.CommonIssueListFormDTO"  resultMap= "ClosedIssueListResultDTOMap" > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(i.ISSUE_TITLE,'') AS issueTitle,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(i.CLOSE_REASON,'') AS solution,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            UNIX_TIMESTAMP( i.created_time ) AS issueClosedTime,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.SOURCE_ID AS sourceId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.SOURCE_TYPE,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            ia.URL
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            issue i
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        left join issue_attachment ia
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        on(i.id=ia.BUSINESS_ID and ia.del_flag='0')
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.GRID_ID = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.ISSUE_STATUS = 'closed'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.RESOLVE_TYPE = 'resolved'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ORDER BY
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.created_time DESC,ia.sort asc
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  查询已关闭议题列表 政府端  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectClosedListGov"  parameterType= "com.epmet.dto.form.CommonIssueListFormDTO"  resultType= "com.epmet.dto.result.ClosedIssueListGovResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(ISSUE_TITLE,'') AS issueTitle,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(CLOSE_REASON,'') AS closeReason,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            UNIX_TIMESTAMP( closed_time ) AS closedTime
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND GRID_ID = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND ISSUE_STATUS = 'closed'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            created_time DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            LIMIT #{pageNo},
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            #{pageSize}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  判断某人是不是议题发起人  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "checkIssuePublisher"  resultType= "integer"  parameterType= "com.epmet.dto.form.VoteFormDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            COUNT(*) AS publisher
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            del_flag = 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND created_by = #{createdBy}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND id = #{issueId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  获取转项目或者议题关闭时间  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "operateTime"  resultType= "java.lang.String" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            DATE_FORMAT(updated_time,'%Y-%m-%d') AS updateTime
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            del_flag = 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND id = #{issueId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  生成昨日的话题统计信息  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "getIssueVotingStatistical"  resultType= "com.epmet.dto.result.IssuesToBeCountedResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        issue.ID,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        issue.ISSUE_STATUS,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        vote.ATTITUDE,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        vote.VOTE_COUNT,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        totalvote.ATTITUDE AS ATTITUDE_UP_TO_YESTERDAY,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        totalvote.VOTE_COUNT AS VOTE_COUNT_UP_TO_YESTERDAY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ISSUE issue
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        LEFT JOIN (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT ISSUE_ID ,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ATTITUDE,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        count(ATTITUDE) AS VOTE_COUNT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue_vote_detail
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        AND TO_DAYS( NOW( ) ) - TO_DAYS( CREATED_TIME ) <![CDATA[>]]>  0
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        GROUP BY ISSUE_ID , ATTITUDE
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ) totalvote ON issue.ID = totalvote.ISSUE_ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        LEFT JOIN (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT ISSUE_ID ,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ATTITUDE,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        count(ATTITUDE) AS VOTE_COUNT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue_vote_detail
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        AND TO_DAYS( NOW( ) ) - TO_DAYS( CREATED_TIME ) <![CDATA[<=]]>   1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND TO_DAYS( NOW( ) ) - TO_DAYS( CREATED_TIME )  <![CDATA[>]]>  0
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        GROUP BY ISSUE_ID , ATTITUDE
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ) vote ON issue.ID = vote.ISSUE_ID AND totalvote.ATTITUDE = vote.ATTITUDE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        issue.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        issue.ISSUE_STATUS = 'voting'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        OR (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        TO_DAYS( NOW( ) ) - TO_DAYS( issue.CLOSED_TIME ) <![CDATA[<=]]>  1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        TO_DAYS( NOW( ) ) - TO_DAYS( issue.CLOSED_TIME ) <![CDATA[>]]>  0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        OR (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        TO_DAYS( NOW( ) ) - TO_DAYS( issue.SHIFTED_TIME ) <![CDATA[<=]]>  1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        TO_DAYS( NOW( ) ) - TO_DAYS( issue.SHIFTED_TIME ) > 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        issue.ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectIssueList"  resultType= "com.epmet.entity.IssueEntity" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            *
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE del_flag = '0'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        AND customer_id = #{latestListForm.customerId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND grid_id = #{latestListForm.gridId}
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        <foreach  item= "issueId"  collection= "issueIdList"  separator= "OR"  open= "AND ("  close= ")"  index= "" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            id = #{issueId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY field(
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        id,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        <foreach  item= "issueId"  collection= "issueIdList"  separator= "," > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            #{issueId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </foreach> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LIMIT #{latestListForm.pageNo}, #{latestListForm.pageSize}
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectNewestIssueList"  resultType= "com.epmet.entity.IssueEntity" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            *
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE del_flag = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND customer_id = #{customerId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND grid_id = #{gridId}
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        AND issue_status = 'voting'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ORDER BY created_time DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LIMIT #{pageSize}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  条件查询出符合指定条件的议题ID集合 以及从昨天到现在被关闭或者转项目的议题  --> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectIssueIdsByCondition"  parameterType= "com.epmet.dto.IssueDTO"  resultType= "com.epmet.dto.IssueDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ID,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        GRID_ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ISSUE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ISSUE_STATUS = #{issueStatus}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  校验话题是否已转议题  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "checkTopicShiftIssue"  resultType= "integer"  parameterType= "com.epmet.resi.group.dto.topic.form.TopicInfoFormDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            COUNT(*) AS issueCount
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            del_flag = 0
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND source_id = #{topicId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectIssueListByTopic"  resultType= "com.epmet.entity.IssueEntity" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            *
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND GRID_ID = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND ISSUE_STATUS = 'shift_project'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY UPDATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectShiftIssueByTopic"  resultType= "com.epmet.entity.IssueEntity" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            ID,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            IFNULL(ISSUE_TITLE, '') AS issueTitle
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND SOURCE_TYPE = 'resi_topic'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <foreach  item= "topic"  collection= "topicIds"  separator= "OR"  open= "AND ("  close= ")"  index= "" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                SOURCE_ID = #{topic}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND ISSUE_STATUS = 'shift_project'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY UPDATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LIMIT #{pageNo}, #{pageSize}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectVotingListByTopic"  resultType= "com.epmet.resi.group.dto.group.result.GroupVotingListResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ID AS "issueId",
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        IFNULL(ISSUE_TITLE, '') AS "issueTitle",
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        UNIX_TIMESTAMP( CREATED_TIME ) AS "issuePublishTime",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        IFNULL(SUGGESTION, '') AS "suggestion"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND SOURCE_TYPE = 'resi_topic'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <foreach  item= "topic"  collection= "topicIds"  separator= "OR"  open= "AND ("  close= ")"  index= "" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SOURCE_ID = #{topic}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND ISSUE_STATUS = 'voting'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY CREATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LIMIT #{pageNo}, #{pageSize}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectClosedListByTopic"  resultType= "com.epmet.resi.group.dto.group.result.GroupClosedListResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ID AS "issueId",
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        IFNULL(ISSUE_TITLE, '') AS "issueTitle",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        IFNULL(CLOSE_REASON, '') AS "solution",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        UNIX_TIMESTAMP( UPDATED_TIME ) AS "issueClosedTime"
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND SOURCE_TYPE = 'resi_topic'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <foreach  item= "topic"  collection= "topicIds"  separator= "OR"  open= "AND ("  close= ")"  index= "" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SOURCE_ID = #{topic}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        AND ISSUE_STATUS = 'closed'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY UPDATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LIMIT #{pageNo}, #{pageSize}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  个人中心 - 我发起的议题列表 - 表决中  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "myPubIssuesAuditing"  resultType= "com.epmet.dto.result.MyPubIssuesAuditingResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.SUGGESTION,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.ISSUE_TITLE,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.SOURCE_ID AS topicId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.GRID_ID AS gridId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            UNIX_TIMESTAMP(i.CREATED_TIME) AS shiftIssueTime
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue i
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.ISSUE_STATUS = 'voting'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.CREATED_BY = #{userId}
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ORDER BY i.CREATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <!--  查询我发起的议题(可根据状态查询) --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectMyPubIssues"  parameterType= "map"  resultType= "com.epmet.dto.IssueDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.*,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            UNIX_TIMESTAMP(i.CLOSED_TIME) AS closedTimeStamp,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            UNIX_TIMESTAMP(i.SHIFTED_TIME) AS shiftedTimeStamp,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            m.PROJECT_ID
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue i
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        left join issue_project_relation m
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            on(i.id=m.ISSUE_ID and m.del_flag='0')
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.CREATED_BY = #{userId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <if  test = 'null != issueStatus and "" != issueStatus' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            and i.ISSUE_STATUS=#{issueStatus}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        <if  test= "issueStatus == 'shift_project'" > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            ORDER BY
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            m.CREATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        <if  test= "issueStatus == 'closed'" > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            ORDER BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                i.CLOSED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LIMIT #{pageNo}, #{pageSize}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  个人中心 - 我发表的话题列表 - 已转议题列表  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "myShiftIssueTopics"  resultType= "com.epmet.dto.result.MyShiftIssueTopicsResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            SOURCE_ID AS topicId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            UNIX_TIMESTAMP(CREATED_TIME) AS shiftIssueTime,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SUGGESTION,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            ISSUE_TITLE,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            GRID_ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND ISSUE_STATUS != 'shift_project'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND CUSTOMER_ID = #{customerId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <foreach  collection= "topicIds"  item= "topicId"  separator= " OR " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                SOURCE_ID = #{topicId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY CREATED_TIME DESC
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectIssueRedDot"  parameterType= "map"  resultType= "com.epmet.dto.result.GridVotingIssueCountResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            temp.gridId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            sum( total ) AS count
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                i.GRID_ID AS gridId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                count(*) AS total
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                issue i
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                AND i.ISSUE_STATUS = 'voting'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                <if  test= "gridIdList!=null and gridIdList.size()!=0" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    AND i.GRID_ID  in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    <foreach  collection= "gridIdList"  item= "gridId"  open= "("  close= ")"  separator= "," > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                        #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            GROUP BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                i.GRID_ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            UNION ALL
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                ia.GRID_ID AS gridId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                count(*) AS total
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                issue_application ia
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                ia.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                AND ia.APPLY_STATUS = 'under_auditing'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                <if  test= "gridIdList!=null and gridIdList.size()!=0" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    AND ia.GRID_ID in
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    <foreach  collection= "gridIdList"  item= "gridId"  open= "("  close= ")"  separator= "," > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                        #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            GROUP BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                ia.GRID_ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            ) temp
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        GROUP BY
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            temp.gridId
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectUnResolvedList"  resultType= "com.epmet.dto.result.UnResolvedResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(ISSUE_TITLE,'') AS issueTitle,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(CLOSE_REASON,'') AS solution,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            UNIX_TIMESTAMP( CLOSED_TIME ) AS closedTime,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SOURCE_ID AS sourceId
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND GRID_ID = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND ISSUE_STATUS = 'closed'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND RESOLVE_TYPE = 'unresolved'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  查询表决前50名  --> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    <select  id= "selectIssueLimit50"  resultType= "com.epmet.dto.result.ResiBuzzDTO" > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.ISSUE_TITLE AS issueTitle,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.SUGGESTION AS suggestion,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            i.CREATED_BY AS createdBy,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            (CASE WHEN i.ISSUE_STATUS = 'shift_project' THEN '已转项目'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                  WHEN i.ISSUE_STATUS = 'voting' THEN '表决中'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                  WHEN i.ISSUE_STATUS = 'closed' THEN '已关闭'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                  ELSE '表决中' END ) AS `status`,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            i.CREATED_TIME AS createdTime,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            s.SUPPORT_COUNT AS supportCount,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            s.OPPOSITION_COUNT AS oppositionCount,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            CONCAT(s.SUPPORT_COUNT + s.OPPOSITION_COUNT,'/',s.VOTABLE_COUNT) AS voteAccount
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM issue i
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        WHERE i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test= 'status != "all" ' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                AND i.ISSUE_STATUS = #{status}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test= 'orgType == "grid" ' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                AND i.GRID_ID = #{orgId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <if  test= 'orgType == "agency" ' > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								                AND i.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%')
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            </if> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  查询客户下1级分类的长度  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectOneLevelCategoryLength"  resultType= "java.lang.Integer" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT LENGTH(CATEGORY_CODE) FROM issue_project_category_dict
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND CUSTOMER_ID = #{customerId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND IS_DISABLE = 'enable'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND CATEGORY_TYPE = '1'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            LIMIT 1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  查询居民热议左侧饼图  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "resiBuzzLeftPieChart"  resultType= "com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT COUNT(t2.issueId) AS count,cd.CATEGORY_CODE,IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName, IFNULL(cd.COLOR,'#0091ed') AS color FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        (SELECT t1.issueId AS issueId,IFNULL(LEFT(ic.CATEGORY_CODE,#{length}),'') AS categoryCode FROM
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        (SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        i.ID AS issueId
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue i
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <if  test= 'orgType == "grid" ' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.GRID_ID = #{orgId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <if  test= 'orgType == "agency" ' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50)t1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LEFT JOIN issue_category ic ON (t1.issueId = ic.ISSUE_ID AND ic.DEL_FLAG = '0')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        GROUP BY t1.issueId,categoryCode)t2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t2.categoryCode AND cd.CUSTOMER_ID = #{customerId} AND cd.DEL_FLAG = '0' )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        GROUP BY cd.CATEGORY_NAME
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  查询组织下每个网格的项目数  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "getProjectCountByGrid"  resultType= "com.epmet.dto.result.ProjectDistributionAnalysisRightDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            GRID_ID AS orgId,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            COUNT(ID) AS count
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND ISSUE_STATUS = 'shift_project'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND ORG_ID = #{orgId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND DATE_FORMAT(SHIFTED_TIME,'%Y-%m-%d') >= #{startDate}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND DATE_FORMAT(SHIFTED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]>  #{endDate}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        GROUP BY GRID_ID
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  根据issueIds查询分类名  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <resultMap  id= "selectCategoryNameMaps"  type= "com.epmet.dto.result.ResiBuzzIssueCategoryDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "issueId"  column= "issueId" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <collection  property= "cn"  ofType= "java.lang.String" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <result  column= "categoryName" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </collection> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </resultMap> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectCategoryNameByIssueIds"  resultMap= "selectCategoryNameMaps" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								               ic.ISSUE_ID AS issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								               cd.CATEGORY_NAME as categoryName
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue_category ic
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,4) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE ic.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND ic.ISSUE_ID IN (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								              <foreach  collection= "issueIds"  item= "i"  separator= "," > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                  #{i}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								              </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  查询前50名的议题ID  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "resiBuzzLeftPieChartIssueIds"  resultType= "java.lang.String" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        i.ID AS issueId
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue i
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        INNER JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE i.DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        <if  test= 'status != "all" ' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.ISSUE_STATUS = #{status}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        <if  test= 'orgType == "grid" ' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.GRID_ID = #{orgId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <if  test= 'orgType == "agency" ' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            AND i.ORG_ID_PATH LIKE CONCAT('%',#{orgId},'%')
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </if> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        ORDER BY (s.SUPPORT_COUNT + s.OPPOSITION_COUNT) DESC,i.created_time DESC LIMIT 50
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "resiBuzzLeftPieChartByIssueIds"  resultType= "com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            COUNT(ic.ISSUE_ID) AS count,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            IFNULL(LEFT(ic.CATEGORY_CODE,#{length}),'') AS categoryCode,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(cd.color,'#0091ed') AS color
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue_category ic
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID)
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								            AND ic.ISSUE_ID IN (
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                <foreach  collection= "issueIds"  item= "issueId"  separator= "," > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                    #{issueId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                </foreach> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								                ) GROUP BY categoryCode
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "resiBuzzIssueCategoryByIssueIds" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								               ISSUE_ID ,
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								               IFNULL(LEFT(CATEGORY_CODE,#{length}),'') AS categoryCode
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        FROM issue_category
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND ISSUE_ID IN(
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <foreach  collection= "issueIds"  item= "issueId"  separator= "," > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            #{issueId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        GROUP BY issue_id,categoryCode
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "resiBuzzIssueCategoryNameByIssueIds" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            resultType="com.epmet.dto.result.ResiBuzzLeftPieChartResultDTO">
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        select count(t2.issueId) as count , t2.categoryCode,t2.categoryName,t2.color from
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        (<foreach  collection= "categories"  item= "c"  separator= "UNION ALL" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            select
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                t1.issueId as issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                cd.CATEGORY_CODE as categoryCode,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                IFNULL(cd.CATEGORY_NAME,'其他') AS categoryName,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								                IFNULL(cd.COLOR,'#0091ed') AS color
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            from (select #{c.issueId} as issueId,#{c.categoryCode} as categoryCode) t1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t1.categoryCode AND cd.CUSTOMER_ID = #{customerId} AND cd.DEL_FLAG = '0' )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </foreach> )t2
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								        group by t2.categoryName
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <resultMap  id= "selectCategoryNameByIssueListMap"  type= "com.epmet.dto.result.ResiBuzzIssueCategoryDTO" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <result  property= "issueId"  column= "issueId" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <collection  property= "cn"  ofType= "java.lang.String" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            <result  column= "categoryName" /> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </collection> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </resultMap> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectCategoryNameByIssueList"  resultMap= "selectCategoryNameByIssueListMap" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        <foreach  collection= "issueIds"  item= "c"  separator= "UNION ALL" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            t1.issueId AS issueId,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            IFNULL(cd.CATEGORY_NAME,'其他') as categoryName
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            FROM ( select #{c.issueId} as issueId,#{c.categoryCode} as categoryCode) t1
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = t1.categoryCode AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = #{customerId})
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        </foreach> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  查询网格中表决中的议题个数  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectVotingIssue"  resultType= "java.lang.Integer" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            COUNT(id)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE del_flag = 0
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								          and ISSUE_STATUS = 'voting'
							 
						 
					
						
							
								
							 
							
								
									
										 
								
							 
							
								 
							
								          AND grid_id = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <!--  查询网格中审核中的议题个数  --> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    <select  id= "selectAuditIssue"  resultType= "java.lang.Integer" > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        SELECT
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								            count( id )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        FROM issue_application
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								        WHERE DEL_FLAG = '0'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND APPLY_STATUS = 'under_auditing'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								          AND GRID_ID = #{gridId}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								    </select> 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
								</mapper>