package com.panzhihua.service_community.dao;
|
|
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;
|
|
/**
|
* @program: springcloud_k8s_panzhihuazhihuishequ
|
* @description: 一起议选项投票
|
* @author: huang.hongfa weixin hhf9596 qq 959656820
|
* @create: 2021-01-22 16:13
|
**/
|
@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("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);
|
}
|