update BaseMapper.page
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package com.imyeyu.api.modules.blog.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.blog.entity.Article;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
@ -15,10 +16,10 @@ import java.util.List;
|
||||
public interface ArticleMapper extends BaseMapper<Article, Long> {
|
||||
|
||||
@Override
|
||||
long count();
|
||||
long countByPage(Page page);
|
||||
|
||||
@Override
|
||||
List<Article> list(long offset, int limit);
|
||||
List<Article> listByPage(Page page);
|
||||
|
||||
long countByKeyword(String keyword);
|
||||
|
||||
|
||||
@ -58,8 +58,8 @@ public class ArticleServiceImplement extends AbstractEntityService<Article, Long
|
||||
@Override
|
||||
public PageResult<Article> page(Page page) {
|
||||
PageResult<Article> result = new PageResult<>();
|
||||
result.setList(mapper.list(page.getOffset(), page.getLimit()));
|
||||
result.setTotal(mapper.count());
|
||||
result.setList(mapper.listByPage(page));
|
||||
result.setTotal(mapper.countByPage(page));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.imyeyu.api.modules.common.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.common.entity.Comment;
|
||||
import com.imyeyu.api.modules.common.vo.comment.CommentView;
|
||||
import com.imyeyu.spring.bean.Page;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
@ -18,10 +19,10 @@ import java.util.List;
|
||||
public interface CommentMapper extends BaseMapper<Comment, Long> {
|
||||
|
||||
@Override
|
||||
long count();
|
||||
long countByPage(Page page);
|
||||
|
||||
@Override
|
||||
List<Comment> list(long offset, int limit);
|
||||
List<Comment> listByPage(Page page);
|
||||
|
||||
@Select("SELECT * FROM comment WHERE id = #{id}" + NOT_DELETE)
|
||||
Comment select(Long id);
|
||||
|
||||
@ -14,14 +14,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface IconMapper extends BaseMapper<Icon, Long> {
|
||||
|
||||
@Select("SELECT COUNT(1) FROM icon" + NOT_DELETE)
|
||||
@Override
|
||||
long count();
|
||||
|
||||
@Select("SELECT * FROM icon LIMIT #{offset}, #{limit}" + NOT_DELETE)
|
||||
@Override
|
||||
List<Icon> list(long offset, int limit);
|
||||
|
||||
@Select("SELECT * FROM icon WHERE 1 = 1" + NOT_DELETE)
|
||||
List<Icon> listAll();
|
||||
|
||||
|
||||
@ -21,10 +21,10 @@
|
||||
can_list IS TRUE
|
||||
AND deleted_at IS NULL
|
||||
</sql>
|
||||
<select id="count" resultType="long">
|
||||
<select id="countByPage" resultType="long">
|
||||
SELECT COUNT(1) <include refid="normalCondition" />
|
||||
</select>
|
||||
<select id="list" resultType="com.imyeyu.api.modules.blog.entity.Article">
|
||||
<select id="listByPage" resultType="com.imyeyu.api.modules.blog.entity.Article">
|
||||
SELECT
|
||||
<include refid="listColumn" />
|
||||
<include refid="normalCondition" />
|
||||
|
||||
Reference in New Issue
Block a user