美文网首页
mybatis generator selectByExampl

mybatis generator selectByExampl

作者: torres9gogogo | 来源:发表于2018-07-27 11:45 被阅读68次

    1、<select id="selectByExample" 添加

          <if test="pageIndex != null and pageSize != null and pageSize != 0">
              limit #{pageIndex},#{pageSize}
          </if>
    

    2、generator 生成的class ***Example 中添加

       private Integer pageIndex;
       private Integer pageSize;
        public Integer getPageIndex() {
            return pageIndex;
        }
        public void setPageIndex(Integer pageIndex) {
            this.pageIndex = pageIndex;
        }
        public Integer getPageSize() {
            return pageSize;
        }
        public void setPageSize(Integer pageSize) {
            this.pageSize = pageSize;
        }
    

    3、DAO层实现层 *DaoImpl implements *Dao 中方法 set pageIndex/pageSize

        public List<*> selectMaintainInfo(MaintainConfigBean request, Integer pageIndex,Integer pageSize) {
           Example example = new Example();
            example.setPageIndex(pageIndex);
            example.setPageSize(pageSize);
    

    相关文章

      网友评论

          本文标题:mybatis generator selectByExampl

          本文链接:https://www.haomeiwen.com/subject/rsbwmftx.html