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);
}
springboot-Mybatis简单举例
猜你喜欢
转载自blog.csdn.net/qq_43554997/article/details/104121356
今日推荐
周排行