| | |
| | | <resultMap id="topicsResultMap" type="org.springblade.modules.discuss.entity.TopicsEntity"> |
| | | <result property="id" column="id" /> |
| | | <result property="discussContent" column="discuss_content" /> |
| | | <result property="option" column="option" /> |
| | | <result property="sort" column="sort" /> |
| | | <result property="optionContent" column="option_content" /> |
| | | <result property="optionDetail" column="option_detail" /> |
| | | <result property="number" column="number" /> |
| | | <result property="createTime" column="crete_time" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="deleteFlag" column="delete_flag" /> |
| | | <result property="publicDiscussId" column="public_discuss_id" /> |
| | | <result property="parentId" column="parent_id" /> |
| | | <result property="level" column="level" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <resultMap type="org.springblade.modules.discuss.dto.TopicsDTO" id="TopicsDTOResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="discussContent" column="discuss_content" /> |
| | | <result property="option" column="option" /> |
| | | <result property="optionRange" column="option_range" /> |
| | | <result property="sort" column="sort" /> |
| | | <result property="optionContent" column="option_content" /> |
| | | <result property="optionDetail" column="option_detail" /> |
| | |
| | | <result property="publicDiscussId" column="public_discuss_id" /> |
| | | <result property="parentId" column="parent_id" /> |
| | | <result property="level" column="level" /> |
| | | <result property="selected" column="selected" /> |
| | | <result property="articleId" column="article_id" /> |
| | | <result property="optionNumber" column="option_number" /> |
| | | <result property="mandatoryFlag" column="mandatory_flag" /> |
| | | <result property="attachment" column="attachment" /> |
| | | <result property="optionNumberMin" column="option_number_min" /> |
| | | </resultMap> |
| | | |
| | | <collection property="children" column="id" javaType="int" select="selectStlCount"> |
| | | |
| | | <resultMap type="org.springblade.modules.discuss.dto.TopicsDTO" id="TopicsDTOResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="discussContent" column="discuss_content" /> |
| | | <result property="optionRange" column="option_range" /> |
| | | <result property="sort" column="sort" /> |
| | | <result property="optionContent" column="option_content" /> |
| | | <result property="optionDetail" column="option_detail" /> |
| | | <result property="number" column="number" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="deleteFlag" column="delete_flag" /> |
| | | <result property="publicDiscussId" column="public_discuss_id" /> |
| | | <result property="parentId" column="parent_id" /> |
| | | <result property="level" column="level" /> |
| | | <result property="selected" column="selected" /> |
| | | <result property="articleId" column="article_id" /> |
| | | <result property="optionNumber" column="option_number" /> |
| | | <result property="optionNumberMin" column="option_number_min" /> |
| | | <result property="mandatoryFlag" column="mandatory_flag" /> |
| | | <result property="attachment" column="attachment" /> |
| | | <collection property="children" column="id" javaType="list" ofType="org.springblade.modules.discuss.dto.TopicsDTO" select="selectStlCount"> |
| | | </collection> |
| | | |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="selectStlCount" resultMap="TopicsDTOResult"> |
| | | <select id="selectStlCount" parameterType="int" resultType="org.springblade.modules.discuss.dto.TopicsDTO"> |
| | | <include refid="selectTopics"/> |
| | | where parent_id = #{id} |
| | | <where> |
| | | <if test="id != null "> parent_id = #{id}</if> |
| | | and delete_flag = 0 |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | |
| | | select |
| | | id, |
| | | discuss_content, |
| | | option, |
| | | option_range, |
| | | sort, |
| | | option_content, |
| | | option_detail, |
| | |
| | | delete_flag, |
| | | public_discuss_id, |
| | | parent_id, |
| | | level |
| | | level, |
| | | selected, |
| | | article_id, |
| | | option_number, |
| | | option_number_min, |
| | | mandatory_flag, |
| | | attachment |
| | | from |
| | | jczz_topics |
| | | </sql> |
| | |
| | | </select> |
| | | |
| | | <select id="selectTopicsList" parameterType="org.springblade.modules.discuss.dto.TopicsDTO" resultMap="TopicsDTOResult"> |
| | | <include refid="selectTopics"/> |
| | | SELECT |
| | | jt.id, |
| | | jt.discuss_content, |
| | | jt.option_range, |
| | | jt.sort, |
| | | jt.option_content, |
| | | jt.option_detail, |
| | | jt.number, |
| | | jt.create_time, |
| | | jt.update_time, |
| | | jt.delete_flag, |
| | | jt.public_discuss_id, |
| | | jt.parent_id, |
| | | jt.article_id, |
| | | jt.LEVEL, |
| | | jt.option_number, |
| | | jt.option_number_min, |
| | | jt.mandatory_flag, |
| | | jt.attachment, |
| | | ( SELECT |
| | | jut.selected |
| | | FROM |
| | | jczz_user_topics jut |
| | | LEFT JOIN jczz_topics jts ON jts.id = jut.topics_id |
| | | WHERE |
| | | jut.article_id = jt.article_id |
| | | AND jts.parent_id = jt.id |
| | | <if test="householdId != null "> AND jut.household_id = #{householdId}</if> |
| | | AND jut.house_code = #{houseCode} |
| | | limit 1 |
| | | ) selected |
| | | FROM |
| | | jczz_topics jt |
| | | <where> |
| | | <if test="id != null "> and id = #{id}</if> |
| | | <if test="discussContent != null and discussContent != ''"> and discuss_content = #{discussContent}</if> |
| | | <if test="option != null "> and option = #{option}</if> |
| | | <if test="sort != null "> and sort = #{sort}</if> |
| | | <if test="optionContent != null and optionContent != ''"> and option_content = #{optionContent}</if> |
| | | <if test="optionDetail != null and optionDetail != ''"> and option_detail = #{optionDetail}</if> |
| | | <if test="number != null "> and number = #{number}</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="publicDiscussId != null "> and public_discuss_id = #{publicDiscussId}</if> |
| | | <if test="id != null "> and jt.id = #{id}</if> |
| | | <if test="discussContent != null and discussContent != ''"> and jt.discuss_content = #{discussContent}</if> |
| | | <if test="optionRange != null "> and jt.option_range = #{optionRange}</if> |
| | | <if test="sort != null "> and jt.sort = #{sort}</if> |
| | | <if test="optionContent != null and optionContent != ''"> and jt.option_content = #{optionContent}</if> |
| | | <if test="optionDetail != null and optionDetail != ''"> and jt.option_detail = #{optionDetail}</if> |
| | | <if test="number != null "> and jt.number = #{number}</if> |
| | | <if test="createTime != null "> and jt.create_time = #{createTime}</if> |
| | | <if test="updateTime != null "> and jt.update_time = #{updateTime}</if> |
| | | <if test="deleteFlag != null "> and jt.delete_flag = #{deleteFlag}</if> |
| | | <if test="publicDiscussId != null "> and jt.public_discuss_id = #{publicDiscussId}</if> |
| | | <if test="parentId != null "> and jt.parent_id = #{parentId}</if> |
| | | <if test="level != null "> and jt.level = #{level}</if> |
| | | <if test="articleId != null ">and jt.article_id = #{articleId}</if> |
| | | and jt.delete_flag = 0 |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="getTopicstotalbyarticleid" resultType="org.springblade.modules.discuss.dto.TopicsDTO"> |
| | | |
| | | SELECT |
| | | jt.discuss_content, |
| | | jt.option_content, |
| | | ( SELECT count( 1 ) FROM jczz_user_topics jut WHERE jut.topics_id = jt.id ) number |
| | | FROM |
| | | jczz_topics jt |
| | | WHERE |
| | | jt.article_id = #{articleId} |
| | | AND jt.`level` = 2 |
| | | and jt.delete_flag = 0 |
| | | |
| | | </select> |
| | | |
| | | |
| | | </mapper> |