From 5a8a90c095280fbd2106869ecd2bad10e01a57a6 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期四, 23 十二月 2021 18:10:22 +0800 Subject: [PATCH] 12/23 大屏修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDiscussOptionUserDAO.java | 64 ++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 11 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDiscussOptionUserDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDiscussOptionUserDAO.java index 286df72..091898f 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDiscussOptionUserDAO.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActDiscussOptionUserDAO.java @@ -1,8 +1,14 @@ package com.panzhihua.service_community.dao; +import com.panzhihua.common.model.vos.community.ComActDiscussOptionUserVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.service_community.model.dos.ComActDiscussOptionUserDO; -import org.apache.ibatis.annotations.Mapper; + +import java.util.List; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -12,14 +18,50 @@ **/ @Mapper public interface ComActDiscussOptionUserDAO extends BaseMapper<ComActDiscussOptionUserDO> { - // @Select("<script> " + -// " <where>" + -// "<if test='nameCn != null and nameCn.trim() != ""'>" + -// " </if> " + -// "<if test='nameCn != null and nameCn.trim() != ""'>" + -// " </if> " + -// "<if test='nameCn != null and nameCn.trim() != ""'>" + -// " </if> " + -// " </where>" + -// "</script>") + // @Select("<script> " + + // " <where>" + + // "<if test='nameCn != null and nameCn.trim() != ""'>" + + // " </if> " + + // "<if test='nameCn != null and nameCn.trim() != ""'>" + + // " </if> " + + // "<if test='nameCn != null and nameCn.trim() != ""'>" + + // " </if> " + + // " </where>" + + // "</script>") + @Select("SELECT \n" + "COUNT(ou.id)\n" + "FROM\n" + "com_act_discuss d\n" + + "JOIN com_act_discuss_option o ON d.id = o.discuss_id and d.id=#{id}\n" + + "JOIN com_act_discuss_option_user ou ON o.id = ou.discuss_option_id and ou.user_id=#{loginUserId}") + int selectHaveVote(@Param("id") Long id, @Param("loginUserId") Long loginUserId); + + @Select("select count(id) from com_act_discuss_option_user where discuss_option_id = #{discussOptionId} and user_id = #{userId}") + int selectHaveVotes(@Param("discussOptionId") Long discussOptionId, @Param("userId") Long userId); + + /** + * 查询用户当天当前投票栏目下已投次数 + * @param discussId 一起议主键id + * @param userId 用户id + * @return 总数 + */ + int selectVotedVotesInToday(@Param("discussId") Long discussId, @Param("userId") Long userId); + + /** + * 查询当前投票主题下的记录 最多6条用于展示 + * @param discussId 一起议主键id + * @return + */ + List<ComActDiscussOptionUserVO> selectVotedRecords(@Param("discussId") Long discussId); + + /** + * 查询当前投票主题参与人数 + * @param discussId 一起议主键id + * @return + */ + int selectVotedPersonNum(@Param("discussId") Long discussId); + + /** + * 批量插入投票记录 + * @param comActDiscussOptionUserDOList + * @return + */ + int batchInsert(@Param("comActDiscussOptionUserDOList") List<ComActDiscussOptionUserDO> comActDiscussOptionUserDOList); } -- Gitblit v1.7.1