| | |
| | | <mapper namespace="org.springblade.modules.discuss.mapper.PublicDiscussMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="publicDiscussResultMap" type="org.springblade.modules.discuss.entity.PublicDiscussEntity"> |
| | | <resultMap id="publicDiscussResultMap" type="org.springblade.modules.discuss.vo.PublicDiscussVO"> |
| | | <result property="id" column="id" /> |
| | | <result property="title" column="title" /> |
| | | <result property="openFlag" column="open_flag" /> |
| | |
| | | <result property="articleId" column="article_id" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="deleteFlag" column="delete_flag" /> |
| | | <result property="deletedFlag" column="deleted_flag" /> |
| | | <result property="repeatVote" column="repeat_vote" /> |
| | | <result property="voteNumberPublic" column="vote_number_public" /> |
| | | <result property="appointUser" column="appoint_user" /> |
| | |
| | | article_id, |
| | | create_time, |
| | | update_time, |
| | | delete_flag, |
| | | deleted_flag, |
| | | repeat_vote, |
| | | vote_number_public, |
| | | appoint_user, |
| | |
| | | |
| | | |
| | | <select id="selectPublicDiscussPage" resultMap="publicDiscussResultMap"> |
| | | select * from jczz_public_discuss where deleted_flag = 0 |
| | | select id, |
| | | title, |
| | | open_flag, |
| | | number_restrictions, |
| | | vote_restrictions, |
| | | user_restrictions, |
| | | end_time, |
| | | article_id, |
| | | create_time, |
| | | update_time, |
| | | deleted_flag, |
| | | repeat_vote, |
| | | vote_number_public, |
| | | appoint_user, |
| | | user_ids, |
| | | event_type, |
| | | (SELECT count(1) FROM jczz_user_public_enroll where public_discuss_id = id) enrollCount, |
| | | (SELECT count(1) FROM jczz_user_topics where public_discuss_id = id) topsCount |
| | | from jczz_public_discuss |
| | | <where> |
| | | <if test="publicDiscuss.id != null "> and id = #{publicDiscuss.id}</if> |
| | | <if test="publicDiscuss.title != null and publicDiscuss.title != ''"> and title = #{publicDiscuss.title}</if> |
| | | <if test="publicDiscuss.openFlag != null "> and open_flag = #{publicDiscuss.openFlag}</if> |
| | | <if test="publicDiscuss.numberRestrictions != null "> and number_restrictions = #{publicDiscuss.numberRestrictions}</if> |
| | | <if test="publicDiscuss.voteRestrictions != null "> and vote_restrictions = #{publicDiscuss.voteRestrictions}</if> |
| | | <if test="publicDiscuss.userRestrictions != null "> and user_restrictions = #{publicDiscuss.userRestrictions}</if> |
| | | <if test="publicDiscuss.endTime != null "> and end_time = #{publicDiscuss.endTime}</if> |
| | | <if test="publicDiscuss.articleId != null "> and article_id = #{publicDiscuss.articleId}</if> |
| | | <if test="publicDiscuss.createTime != null "> and create_time = #{publicDiscuss.createTime}</if> |
| | | <if test="publicDiscuss.updateTime != null "> and update_time = #{publicDiscuss.updateTime}</if> |
| | | <if test="publicDiscuss.deletedFlag != null "> and deleted_flag = #{publicDiscuss.deletedFlag}</if> |
| | | <if test="publicDiscuss.repeatVote != null "> and repeat_vote = #{publicDiscuss.repeatVote}</if> |
| | | <if test="publicDiscuss.voteNumberPublic != null "> and vote_number_public = #{publicDiscuss.voteNumberPublic}</if> |
| | | <if test="publicDiscuss.appointUser != null "> and appoint_user = #{publicDiscuss.appointUser}</if> |
| | | <if test="publicDiscuss.userIds != null and publicDiscuss.userIds != ''"> and user_ids = #{publicDiscuss.userIds}</if> |
| | | <if test="publicDiscuss.eventType != null "> and event_type = #{publicDiscuss.eventType}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectPublicDiscussList" parameterType="org.springblade.modules.discuss.dto.PublicDiscussDTO" resultMap="publicDiscussResultMap"> |
| | |
| | | <if test="articleId != null "> and article_id = #{articleId}</if> |
| | | <if test="createTime != null "> and create_time = #{createTime}</if> |
| | | <if test="updateTime != null "> and update_time = #{updateTime}</if> |
| | | <if test="deleteFlag != null "> and delete_flag = #{deleteFlag}</if> |
| | | <if test="deletedFlag != null "> and deleted_flag = #{deletedFlag}</if> |
| | | <if test="repeatVote != null "> and repeat_vote = #{repeatVote}</if> |
| | | <if test="voteNumberPublic != null "> and vote_number_public = #{voteNumberPublic}</if> |
| | | <if test="appointUser != null "> and appoint_user = #{appointUser}</if> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="selectPublicDiscuss" parameterType="org.springblade.modules.discuss.vo.PublicDiscussVO" resultMap="publicDiscussResultMap"> |
| | | select |
| | | jpd.id, |
| | | jpd.title, |
| | | jpd.open_flag, |
| | | jpd.number_restrictions, |
| | | jpd.vote_restrictions, |
| | | jpd.user_restrictions, |
| | | jpd.end_time, |
| | | jpd.article_id, |
| | | jpd.create_time, |
| | | jpd.update_time, |
| | | jpd.deleted_flag, |
| | | jpd.repeat_vote, |
| | | jpd.vote_number_public, |
| | | jpd.appoint_user, |
| | | jpd.user_ids, |
| | | jpd.event_type, |
| | | jupe.user_id userId |
| | | from |
| | | jczz_public_discuss jpd LEFT JOIN jczz_user_public_enroll jupe on jupe.public_discuss_id = jpd.id |
| | | <where> |
| | | <if test="id != null "> and jpd.id = #{id}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |