| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.community.PageComActDiscussCommentDTO; |
| | | import com.panzhihua.common.model.dtos.community.PageComActDiscussDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.community.ComActDiscussCommentVO; |
| | | import com.panzhihua.common.model.vos.community.ComActDiscussVO; |
| | | import com.panzhihua.service_community.model.dos.ComActDiscussDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | |
| | | // " </if> " + |
| | | // " </where>" + |
| | | // "</script>") |
| | | @Select("select type,name from sys_user where user_id=#{userId}") |
| | | @Select("select type,name,phone from sys_user where user_id=#{userId}") |
| | | LoginUserInfoVO selectUserByUserId(Long userId); |
| | | @Select("<script> " + |
| | | "select t.* from ("+ |
| | | "SELECT\n" + |
| | | "d.id,\n" + |
| | | "d.`discuss_subject`,\n" + |
| | | "d.type,\n" + |
| | | "COUNT( c.id ) commentNum,\n" + |
| | | "u.name userName,\n" + |
| | | "d.create_at \n" + |
| | | "FROM\n" + |
| | | "com_act_discuss d\n" + |
| | | "JOIN sys_user u ON d.user_id = u.user_id\n" + |
| | | "LEFT JOIN com_act_discuss_comment c ON d.id = c.discuss_id \n" + |
| | | " where d.community_id=#{pageComActDiscussDTO.communityId}" + |
| | | "<if test='pageComActDiscussDTO.subject != null and pageComActDiscussDTO.subject.trim() != ""'>" + |
| | | " and d.`discuss_subject` LIKE concat( #{pageComActDiscussDTO.subject}, '%' ) \n" + |
| | | " </if> " + |
| | | "<if test='pageComActDiscussDTO.begin != null '>" + |
| | | "AND d.create_at BETWEEN #{pageComActDiscussDTO.begin} \n" + |
| | | "AND #{pageComActDiscussDTO.end} \n" + |
| | | " </if> " + |
| | | "GROUP BY\n" + |
| | | "d.id" + |
| | | ")t order by t.commentNum desc ,t.create_at desc "+ |
| | | "</script>") |
| | | IPage<ComActDiscussVO> pageDiscuss(Page page, @Param("pageComActDiscussDTO") PageComActDiscussDTO pageComActDiscussDTO); |
| | | |
| | | @Select("<script> " + |
| | | "select * from ("+ |
| | | "SELECT\n" + |
| | | "u.`name` userName,\n" + |
| | | "u.phone,\n" + |
| | | "c.`comment`,\n" + |
| | | "COUNT( cu.id ) num,\n" + |
| | | "c.create_at,\n" + |
| | | "c.id \n" + |
| | | "FROM\n" + |
| | | "com_act_discuss_comment c\n" + |
| | | "JOIN sys_user u ON c.user_id = u.user_id \n" + |
| | | "<if test='pageComActDiscussCommentDTO.name != null and pageComActDiscussCommentDTO.name.trim() != ""'>" + |
| | | "AND u.`name` LIKE concat( #{pageComActDiscussCommentDTO.name}, '%' ) \n" + |
| | | " </if> " + |
| | | "<if test='pageComActDiscussCommentDTO.account != null and pageComActDiscussCommentDTO.account.trim() != ""'>" + |
| | | "AND u.phone LIKE concat( #{pageComActDiscussCommentDTO.account}, '%' )\n" + |
| | | " </if> " + |
| | | "LEFT JOIN com_act_discuss_comment_user cu ON c.id = cu.disscuss_comment_id \n" + |
| | | " <where>" + |
| | | "<if test='pageComActDiscussCommentDTO.comment != null and pageComActDiscussCommentDTO.comment.trim() != ""'>" + |
| | | "c.`comment` LIKE concat( '%', #{pageComActDiscussCommentDTO.comment" + |
| | | "}, '%' ) \n" + |
| | | " </if> " + |
| | | " </where>" + |
| | | "GROUP BY\n" + |
| | | "c.id\n" + |
| | | ")t order by num desc ,t.create_at desc"+ |
| | | "</script>") |
| | | IPage<ComActDiscussCommentVO> pageDiscussComment(Page page, @Param("pageComActDiscussCommentDTO")PageComActDiscussCommentDTO pageComActDiscussCommentDTO); |
| | | } |