package cn.zh.community.mapper;
import cn.zh.community.dto.QuestionDTO;
import cn.zh.community.model.Question;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
* @Author: zhanghuan
* @Date: 2019/10/12 09:59
* @Description:
*/
@Mapper
public interface QuestionMapper {
@Insert("insert into question (title,description,gmt_create,gmt_modified,creator,tag) values (#{title},#{description},#{gmtCreate},#{gmtModified},#{creator},#{tag})")
void create(Question question);
@Select("Select *from question limit #{offset},#{size}")
List<Question> list(@Param(value = "offset") Integer offset, @Param(value = "size") Integer size);
@Select("select count(1) from question")
Integer count();
@Select("Select *from question where creator = #{userId} limit #{offset},#{size}")
List<Question> listByUserId(@Param(value = "userId") Integer userId, @Param(value = "offset") Integer offset, @Param(value = "size") Integer size);
@Select("select count(1) from question where creator = #{userId}")
Integer countByUserId(@Param(value = "userId") Integer userId);
@Select("select *from question where id = #{id}")
Question getById(@Param("id") Integer id);
@Update("update question set title = #{title}, description = #{description},gmt_modified = #{gmtModified},tag = #{tag} where id = #{id}")
void update(Question question);
}
ITHERS 发布了92 篇原创文章 · 获赞 193 · 访问量 2万+ 私信 关注