12 changed files with 1249 additions and 12 deletions
@ -0,0 +1,277 @@ |
|||
<?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.elink.esua.epdc.modules.comment.dao.TopicCommentDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity" id="topicCommentMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="topicId" column="TOPIC_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="username" column="USERNAME"/> |
|||
<result property="userFace" column="USER_FACE"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="commentType" column="COMMENT_TYPE"/> |
|||
<result property="commentId" column="COMMENT_ID"/> |
|||
<result property="replyCount" column="REPLY_COUNT"/> |
|||
<result property="replyUserId" column="REPLY_USER_ID"/> |
|||
<result property="replyUsername" column="REPLY_USERNAME"/> |
|||
<result property="replyUserFace" column="REPLY_USER_FACE"/> |
|||
<result property="likeCount" column="LIKE_COUNT"/> |
|||
<result property="unLikeCount" column="UN_LIKE_COUNT"/> |
|||
<result property="shieldFlag" column="SHIELD_FLAG"/> |
|||
<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"/> |
|||
<result property="partyFlag" column="PARTY_FLAG"/> |
|||
</resultMap> |
|||
|
|||
|
|||
<update id="updateReplyCount" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic_comment |
|||
SET REPLY_COUNT = REPLY_COUNT + 1 |
|||
WHERE ID = #{commentId} |
|||
</update> |
|||
|
|||
<update id="updateApproveNumAdd" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic_comment |
|||
SET LIKE_COUNT = LIKE_COUNT + 1 |
|||
WHERE ID = #{commentId} |
|||
</update> |
|||
|
|||
|
|||
<update id="updateOpposeNumAdd" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic_comment |
|||
SET UN_LIKE_COUNT = UN_LIKE_COUNT + 1 |
|||
WHERE ID = #{commentId} |
|||
</update> |
|||
|
|||
<update id="updateApproveNumSubtract" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic_comment |
|||
SET LIKE_COUNT = LIKE_COUNT - 1 |
|||
WHERE ID = #{commentId} |
|||
</update> |
|||
|
|||
|
|||
<update id="updateOpposeNumSubtract" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic_comment |
|||
SET UN_LIKE_COUNT = UN_LIKE_COUNT - 1 |
|||
WHERE ID = #{commentId} |
|||
</update> |
|||
|
|||
|
|||
<select id="selectCountOfStatementNum" resultType="long"> |
|||
SELECT |
|||
COUNT( ID ) + |
|||
CASE |
|||
WHEN SUM( LIKE_COUNT + UN_LIKE_COUNT ) IS NULL THEN |
|||
0 ELSE SUM( LIKE_COUNT + UN_LIKE_COUNT ) |
|||
END AS statementNum |
|||
FROM |
|||
epdc_topic_comment |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND TOPIC_ID = #{topicId} |
|||
</select> |
|||
|
|||
<resultMap id="listOfCommentsMap" type="com.elink.esua.epdc.dto.topic.TopicCommentsDTO"> |
|||
<result property="commentId" column="ID"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="commentTime" column="CREATED_TIME"/> |
|||
<result property="user.userId" column="USER_ID"/> |
|||
<result property="user.userName" column="USERNAME"/> |
|||
<result property="user.userFace" column="USER_FACE"/> |
|||
<result property="user.partyFlag" column="PARTY_FLAG"/> |
|||
<result property="approveNum" column="LIKE_COUNT"/> |
|||
<result property="opposeNum" column="UN_LIKE_COUNT"/> |
|||
<result property="userLike" column="userLike"/> |
|||
<result property="userDislike" column="userDislike"/> |
|||
<result property="attitudeNum" column="attitudeNum"/> |
|||
<result property="replyComment.userName" column="replyUserName"/> |
|||
<result property="replyComment.content" column="replyContent"/> |
|||
</resultMap> |
|||
|
|||
<select id="selectListOfComments" resultMap="listOfCommentsMap"> |
|||
SELECT |
|||
t2.ID, |
|||
t2.COMMENT_ID, |
|||
t2.CONTENT, |
|||
t2.CREATED_TIME, |
|||
t2.USER_ID, |
|||
t2.USER_FACE, |
|||
t2.USERNAME, |
|||
t2.PARTY_FLAG, |
|||
t2.LIKE_COUNT, |
|||
t2.UN_LIKE_COUNT, |
|||
t2.userLike, |
|||
t2.userDislike, |
|||
t3.ID AS replyId, |
|||
t3.USERNAME AS replyUserName, |
|||
t3.CONTENT AS replyContent, |
|||
t2.attitudeNum |
|||
FROM |
|||
( |
|||
SELECT |
|||
<if test='userId != "" and userId != null'> |
|||
(ua.attitude_flag = 0) userLike, |
|||
(ua.attitude_flag = 1) userDislike, |
|||
</if> |
|||
t1.ID, |
|||
t1.COMMENT_ID, |
|||
t1.CONTENT, |
|||
t1.CREATED_TIME, |
|||
t1.USER_ID, |
|||
t1.USER_FACE, |
|||
t1.USERNAME, |
|||
t1.PARTY_FLAG, |
|||
t1.LIKE_COUNT, |
|||
t1.UN_LIKE_COUNT, |
|||
(t1.REPLY_COUNT + t1.LIKE_COUNT + t1.UN_LIKE_COUNT) AS attitudeNum |
|||
FROM |
|||
epdc_topic_comment t1 |
|||
<if test='userId != "" and userId != null'> |
|||
LEFT JOIN epdc_topic_comment_user_attitude ua ON t1.ID = ua.COMMENT_ID |
|||
AND ua.DEL_FLAG = '0' |
|||
AND ua.USER_ID = #{userId} |
|||
AND ua.UPDATED_TIME = ( |
|||
SELECT |
|||
MAX( a.updated_time ) |
|||
FROM |
|||
epdc_topic_comment_user_attitude a |
|||
WHERE |
|||
a.COMMENT_ID = ua.COMMENT_ID |
|||
AND a.user_id = ua.user_id |
|||
) |
|||
</if> |
|||
WHERE |
|||
t1.DEL_FLAG = '0' |
|||
AND t1.SHIELD_FLAG = '0' |
|||
<if test="timestamp != null and timestamp.trim() != ''"> |
|||
<![CDATA[ AND DATE_FORMAT(t1.CREATED_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> #{timestamp} |
|||
</if> |
|||
AND t1.TOPIC_ID = #{topicId} |
|||
ORDER BY |
|||
<if test='orderType == "1"'> |
|||
attitudeNum DESC, |
|||
</if> |
|||
t1.CREATED_TIME DESC |
|||
LIMIT #{pageIndex},#{pageSize} |
|||
) t2 |
|||
LEFT JOIN epdc_topic_comment t3 ON t2.COMMENT_ID = t3.ID |
|||
ORDER BY |
|||
<if test='orderType == "1"'> |
|||
attitudeNum DESC, |
|||
</if> |
|||
t2.CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<resultMap id="commentListMap" type="com.elink.esua.epdc.dto.comment.TopicCommentListDTO"> |
|||
<result property="commentId" column="ID"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="commentTime" column="CREATED_TIME"/> |
|||
<result property="shieldFlag" column="SHIELD_FLAG"/> |
|||
<result property="user.userId" column="USER_ID"/> |
|||
<result property="user.userName" column="USERNAME"/> |
|||
<result property="user.userFace" column="USER_FACE"/> |
|||
<result property="replyComment.userName" column="replyUserName"/> |
|||
<result property="replyComment.content" column="replyContent"/> |
|||
</resultMap> |
|||
<select id="selectListOfCommentsByTopicId" resultMap="commentListMap"> |
|||
SELECT |
|||
t2.ID, |
|||
t2.COMMENT_ID, |
|||
t2.CONTENT, |
|||
t2.CREATED_TIME, |
|||
t2.USER_ID, |
|||
t2.USER_FACE, |
|||
t2.USERNAME, |
|||
t2.SHIELD_FLAG, |
|||
t3.ID AS replyId, |
|||
t3.USERNAME AS replyUserName, |
|||
t3.CONTENT AS replyContent |
|||
FROM |
|||
( |
|||
SELECT |
|||
t1.ID, |
|||
t1.COMMENT_ID, |
|||
t1.CONTENT, |
|||
t1.CREATED_TIME, |
|||
t1.USER_ID, |
|||
t1.USER_FACE, |
|||
t1.USERNAME, |
|||
t1.SHIELD_FLAG |
|||
FROM |
|||
epdc_topic_comment t1 |
|||
WHERE |
|||
t1.DEL_FLAG = '0' |
|||
AND t1.TOPIC_ID = #{id} |
|||
ORDER BY |
|||
t1.CREATED_TIME DESC |
|||
) t2 |
|||
LEFT JOIN epdc_topic_comment t3 ON t2.COMMENT_ID = t3.ID |
|||
ORDER BY |
|||
t2.CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<update id="updateCommentShieldFlag"> |
|||
UPDATE epdc_topic_comment SET SHIELD_FLAG = '1' WHERE ID IN |
|||
<foreach collection="commentIds" item="commentId" index="no" open="(" |
|||
separator="," close=")"> |
|||
#{commentId} |
|||
</foreach> |
|||
</update> |
|||
|
|||
<select id="selectListCommentForEvent" resultType="com.elink.esua.epdc.dto.comment.EventCommentDTO"> |
|||
SELECT |
|||
ID, |
|||
#{eventId} AS EVENT_ID, |
|||
USER_ID, |
|||
USERNAME AS USER_NAME, |
|||
USER_FACE, |
|||
CONTENT, |
|||
COMMENT_TYPE, |
|||
COMMENT_ID, |
|||
REPLY_COUNT, |
|||
REPLY_USER_ID, |
|||
REPLY_USERNAME AS REPLY_USER_NAME, |
|||
REPLY_USER_FACE, |
|||
LIKE_COUNT, |
|||
UN_LIKE_COUNT, |
|||
SHIELD_FLAG, |
|||
DEL_FLAG, |
|||
REVISION, |
|||
CREATED_BY, |
|||
CREATED_TIME, |
|||
UPDATED_BY, |
|||
UPDATED_TIME, |
|||
PARTY_FLAG, |
|||
'0' AS SENSITIVE_FLAG |
|||
FROM |
|||
epdc_topic_comment |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND TOPIC_ID = #{topicId} |
|||
</select> |
|||
|
|||
<select id="selectListCommentAttitudeForEvent" resultType="com.elink.esua.epdc.dto.comment.EventCommentUserAttitudeDTO"> |
|||
SELECT |
|||
t1.ID, |
|||
t1.COMMENT_ID AS EVENT_COMMENT_ID, |
|||
t1.USER_ID, |
|||
t1.ATTITUDE_FLAG, |
|||
t1.DEL_FLAG, |
|||
t1.REVISION, |
|||
t1.CREATED_BY, |
|||
t1.CREATED_TIME, |
|||
t1.UPDATED_BY, |
|||
t1.UPDATED_TIME |
|||
FROM |
|||
epdc_topic_comment_user_attitude t1 |
|||
WHERE |
|||
t1.DEL_FLAG = '0' |
|||
AND t1.COMMENT_ID IN ( SELECT t2.ID FROM epdc_topic_comment t2 WHERE t2.DEL_FLAG = '0' AND t2.TOPIC_ID = #{topicId} ) |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,20 @@ |
|||
<?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.elink.esua.epdc.modules.comment.dao.TopicCommentUserAttitudeDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.comment.entity.TopicCommentUserAttitudeEntity" id="topicCommentUserAttitudeMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="commentId" column="COMMENT_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="attitudeFlag" column="ATTITUDE_FLAG"/> |
|||
<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> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,409 @@ |
|||
<?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.elink.esua.epdc.modules.group.dao.GroupDao"> |
|||
|
|||
<select id="selectListOfGroups" resultType="com.elink.esua.epdc.dto.group.GroupManagementDTO"> |
|||
SELECT |
|||
gp.ID, |
|||
gp.GROUP_NAME, |
|||
gp.GROUP_CATEGORY, |
|||
gp.CREATED_TIME, |
|||
ugp.NICKNAME, |
|||
gp.STATE |
|||
FROM |
|||
epdc_group gp |
|||
LEFT JOIN epdc_user_group ugp ON ugp.GROUP_ID = gp.ID |
|||
AND ugp.DEL_FLAG = '0' |
|||
AND ugp.LORD_FLAG = '1' |
|||
WHERE |
|||
gp.DEL_FLAG = '0' |
|||
<if test="state != null and state != ''"> |
|||
AND gp.STATE = #{state} |
|||
</if> |
|||
<if test="gridId != null and gridId != ''"> |
|||
AND (gp.GRID_ID = #{gridId} |
|||
OR find_in_set(#{gridId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="streetId != null and streetId != ''"> |
|||
AND (find_in_set(#{streetId},gp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{streetId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="communityId != null and communityId != ''"> |
|||
AND (find_in_set(#{communityId},gp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{communityId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
ORDER BY |
|||
gp.GROUP_CATEGORY, gp.CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<select id="selectListOfRepeatGroupName" resultType="long"> |
|||
SELECT COUNT(ID) amount FROM epdc_group WHERE DEL_FLAG = '0' AND GRID_ID = #{gridId} AND GROUP_NAME = #{groupName} |
|||
</select> |
|||
|
|||
<select id="selectOneOfGroupDetail" resultType="com.elink.esua.epdc.dto.group.GroupDetailDTO"> |
|||
SELECT |
|||
gp.ID, |
|||
gp.GROUP_NAME, |
|||
gp.GROUP_INTRODUCTION, |
|||
gp.CREATED_TIME, |
|||
ugp.NICKNAME |
|||
FROM |
|||
epdc_group gp |
|||
LEFT JOIN epdc_user_group ugp ON gp.ID = ugp.GROUP_ID |
|||
AND ugp.DEL_FLAG = '0' |
|||
AND ugp.LORD_FLAG = '1' |
|||
WHERE |
|||
gp.DEL_FLAG = '0' |
|||
AND gp.ID = #{id} |
|||
</select> |
|||
|
|||
<!-- <select id="selectListGroupsOfMine" resultType="com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO">--> |
|||
<!-- SELECT--> |
|||
<!-- gp.ID,--> |
|||
<!-- gp.GROUP_NAME,--> |
|||
<!-- gp.GROUP_AVATAR,--> |
|||
<!-- gp.GROUP_CATEGORY,--> |
|||
<!-- gp.STATE,--> |
|||
<!-- COUNT( DISTINCT ugp1.ID ) AS totalNum,--> |
|||
<!-- COUNT(DISTINCT ugp2.ID) AS partyMemberNum,--> |
|||
<!-- COUNT( DISTINCT ugpr.ID ) AS unreadTopicNum,--> |
|||
<!-- MAX( tp.CREATED_TIME ) AS latestTopicTime,--> |
|||
<!-- CASE--> |
|||
<!-- WHEN gp.STATE = 0 THEN--> |
|||
<!-- '网格长会尽快审核您创建的社群,请耐心等待'--> |
|||
<!-- WHEN gp.STATE = 5 THEN--> |
|||
<!-- gp.PROCESSING_OPINIONS--> |
|||
<!-- WHEN ( gp.STATE = 10 AND COUNT( DISTINCT ugp1.ID ) <![CDATA[ <= ]]> 1 AND gp.GROUP_CATEGORY = '1' AND COUNT(DISTINCT tp.ID) = 0 ) THEN--> |
|||
<!-- '您的社群审核已通过,快加好友进来吧' ELSE ''--> |
|||
<!-- END AS description--> |
|||
<!-- FROM--> |
|||
<!-- epdc_group gp--> |
|||
<!-- RIGHT JOIN epdc_user_group ugp ON gp.ID = ugp.GROUP_ID--> |
|||
<!-- AND ugp.DEL_FLAG = '0'--> |
|||
<!-- AND ugp.USER_ID = #{userId}--> |
|||
<!-- AND ugp.STATE = 10--> |
|||
<!-- LEFT JOIN epdc_user_group ugp1 ON gp.ID = ugp1.GROUP_ID--> |
|||
<!-- AND ugp1.DEL_FLAG = '0'--> |
|||
<!-- AND ugp1.STATE = 10--> |
|||
<!-- LEFT JOIN epdc_user_group ugp2 ON gp.ID = ugp2.GROUP_ID--> |
|||
<!-- AND ugp2.DEL_FLAG = '0'--> |
|||
<!-- AND ugp2.STATE = 10--> |
|||
<!-- AND ugp2.PARTY_MEMBER = '1'--> |
|||
<!-- LEFT JOIN epdc_group_topic_user_read ugpr ON gp.ID = ugpr.GROUP_ID--> |
|||
<!-- AND ugpr.DEL_FLAG = '0'--> |
|||
<!-- AND ugpr.USER_ID = #{userId}--> |
|||
<!-- AND ugpr.READ_FLAG = '0'--> |
|||
<!-- LEFT JOIN epdc_topic tp ON gp.ID = tp.GROUP_ID--> |
|||
<!-- AND tp.DEL_FLAG = '0'--> |
|||
<!-- WHERE--> |
|||
<!-- gp.DEL_FLAG = '0'--> |
|||
<!-- AND gp.GRID_ID = #{gridId}--> |
|||
<!-- <![CDATA[ AND gp.STATE <> ]]> 20--> |
|||
<!-- GROUP BY--> |
|||
<!-- gp.ID--> |
|||
<!-- ORDER BY--> |
|||
<!-- MAX( tp.CREATED_TIME ) DESC--> |
|||
<!-- </select>--> |
|||
|
|||
<select id="selectListGroupsOfMine" resultType="com.elink.esua.epdc.dto.group.result.GroupsOfMineResultDTO"> |
|||
SELECT |
|||
t.ID, |
|||
t.GROUP_NAME, |
|||
t.GROUP_AVATAR, |
|||
t.GROUP_CATEGORY, |
|||
t.STATE, |
|||
t.totalNum, |
|||
t.partyMemberNum, |
|||
COUNT( DISTINCT ugpr.ID ) AS unreadTopicNum, |
|||
MAX( tp.CREATED_TIME ) AS latestTopicTime, |
|||
CASE |
|||
|
|||
WHEN t.STATE = 0 THEN |
|||
'网格长会尽快审核您创建的社群,请耐心等待' |
|||
WHEN t.STATE = 5 THEN |
|||
t.PROCESSING_OPINIONS |
|||
WHEN ( |
|||
t.STATE = 10 |
|||
AND t.totalNum <![CDATA[ <= ]]> 1 |
|||
AND t.GROUP_CATEGORY = '1' |
|||
AND COUNT( DISTINCT tp.ID ) = 0 |
|||
) THEN |
|||
'您的社群审核已通过,快加好友进来吧' ELSE '' |
|||
END AS description |
|||
FROM |
|||
( |
|||
SELECT |
|||
gp.ID, |
|||
gp.GROUP_NAME, |
|||
gp.GROUP_AVATAR, |
|||
gp.GROUP_CATEGORY, |
|||
gp.STATE, |
|||
gp.PROCESSING_OPINIONS, |
|||
SUM( ugp.STATE = 10 ) AS totalNum, |
|||
SUM( ugp.PARTY_MEMBER = '1' ) AS partyMemberNum |
|||
FROM |
|||
epdc_group gp |
|||
LEFT JOIN epdc_user_group ugp ON ugp.GROUP_ID = gp.ID |
|||
AND ugp.DEL_FLAG = '0' |
|||
AND ugp.STATE = 10 |
|||
WHERE |
|||
gp.ID IN ( |
|||
SELECT |
|||
gp.ID |
|||
FROM |
|||
epdc_group gp |
|||
RIGHT JOIN epdc_user_group ugp ON gp.ID = ugp.GROUP_ID |
|||
AND ugp.DEL_FLAG = '0' |
|||
AND ugp.STATE = 10 |
|||
AND ugp.USER_ID = #{userId} |
|||
WHERE |
|||
gp.DEL_FLAG = '0' |
|||
AND gp.STATE <![CDATA[ AND gp.STATE <> ]]> 20 |
|||
AND gp.GRID_ID = #{gridId} |
|||
) |
|||
GROUP BY |
|||
gp.ID |
|||
) t |
|||
LEFT JOIN epdc_group_topic_user_read ugpr ON t.ID = ugpr.GROUP_ID |
|||
AND ugpr.DEL_FLAG = '0' |
|||
AND ugpr.USER_ID = #{userId} |
|||
AND ugpr.READ_FLAG = '0' |
|||
LEFT JOIN epdc_topic tp ON t.ID = tp.GROUP_ID |
|||
AND tp.DEL_FLAG = '0' |
|||
GROUP BY |
|||
t.ID |
|||
ORDER BY |
|||
latestTopicTime DESC |
|||
</select> |
|||
|
|||
<!-- <select id="selectListGroupsOfRecommend" resultType="com.elink.esua.epdc.dto.group.result.GroupsOfRecommendResultDTO">--> |
|||
<!-- SELECT--> |
|||
<!-- gp.ID,--> |
|||
<!-- gp.GROUP_NAME,--> |
|||
<!-- gp.GROUP_AVATAR,--> |
|||
<!-- COUNT( DISTINCT ugp1.ID ) AS totalNum,--> |
|||
<!-- COUNT( DISTINCT ugp2.ID ) AS partyMemberNum--> |
|||
<!-- FROM--> |
|||
<!-- epdc_group gp--> |
|||
<!-- LEFT JOIN epdc_user_group ugp1 ON gp.ID = ugp1.GROUP_ID--> |
|||
<!-- AND ugp1.DEL_FLAG = '0'--> |
|||
<!-- AND ugp1.STATE = 10--> |
|||
<!-- LEFT JOIN epdc_user_group ugp2 ON gp.ID = ugp2.GROUP_ID--> |
|||
<!-- AND ugp2.DEL_FLAG = '0'--> |
|||
<!-- AND ugp2.STATE = 10--> |
|||
<!-- AND ugp2.PARTY_MEMBER = '1'--> |
|||
<!-- LEFT JOIN epdc_topic tp ON gp.ID = tp.GROUP_ID--> |
|||
<!-- AND tp.DEL_FLAG = '0'--> |
|||
<!-- WHERE--> |
|||
<!-- gp.DEL_FLAG = '0'--> |
|||
<!-- AND gp.STATE IN ( 10, 15 )--> |
|||
<!-- AND gp.GRID_ID = #{gridId}--> |
|||
<!-- AND gp.GROUP_CATEGORY = '1'--> |
|||
<!-- AND gp.ID NOT IN ( SELECT ugp.GROUP_ID FROM epdc_user_group ugp WHERE ugp.USER_ID = #{userId} AND ugp.DEL_FLAG = '0' AND ugp.STATE = 10 )--> |
|||
<!-- GROUP BY--> |
|||
<!-- gp.ID--> |
|||
<!-- ORDER BY--> |
|||
<!-- MAX( tp.CREATED_TIME ) DESC--> |
|||
<!-- </select>--> |
|||
|
|||
<select id="selectListGroupsOfRecommend" resultType="com.elink.esua.epdc.dto.group.result.GroupsOfRecommendResultDTO"> |
|||
SELECT |
|||
gp.ID, |
|||
gp.GROUP_NAME, |
|||
gp.GROUP_AVATAR, |
|||
(SELECT COUNT(ugp1.ID) FROM epdc_user_group ugp1 WHERE gp.ID = ugp1.GROUP_ID AND ugp1.DEL_FLAG = '0' AND ugp1.STATE = 10) AS totalNum, |
|||
(SELECT COUNT(ugp2.ID) FROM epdc_user_group ugp2 WHERE gp.ID = ugp2.GROUP_ID AND ugp2.DEL_FLAG = '0' AND ugp2.STATE = 10 AND ugp2.PARTY_MEMBER = '1') AS partyMemberNum |
|||
FROM |
|||
epdc_group gp |
|||
LEFT JOIN epdc_topic tp ON gp.ID = tp.GROUP_ID |
|||
AND tp.DEL_FLAG = '0' |
|||
WHERE |
|||
gp.DEL_FLAG = '0' |
|||
AND gp.STATE IN ( 10, 15 ) |
|||
AND gp.GRID_ID = #{gridId} |
|||
AND gp.GROUP_CATEGORY = '1' |
|||
AND gp.ID NOT IN ( SELECT ugp.GROUP_ID FROM epdc_user_group ugp WHERE ugp.USER_ID = #{userId} AND ugp.DEL_FLAG = '0' AND ugp.STATE = 10 ) |
|||
GROUP BY |
|||
gp.ID |
|||
ORDER BY |
|||
MAX( tp.CREATED_TIME ) DESC |
|||
</select> |
|||
|
|||
<select id="selectOneOfGroupDetailForMobileEnd" resultType="com.elink.esua.epdc.dto.group.result.GroupDetailForMobileEndResultDTO"> |
|||
SELECT |
|||
gp.ID, |
|||
gp.GROUP_NAME, |
|||
gp.GROUP_AVATAR, |
|||
gp.GROUP_CATEGORY, |
|||
gp.GROUP_INTRODUCTION, |
|||
COUNT( DISTINCT ugp.ID ) AS totalNum, |
|||
ugp1.NICKNAME, |
|||
ugp2.LORD_FLAG, |
|||
COUNT( DISTINCT tp.ID ) AS topicNum, |
|||
COUNT( DISTINCT tp1.ID ) AS changeToIssueNum |
|||
FROM |
|||
epdc_group gp |
|||
LEFT JOIN epdc_user_group ugp ON gp.ID = ugp.GROUP_ID |
|||
AND ugp.DEL_FLAG = '0' |
|||
AND ugp.STATE = 10 |
|||
LEFT JOIN epdc_user_group ugp1 ON gp.ID = ugp1.GROUP_ID |
|||
AND ugp1.DEL_FLAG = '0' |
|||
AND ugp1.STATE = 10 |
|||
AND ugp1.LORD_FLAG = '1' |
|||
LEFT JOIN epdc_user_group ugp2 ON gp.ID = ugp2.GROUP_ID |
|||
AND ugp2.DEL_FLAG = '0' |
|||
AND ugp2.STATE = 10 |
|||
AND ugp2.USER_ID = #{userId} |
|||
LEFT JOIN epdc_topic tp ON gp.ID = tp.GROUP_ID |
|||
AND tp.DEL_FLAG = '0' |
|||
LEFT JOIN epdc_topic tp1 ON gp.ID = tp1.GROUP_ID |
|||
AND tp1.DEL_FLAG = '0' |
|||
AND (tp1.STATE = 10 OR tp1.STATE = 15) |
|||
WHERE |
|||
gp.DEL_FLAG = '0' |
|||
AND gp.ID = #{id} |
|||
</select> |
|||
|
|||
<select id="selectListOfGroupByGridId" resultType="com.elink.esua.epdc.dto.group.GroupListDTO"> |
|||
SELECT |
|||
ID AS groupId, |
|||
GROUP_NAME AS groupName |
|||
FROM |
|||
epdc_group |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND STATE IN ( 10, 15, 20 ) |
|||
AND GRID_ID = #{deptId} |
|||
</select> |
|||
|
|||
<select id="selectListOfGroupOrderByActivity" resultType="com.elink.esua.epdc.dto.group.GroupActivityDTO"> |
|||
SELECT |
|||
gp.GROUP_NAME, |
|||
gp.ALL_DEPT_NAMES |
|||
FROM |
|||
epdc_group gp |
|||
LEFT JOIN ( |
|||
SELECT |
|||
tc.GROUP_ID, |
|||
( tc.COMMENT_NUM + tc.BROWSE_NUM + SUM( tcm.LIKE_COUNT ) + SUM( tcm.UN_LIKE_COUNT ) ) AS attitudeNum |
|||
FROM |
|||
epdc_topic tc |
|||
LEFT JOIN epdc_topic_comment tcm ON tc.ID = tcm.TOPIC_ID |
|||
AND tcm.DEL_FLAG = '0' |
|||
WHERE |
|||
tc.DEL_FLAG = '0' |
|||
group by |
|||
tc.ID |
|||
) tmp ON gp.ID = tmp.GROUP_ID |
|||
WHERE |
|||
gp.DEL_FLAG = '0' |
|||
AND gp.STATE IN ( 10, 15 ) |
|||
<if test="gridId != null and gridId != ''"> |
|||
AND (gp.GRID_ID = #{gridId} |
|||
OR find_in_set(#{gridId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="streetId != null and streetId != ''"> |
|||
AND (find_in_set(#{streetId},gp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{streetId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="communityId != null and communityId != ''"> |
|||
AND (find_in_set(#{communityId},gp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{communityId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
|||
AND DATE_FORMAT( gp.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} |
|||
</if> |
|||
GROUP BY |
|||
gp.ID |
|||
ORDER BY |
|||
SUM( tmp.attitudeNum ) DESC, |
|||
gp.CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<select id="selectListOfGroupOrderByMember" resultType="com.elink.esua.epdc.dto.group.GroupMemberDTO"> |
|||
SELECT |
|||
gp.GROUP_NAME, |
|||
CASE |
|||
WHEN COUNT( up.ID ) IS NULL THEN |
|||
0 ELSE COUNT( up.ID ) END AS memberNum, |
|||
gp.ALL_DEPT_NAMES |
|||
FROM |
|||
epdc_group gp |
|||
LEFT JOIN epdc_user_group up ON gp.ID = up.GROUP_ID |
|||
AND up.DEL_FLAG = '0' |
|||
AND up.STATE = 10 |
|||
WHERE |
|||
gp.DEL_FLAG = '0' |
|||
AND gp.STATE IN ( 10, 15 ) |
|||
<if test="gridId != null and gridId != ''"> |
|||
AND (gp.GRID_ID = #{gridId} |
|||
OR find_in_set(#{gridId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="streetId != null and streetId != ''"> |
|||
AND (find_in_set(#{streetId},gp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{streetId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="communityId != null and communityId != ''"> |
|||
AND (find_in_set(#{communityId},gp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{communityId},gp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
|||
AND DATE_FORMAT( gp.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} |
|||
</if> |
|||
GROUP BY |
|||
gp.ID |
|||
ORDER BY |
|||
memberNum DESC, |
|||
gp.CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<select id="selectOnePartyGroupInfoByGridId" resultType="com.elink.esua.epdc.dto.group.GroupDTO"> |
|||
SELECT * FROM epdc_group WHERE DEL_FLAG = '0' AND GROUP_CATEGORY = '0' AND GRID_ID = #{gridId} |
|||
</select> |
|||
|
|||
<!-- 查询已经建立党员群的网格id --> |
|||
<select id="listPartyMemberGridId" resultType="java.lang.String"> |
|||
select distinct eg.GRID_ID |
|||
from epdc_group eg |
|||
where eg.DEL_FLAG='0' |
|||
and eg.GROUP_CATEGORY='0' |
|||
</select> |
|||
|
|||
<!--根据社群id,查询群主手机号--> |
|||
<select id="queryGroupUserMOBILE" resultType="java.lang.String"> |
|||
select MOBILE from |
|||
epdc_user_group |
|||
where GROUP_ID = #{groupId} |
|||
and LORD_FLAG = 1 |
|||
and DEL_FLAG = 0 |
|||
</select> |
|||
|
|||
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.group.GroupDTO"> |
|||
SELECT |
|||
ID, |
|||
PARENT_DEPT_IDS, |
|||
PARENT_DEPT_NAMES, |
|||
ALL_DEPT_IDS, |
|||
ALL_DEPT_NAMES |
|||
FROM |
|||
epdc_group |
|||
WHERE |
|||
FIND_IN_SET( #{deptId}, ALL_DEPT_IDS ) |
|||
</select> |
|||
|
|||
<update id="updateGridByDeptId"> |
|||
UPDATE epdc_group SET GRID = #{newDeptName}, UPDATED_TIME = NOW() WHERE GRID_ID = #{deptId} |
|||
</update> |
|||
|
|||
<select id="selectListOfPartyGroups" resultType="com.elink.esua.epdc.dto.group.GroupDTO"> |
|||
SELECT |
|||
ID, |
|||
ALL_DEPT_NAMES |
|||
FROM |
|||
epdc_group |
|||
WHERE |
|||
FIND_IN_SET( #{deptId}, ALL_DEPT_IDS ) |
|||
AND GROUP_CATEGORY = '0' |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,117 @@ |
|||
<?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.elink.esua.epdc.modules.group.dao.UserGroupDao"> |
|||
|
|||
<select id="selectListOfGroupUsers" resultType="com.elink.esua.epdc.dto.group.UserGroupDTO"> |
|||
SELECT |
|||
ugp.USER_ID, |
|||
ugp.NICKNAME, |
|||
ugp.LORD_FLAG, |
|||
ugp.MOBILE, |
|||
ugp.GROUP_ID, |
|||
ugp.ID |
|||
FROM |
|||
epdc_user_group ugp |
|||
WHERE |
|||
ugp.DEL_FLAG = '0' |
|||
AND ugp.GROUP_ID = #{groupId} |
|||
AND ugp.STATE = #{state} |
|||
<if test="nickname != null and nickname != ''"> |
|||
AND ugp.NICKNAME LIKE concat('%', trim(#{nickname}), '%') |
|||
</if> |
|||
<if test="mobile != null and mobile != ''"> |
|||
AND ugp.MOBILE = trim(#{mobile}) |
|||
</if> |
|||
ORDER BY |
|||
ugp.LORD_FLAG DESC, |
|||
ugp.CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<select id="selectListOfGroupUsersByState" resultType="com.elink.esua.epdc.dto.group.result.GroupUserListResultDTO"> |
|||
SELECT |
|||
ID, |
|||
NICKNAME, |
|||
USER_AVATAR, |
|||
LORD_FLAG, |
|||
CREATED_TIME, |
|||
USER_ID |
|||
FROM |
|||
epdc_user_group |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND STATE = #{state} |
|||
AND GROUP_ID = #{groupId} |
|||
ORDER BY |
|||
LORD_FLAG DESC, |
|||
<if test="state == 10"> |
|||
CONVERT(NICKNAME USING gbk) ASC, |
|||
</if> |
|||
CREATED_TIME DESC |
|||
</select> |
|||
|
|||
<select id="selectOneOfLordInfoByGroupId" resultType="com.elink.esua.epdc.dto.group.UserGroupDTO"> |
|||
SELECT |
|||
ID, |
|||
GROUP_ID, |
|||
USER_ID, |
|||
NICKNAME, |
|||
USER_AVATAR, |
|||
MOBILE, |
|||
LORD_FLAG, |
|||
PARTY_MEMBER |
|||
FROM |
|||
epdc_user_group |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND STATE = 10 |
|||
AND LORD_FLAG = '1' |
|||
AND GROUP_ID = #{groupId} |
|||
</select> |
|||
|
|||
<update id="updateMemberState"> |
|||
UPDATE epdc_user_group SET STATE = #{state} WHERE GROUP_ID = #{groupId} AND USER_ID = #{userId} AND DEL_FLAG = '0' |
|||
</update> |
|||
|
|||
<select id="selectOnOfUserInfo" resultType="com.elink.esua.epdc.dto.group.UserGroupDTO"> |
|||
SELECT * FROM epdc_user_group WHERE DEL_FLAG = '0' AND GROUP_ID = #{groupId} AND USER_ID = #{userId} |
|||
AND STATE in |
|||
<foreach item="state" collection="states" open="(" separator="," close=")"> |
|||
#{state} |
|||
</foreach> |
|||
</select> |
|||
|
|||
<select id="selectListOfGroupUserIdsByState" resultType="string"> |
|||
SELECT |
|||
USER_ID |
|||
FROM |
|||
epdc_user_group |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND GROUP_ID = #{groupId} |
|||
AND STATE IN |
|||
<foreach item="state" collection="states" open="(" separator="," close=")"> |
|||
#{state} |
|||
</foreach> |
|||
</select> |
|||
|
|||
<update id="updateGroupUsersPartyMember"> |
|||
UPDATE epdc_user_group SET PARTY_MEMBER = #{partyMember} WHERE USER_ID = #{userId} |
|||
</update> |
|||
|
|||
<select id="checkGroupOwnerExists" resultType="Integer"> |
|||
SELECT |
|||
COUNT(*) |
|||
FROM |
|||
epdc_user_group ug |
|||
WHERE |
|||
ug.LORD_FLAG = '1' |
|||
AND ug.DEL_FLAG = '0' |
|||
AND ug.GROUP_ID = #{groupId} |
|||
</select> |
|||
|
|||
<update id="updataGroupOwner"> |
|||
UPDATE epdc_user_group SET LORD_FLAG = 1 WHERE ID = #{id} |
|||
</update> |
|||
|
|||
</mapper> |
@ -0,0 +1,10 @@ |
|||
<?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.elink.esua.epdc.modules.topic.dao.GroupTopicUserReadDao"> |
|||
|
|||
<update id="updateTopicReadFlag"> |
|||
UPDATE epdc_group_topic_user_read SET READ_FLAG = #{readFlag} WHERE GROUP_ID = #{groupId} AND USER_ID = #{userId} |
|||
</update> |
|||
|
|||
</mapper> |
@ -0,0 +1,21 @@ |
|||
<?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.elink.esua.epdc.modules.topic.dao.TopicAuditRecordDao"> |
|||
|
|||
<select id="selectListOfTopicAuditRecord" resultType="com.elink.esua.epdc.dto.group.result.TopicAuditRecordResultDTO"> |
|||
SELECT |
|||
STATE, |
|||
PROCESSING_OPINIONS, |
|||
CREATED_TIME |
|||
FROM |
|||
epdc_topic_audit_record |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND TOPIC_ID = #{topicId} |
|||
ORDER BY |
|||
CREATED_TIME DESC |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,304 @@ |
|||
<?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.elink.esua.epdc.modules.topic.dao.TopicDao"> |
|||
|
|||
|
|||
<update id="updateCommentNum" parameterType="java.lang.String"> |
|||
UPDATE epdc_topic SET COMMENT_NUM = COMMENT_NUM + 1 WHERE ID = #{id} |
|||
</update> |
|||
|
|||
<resultMap id="topicDetailMap" type="com.elink.esua.epdc.dto.topic.result.TopicDetailResultDTO"> |
|||
<result property="id" column="ID"/> |
|||
<result property="topicContent" column="TOPIC_CONTENT"/> |
|||
<result property="topicAddress" column="TOPIC_ADDRESS"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="nickname" column="NICKNAME"/> |
|||
<result property="userAvatar" column="USER_FACE"/> |
|||
<result property="partyMember" column="PARTY_MEMBER"/> |
|||
<result property="browseNum" column="BROWSE_NUM"/> |
|||
<result property="groupState" column="groupState"/> |
|||
<result property="topicState" column="topicState"/> |
|||
<result property="groupId" column="groupId"/> |
|||
<collection property="images" ofType="java.lang.String"> |
|||
<result property="image" column="IMG_URL"/> |
|||
</collection> |
|||
</resultMap> |
|||
<select id="selectOneOfTopicDetailById" resultMap="topicDetailMap"> |
|||
SELECT |
|||
tp.ID, |
|||
tp.TOPIC_CONTENT, |
|||
tp.TOPIC_ADDRESS, |
|||
tp.CREATED_TIME, |
|||
tp.NICKNAME, |
|||
tp.USER_FACE, |
|||
tp.PARTY_MEMBER, |
|||
tp.BROWSE_NUM, |
|||
img.IMG_URL, |
|||
gp.ID AS groupId, |
|||
gp.STATE AS groupState, |
|||
tp.STATE AS topicState |
|||
FROM |
|||
epdc_topic tp |
|||
LEFT JOIN epdc_topic_img img ON tp.ID = img.REFERENCE_ID |
|||
AND img.DEL_FLAG = '0' |
|||
LEFT JOIN epdc_group gp ON tp.GROUP_ID = gp.ID |
|||
AND gp.DEL_FLAG = '0' |
|||
WHERE |
|||
tp.DEL_FLAG = '0' |
|||
AND tp.ID = #{id} |
|||
ORDER BY |
|||
img.IMG_URL |
|||
</select> |
|||
|
|||
<resultMap id="topicForChangeToIssueMap" type="com.elink.esua.epdc.dto.events.form.EpdcEventSubmitFormDTO"> |
|||
<result property="topicId" column="ID"/> |
|||
<result property="eventContent" column="TOPIC_CONTENT"/> |
|||
<result property="issueAddress" column="TOPIC_ADDRESS"/> |
|||
<result property="issueLatitude" column="TOPIC_LATITUDE"/> |
|||
<result property="issueLongitude" column="TOPIC_LONGITUDE"/> |
|||
<result property="allDeptIds" column="ALL_DEPT_IDS"/> |
|||
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
|||
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/> |
|||
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/> |
|||
<result property="grid" column="GRID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="userFace" column="USER_FACE"/> |
|||
<result property="nickName" column="NICKNAME"/> |
|||
<result property="isPartyMember" column="PARTY_MEMBER"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="groupId" column="GROUP_ID"/> |
|||
<result property="groupName" column="GROUP_NAME"/> |
|||
<result property="commentNum" column="COMMENT_NUM"/> |
|||
<result property="browseNum" column="BROWSE_NUM"/> |
|||
<collection property="images" ofType="java.lang.String"> |
|||
<result property="image" column="IMG_URL"/> |
|||
</collection> |
|||
</resultMap> |
|||
<select id="selectOneOfTopicForChangeToIssue" resultMap="topicForChangeToIssueMap"> |
|||
SELECT |
|||
tp.ID, |
|||
tp.TOPIC_CONTENT, |
|||
tp.TOPIC_ADDRESS, |
|||
tp.TOPIC_LATITUDE, |
|||
tp.TOPIC_LONGITUDE, |
|||
tp.GRID, |
|||
tp.GRID_ID, |
|||
tp.USER_ID, |
|||
tp.USER_FACE, |
|||
tp.NICKNAME, |
|||
tp.PARTY_MEMBER, |
|||
tp.MOBILE, |
|||
tp.GROUP_ID, |
|||
tp.GROUP_NAME, |
|||
tp.ALL_DEPT_IDS, |
|||
tp.ALL_DEPT_NAMES, |
|||
tp.PARENT_DEPT_IDS, |
|||
tp.PARENT_DEPT_NAMES, |
|||
tp.COMMENT_NUM, |
|||
tp.BROWSE_NUM, |
|||
img.IMG_URL |
|||
FROM |
|||
epdc_topic tp |
|||
LEFT JOIN epdc_topic_img img ON tp.ID = img.REFERENCE_ID |
|||
AND img.DEL_FLAG = '0' |
|||
WHERE |
|||
tp.DEL_FLAG = '0' |
|||
AND tp.ID = #{id} |
|||
</select> |
|||
|
|||
|
|||
|
|||
<resultMap id="topicListMap" type="com.elink.esua.epdc.dto.topic.result.TopicListResultDTO"> |
|||
<result property="id" column="ID"/> |
|||
<result property="topicContent" column="TOPIC_CONTENT"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="nickname" column="NICKNAME"/> |
|||
<result property="userAvatar" column="USER_FACE"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="partyMember" column="PARTY_MEMBER"/> |
|||
<result property="state" column="STATE"/> |
|||
<result property="issueId" column="ISSUE_ID"/> |
|||
<result property="itemId" column="ITEM_ID"/> |
|||
<result property="attentionNum" column="attentionNum"/> |
|||
<collection property="images" ofType="java.lang.String"> |
|||
<result property="image" column="IMG_URL"/> |
|||
</collection> |
|||
</resultMap> |
|||
<select id="selectListOfTopic" resultMap="topicListMap"> |
|||
SELECT |
|||
topic.ID, |
|||
topic.TOPIC_CONTENT, |
|||
topic.CREATED_TIME, |
|||
topic.NICKNAME, |
|||
topic.USER_FACE, |
|||
topic.USER_ID, |
|||
topic.PARTY_MEMBER, |
|||
topic.STATE, |
|||
topic.ISSUE_ID, |
|||
topic.ITEM_ID, |
|||
(topic.COMMENT_NUM + topic.BROWSE_NUM) AS attentionNum, |
|||
img.IMG_URL |
|||
FROM |
|||
epdc_topic topic |
|||
LEFT JOIN epdc_topic_img img ON topic.ID = img.REFERENCE_ID |
|||
AND img.DEL_FLAG = '0' |
|||
WHERE |
|||
topic.ID IN ( |
|||
SELECT |
|||
tmp.ID |
|||
FROM |
|||
( |
|||
SELECT |
|||
t1.ID |
|||
FROM |
|||
epdc_topic t1 |
|||
WHERE |
|||
t1.DEL_FLAG = '0' |
|||
<if test="userId != null and userId.trim() != ''"> |
|||
and t1.USER_ID = #{userId} |
|||
and t1.STATE IN (0, 20) |
|||
</if> |
|||
<if test="userId == null or userId.trim() == ''"> |
|||
AND t1.STATE <![CDATA[ <> ]]> 20 |
|||
AND t1.GROUP_ID = #{groupId} |
|||
AND t1.GRID_ID = #{gridId} |
|||
<if test="timestamp != null and timestamp.trim() != ''"> |
|||
<![CDATA[ AND DATE_FORMAT(t1.CREATED_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> #{timestamp} |
|||
</if> |
|||
<if test="topicId != null and topicId.trim() != ''"> |
|||
AND t1.ID = #{topicId} |
|||
</if> |
|||
<![CDATA[ AND DATE_FORMAT(t1.CREATED_TIME,'%Y-%m-%d %H:%i:%s') >= ]]> #{someMonthsAgo} |
|||
</if> |
|||
ORDER BY |
|||
t1.CREATED_TIME DESC |
|||
LIMIT #{pageIndex},#{pageSize} |
|||
) tmp |
|||
) |
|||
ORDER BY |
|||
topic.CREATED_TIME DESC, |
|||
img.IMG_URL |
|||
</select> |
|||
|
|||
<select id="selectListTopic" resultType="com.elink.esua.epdc.dto.topic.TopicDTO"> |
|||
SELECT |
|||
temp.ID, |
|||
temp.NICKNAME, |
|||
temp.CREATED_TIME, |
|||
temp.TOPIC_CONTENT, |
|||
temp.COMMENT_NUM, |
|||
temp.BROWSE_NUM, |
|||
( temp.BROWSE_NUM + temp.COMMENT_NUM ) AS participantsNum, |
|||
temp.STATE |
|||
FROM |
|||
epdc_topic temp |
|||
WHERE |
|||
temp.DEL_FLAG = '0' |
|||
AND temp.STATE IN ( 0, 5, 20) |
|||
<if test="associatedType != null and associatedType != ''"> |
|||
AND temp.STATE in (0,5,10,15) |
|||
</if> |
|||
<if test="streetId != null and streetId != ''"> |
|||
AND (find_in_set(#{streetId},temp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{streetId},temp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="communityId != null and communityId != ''"> |
|||
AND (find_in_set(#{communityId},temp.PARENT_DEPT_IDS) |
|||
OR find_in_set(#{communityId},temp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="gridId != null and gridId != ''"> |
|||
AND (temp.GRID_ID = #{gridId} |
|||
OR find_in_set(#{gridId},temp.ALL_DEPT_IDS)) |
|||
</if> |
|||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> |
|||
AND DATE_FORMAT( temp.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} |
|||
</if> |
|||
<if test="groupId != null and groupId != ''"> |
|||
AND temp.GROUP_ID = #{groupId} |
|||
</if> |
|||
<if test="keyword != null and keyword != ''"> |
|||
AND temp.TOPIC_CONTENT like concat('%', trim(#{keyword}), '%') |
|||
</if> |
|||
ORDER BY |
|||
<if test="orderType == 0"> |
|||
temp.CREATED_TIME DESC |
|||
</if> |
|||
<if test="orderType == 1"> |
|||
temp.BROWSE_NUM DESC |
|||
</if> |
|||
<if test="orderType == 2"> |
|||
temp.COMMENT_NUM DESC |
|||
</if> |
|||
</select> |
|||
|
|||
<resultMap id="topicDetail" type="com.elink.esua.epdc.dto.topic.TopicDetailDTO"> |
|||
<result property="nickname" column="NICKNAME"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="topicContent" column="TOPIC_CONTENT"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="topicAddress" column="TOPIC_ADDRESS"/> |
|||
<result property="topicLatitude" column="TOPIC_LATITUDE"/> |
|||
<result property="topicLongitude" column="TOPIC_LONGITUDE"/> |
|||
<result property="groupName" column="GROUP_NAME"/> |
|||
<result property="userFace" column="USER_FACE"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="commentNum" column="COMMENT_NUM"/> |
|||
<result property="browseNum" column="BROWSE_NUM"/> |
|||
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
|||
<collection property="images" ofType="java.lang.String"> |
|||
<result property="image" column="IMG_URL"/> |
|||
</collection> |
|||
</resultMap> |
|||
<select id="selectOneOfTopic" resultMap="topicDetail"> |
|||
SELECT |
|||
tp.NICKNAME, |
|||
tp.CREATED_TIME, |
|||
tp.TOPIC_CONTENT, |
|||
tp.MOBILE, |
|||
tp.TOPIC_ADDRESS, |
|||
tp.TOPIC_LATITUDE, |
|||
tp.TOPIC_LONGITUDE, |
|||
tp.GROUP_NAME, |
|||
tp.ALL_DEPT_NAMES, |
|||
img.IMG_URL, |
|||
tp.USER_FACE, |
|||
tp.GRID_ID, |
|||
tp.COMMENT_NUM, |
|||
( tp.BROWSE_NUM + tp.COMMENT_NUM ) AS participantsNum, |
|||
tp.BROWSE_NUM |
|||
FROM |
|||
epdc_topic tp |
|||
LEFT JOIN epdc_topic_img img ON tp.ID = img.REFERENCE_ID |
|||
AND img.DEL_FLAG = '0' |
|||
WHERE |
|||
tp.DEL_FLAG = '0' |
|||
AND tp.ID = #{id} |
|||
</select> |
|||
|
|||
<select id="selectListOfOrganizationInfo" resultType="com.elink.esua.epdc.dto.topic.TopicDTO"> |
|||
SELECT |
|||
ID, |
|||
PARENT_DEPT_IDS, |
|||
PARENT_DEPT_NAMES, |
|||
ALL_DEPT_IDS, |
|||
ALL_DEPT_NAMES |
|||
FROM |
|||
epdc_topic |
|||
WHERE |
|||
FIND_IN_SET( #{deptId}, ALL_DEPT_IDS ) |
|||
</select> |
|||
|
|||
<update id="updateGridByDeptId"> |
|||
UPDATE epdc_topic SET GRID = #{newDeptName} WHERE GRID_ID = #{deptId} |
|||
</update> |
|||
|
|||
<update id="updateBatchPartyGroupNameByGroupId" parameterType="com.elink.esua.epdc.dto.group.GroupDTO"> |
|||
<foreach collection="groups" item="group" index="index" open="" close="" separator=";"> |
|||
UPDATE epdc_topic SET GROUP_NAME = #{group.groupName}, UPDATED_TIME = NOW() WHERE GROUP_ID = #{group.id} |
|||
</foreach> |
|||
</update> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue