init
This commit is contained in:
35
src/main/java/xyz/fortern/dao/NewsMapper.java
Normal file
35
src/main/java/xyz/fortern/dao/NewsMapper.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package xyz.fortern.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.One;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import xyz.fortern.pojo.News;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface NewsMapper extends BaseMapper<News> {
|
||||
//1. 分页查询动态
|
||||
|
||||
/**
|
||||
* 分页查询动态
|
||||
*
|
||||
* @param offset 偏移量
|
||||
* @param rows 查询数量
|
||||
*/
|
||||
@Select("select * from news limit #{offset}, #{rows}")
|
||||
@Results({
|
||||
@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true),
|
||||
@Result(column = "uid", property = "uid", jdbcType = JdbcType.INTEGER),
|
||||
@Result(column = "uid", property = "simpleUser", one = @One(select = "xyz.fortern.dao.UserMapper.selectSimpleInfoById")),
|
||||
@Result(column = "aid", property = "aid", jdbcType = JdbcType.INTEGER),
|
||||
@Result(column = "aid", property = "SimpleArticle", one = @One(select = "xyz.fortern.dao.ArticleMapper.selectSimpleInfoById")),
|
||||
@Result(column = "time", property = "time", jdbcType = JdbcType.DATE),
|
||||
})
|
||||
List<News> getNews(@Param("offset") int offset, @Param("rows") int rows);
|
||||
}
|
||||
Reference in New Issue
Block a user