|
|
|
<?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.IssueVoteStatisticalDao">
|
|
|
|
|
|
|
|
<resultMap type="com.epmet.entity.IssueVoteStatisticalEntity" id="issueVoteStatisticalMap">
|
|
|
|
<result property="id" column="ID"/>
|
|
|
|
<result property="issueId" column="ISSUE_ID"/>
|
|
|
|
<result property="supportCount" column="SUPPORT_COUNT"/>
|
|
|
|
<result property="oppositionCount" column="OPPOSITION_COUNT"/>
|
|
|
|
<result property="votableCount" column="VOTABLE_COUNT"/>
|
|
|
|
<result property="revision" column="REVISION"/>
|
|
|
|
<result property="delFlag" column="DEL_FLAG"/>
|
|
|
|
<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="voteCount" parameterType="com.epmet.dto.form.IssueIdFormDTO" resultType="com.epmet.dto.result.VoteResultDTO">
|
|
|
|
SELECT
|
|
|
|
support_count AS supportCount,
|
|
|
|
opposition_count AS oppositionCount
|
|
|
|
FROM
|
|
|
|
issue_vote_statistical
|
|
|
|
WHERE
|
|
|
|
issue_id = #{issueId}
|
|
|
|
AND del_flag = 0
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 校验是否投票(表决中详情——支持、反对) -->
|
|
|
|
<select id="checkVote" resultType="java.lang.String">
|
|
|
|
SELECT
|
|
|
|
attitude AS voteType
|
|
|
|
FROM
|
|
|
|
issue_vote_detail
|
|
|
|
WHERE
|
|
|
|
del_flag = 0
|
|
|
|
AND issue_id = #{issueId}
|
|
|
|
AND created_by = #{userId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 议题表决折线图 -->
|
|
|
|
<select id="votingTrend" resultType="com.epmet.dto.result.VotingTrendResultDTO">
|
|
|
|
SELECT
|
|
|
|
votable_count AS shouldVoteCount,
|
|
|
|
( support_count + opposition_count ) AS realityVoteCount,
|
|
|
|
support_count AS supportAmount,
|
|
|
|
opposition_count AS oppositionAmount
|
|
|
|
FROM
|
|
|
|
issue_vote_statistical
|
|
|
|
WHERE
|
|
|
|
del_flag = 0
|
|
|
|
AND issue_id = #{issueId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 获取折线每天的支持、反对数量 (按时间正序) -->
|
|
|
|
<select id="polyLineData" parameterType="com.epmet.dto.form.IssueIdFormDTO" resultType="com.epmet.dto.PolyLineDTO">
|
|
|
|
SELECT
|
|
|
|
UNIX_TIMESTAMP(statistical_date) AS voteDate,
|
|
|
|
support_increment AS supportIncrement,
|
|
|
|
opposition_increment AS oppositionIncrement
|
|
|
|
FROM
|
|
|
|
issue_vote_statistical_daily
|
|
|
|
WHERE
|
|
|
|
issue_id = #{issueId}
|
|
|
|
AND del_flag = 0
|
|
|
|
ORDER BY statistical_date ASC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectListByissueId" resultType="com.epmet.entity.IssueVoteStatisticalEntity">
|
|
|
|
SELECT
|
|
|
|
*
|
|
|
|
FROM
|
|
|
|
issue_vote_statistical
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
<foreach item="issueId" collection="issueIdList" separator="OR" open="AND (" close=")" index="">
|
|
|
|
issue_id = #{issueId}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 得到表决中的议题 来进行缓存与数据库的同步 -->
|
|
|
|
<select id="getVotingIssuesStatisticalForSync" resultType="com.epmet.dto.IssueVoteStatisticalDTO" >
|
|
|
|
SELECT
|
|
|
|
vote.ID,
|
|
|
|
issue.ID AS issueId,
|
|
|
|
vote.SUPPORT_COUNT,
|
|
|
|
vote.OPPOSITION_COUNT,
|
|
|
|
vote.VOTABLE_COUNT
|
|
|
|
FROM
|
|
|
|
ISSUE issue
|
|
|
|
LEFT JOIN ISSUE_VOTE_STATISTICAL vote ON issue.ID = vote.ISSUE_ID
|
|
|
|
AND vote.DEL_FLAG = '0'
|
|
|
|
WHERE
|
|
|
|
issue.DEL_FLAG = '0'
|
|
|
|
AND issue.ISSUE_STATUS = 'voting'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 通过IssueId获取 -->
|
|
|
|
<select id="selectByIssueId" resultType="com.epmet.dto.IssueVoteStatisticalDTO">
|
|
|
|
SELECT
|
|
|
|
*
|
|
|
|
FROM
|
|
|
|
ISSUE_VOTE_STATISTICAL
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = '0'
|
|
|
|
AND
|
|
|
|
ISSUE_ID = #{issueId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 得到指定Id的统计数据 -->
|
|
|
|
<select id="selectListByIds" resultType="com.epmet.dto.IssueVoteStatisticalDTO">
|
|
|
|
SELECT
|
|
|
|
ID,
|
|
|
|
ISSUE_ID,
|
|
|
|
SUPPORT_COUNT,
|
|
|
|
OPPOSITION_COUNT,
|
|
|
|
VOTABLE_COUNT
|
|
|
|
FROM
|
|
|
|
ISSUE_VOTE_STATISTICAL
|
|
|
|
WHERE
|
|
|
|
DEL_FLAG = '0'
|
|
|
|
<foreach item="issueId" collection="ids" open="AND (" separator="or" close=")" index="">
|
|
|
|
ISSUE_ID = #{issueId}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
</mapper>
|