until层
存放工具类信息
public class Page01 { private int totalPageCount=0;//总页数 计算 根据每页展示记录数和记录总数计算出来的 private int pageSize=3;//每页展示记录数,用户指定,通常有默认值 private int totalCount;//记录总数,数据库查询 private int currPageNo=1;//当前页码 用户指定 ,默认显示第一页 private List<TStorageRecord> tStorageRecords;//每页数据集合 数据库查询 public int getTotalPageCount() { if (totalCount%pageSize==0){ return totalCount/pageSize; }else{ return totalCount/pageSize+1; } } public void setTotalPageCount(int totalPageCount) { this.totalPageCount = totalPageCount; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public int getCurrPageNo() { return currPageNo; } public void setCurrPageNo(int currPageNo) { this.currPageNo = currPageNo; } public List<TStorageRecord> gettStorageRecords() { return tStorageRecords; } public void settStorageRecords(List<TStorageRecord> tStorageRecords) { this.tStorageRecords = tStorageRecords; } }
mappers层
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xinxi2.mapper.TStorageRecordMapper"> <insert id="add" keyProperty="id" keyColumn="id" useGeneratedKeys="true" parameterType="com.xinxi2.bean.TStorageRecord"> INSERT INTO `t_storage_record`(goodsname) VALUES (#{goodsname}) </insert> <update id="update" parameterType="com.xinxi2.bean.TStorageRecord"> update t_storage_record <set> <if test="goodsname!=null"> goodsname=#{goodsname}, </if> </set> where id=#{id} </update> <delete id="del" parameterType="com.xinxi2.bean.TStorageRecord"> delete from `t_storage_record` WHERE id=#{id} </delete> <select id="getlist" resultType="com.xinxi2.bean.TStorageRecord"> SELECT * FROM `t_storage_record` <where> <if test="goodsname!=null"> and goodsname=#{goodsname} </if> <if test="id!=null"> and id=#{id} </if> </where> </select> <select id="gettStorage" resultType="com.xinxi2.bean.TStorageRecord"> SELECT * FROM `t_storage_record` WHERE id=#{id} </select> <select id="getRoleCount" resultType="java.lang.Integer"> SELECT count(1) FROM `t_storage_record` </select> <select id="getSysRoleList" resultType="com.xinxi2.bean.TStorageRecord"> SELECT * FROM `t_storage_record` LIMIT #{num},#{pageSize} </select> </mapper>