网站地图    收藏   

主页 > 前端 > css教程 >

Mybatis 分页查询 - html/css语言栏目:html.css - 自学

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] [html]select id=getAllMateriel resultType=Materiel parameterType=Page Select *,(select count(*) from Materiel_Info)as total FROM ( select ROW_NUMBER()Over(order by MaterielC......

[html] 
<select id="getAllMateriel" resultType="Materiel" parameterType="Page"> 
    Select *,(select count(*) from Materiel_Info)as total FROM ( 
    select ROW_NUMBER()Over(order by MaterielCode desc) as rowId,* from Materiel_Info) 
    as mytable 
    <where> <if test="start !=null and end !=null"> 
            rowId between #{start} and #{end} 
            </if> 
            <if test="materielCode != null and materielCode !=''"> 
            AND materielCode like '%${materielCode}%' 
            </if> 
            <if test="materielName !=null and materielCode !=''"> 
            AND materielName like '%${materielName}%' 
            </if> 
            <if test="spec !=null and spec !=''"> 
            AND spec like '%${spec}%' 
            </if> 
        </where> 
</select> 

 <select id="getAllMateriel" resultType="Materiel" parameterType="Page">
  Select *,(select count(*) from Materiel_Info)as total FROM (
  select ROW_NUMBER()Over(order by MaterielCode desc) as rowId,* from Materiel_Info)
  as mytable
  <where> <if test="start !=null and end !=null">
    rowId between #{start} and #{end}
    </if>
    <if test="materielCode != null and materielCode !=''">
    AND materielCode like '%${materielCode}%'
    </if>
    <if test="materielName !=null and materielCode !=''">
    AND materielName like '%${materielName}%'
    </if>
    <if test="spec !=null and spec !=''">
    AND spec like '%${spec}%'
    </if>
   </where>
 </select>
XXXXMapper.xml      文件如上

 

POJO类

Materiel.java

[java] 
package com.dms.pojo; 
 
public class Materiel { 
 
    public Materiel() { 
        super(); 
    } 
 
    String MaterielCode; 
    String MaterielName; 
    String spec; 
    String unit; 
    float volume; 
    float weight; 
    String Note; 
    String GroupCode; 
 
    int total;  //总数  
 
    public String getMaterielCode() { 
        return MaterielCode; 
    } 
 
    public void setMaterielCode(String materielCode) { 
        MaterielCode = materielCode; 
    } 
 
    public String getMaterielName() { 
        return MaterielName; 
    } 
 
    public void setMaterielName(String materielName) { 
        MaterielName = materielName; 
    } 
 
    public String getSpec() { 
        return spec; 
    } 
 
    public void setSpec(String spec) { 
        this.spec = spec; 
    } 
 
    public String getUnit() { 
        return unit; 
    } 
 
    public void setUnit(String unit) { 
        this.unit = unit; 
    } 
 
    public float getVolume() { 
        return volume; 
    } 
 
    public void setVolume(float volume) { 
        this.volume = volume; 
    } 
 
    public float getWeight() { 
        return weight; 
    } 
 
    public void setWeight(float weight) { 
        this.weight = weight; 
    } 
 
    public String getNote() { 
        return Note; 
    } 
 
    public void setNote(String note) { 
        Note = note; 
    } 
 
    public String getGroupCode() { 
        return GroupCode; 
    } 
 
    public void setGroupCode(String groupCode) { 
        GroupCode = groupCode; 
    } 
 
    public int getTotal() { 
        return total; 
    } 
 
    public void setTotal(int total) { 
        this.total = total; 
    } 
 

package com.dms.pojo;

public class Materiel {

 public Materiel() {
  super();
 }

 String MaterielCode;
 String MaterielName;
 String spec;
 String unit;
 float volume;
 float weight;
 String Note;
 String GroupCode;

 int total; //总数

 public String getMaterielCode() {
  return MaterielCode;
 }

 public void setMaterielCode(String materielCode) {
  MaterielCode = materielCode;
 }

 public String getMaterielName() {
  return MaterielName;
 }

 public void setMaterielName(String materielName) {
  MaterielName = materielName;
 }

 public String getSpec() {
  return spec;
 }

 public void setSpec(String spec) {
  this.spec = spec;
 }

 public String getUnit() {
  return unit;
 }

 public void setUnit(String unit) {
  this.unit = unit;
 }

 public float getVolume() {
  return volume;
 }

 public void setVolume(float volume) {
  this.volume = volume;
 }

 public float getWeight() {
  return weight;
 }

 public void setWeight(float weight) {
  this.weight = weight;
 }

 public String getNote() {
  return Note;
 }

 public void setNote(String note) {
  Note = note;
 }

 public String getGroupCode() {
  return GroupCode;
 }

 public void setGroupCode(String groupCode) {
  GroupCode = groupCode;
 }

 public int getTotal() {
  return total;
 }

 public void setTotal(int total) {
  this.total = total;
 }

}

Page.java

[java] 
package com.dms.pojo; 
 
public class Page { 
    public Page(){ 
        super(); 
    } 
     
    String rp;  //显示条数  
    String newp;//当前页码  
    String key; //关键字  
    String fields;//数据库字段  
    int start;   //开始  
    int end;     //结束  
    String materielCode;//物料编码  
    String materielName;//物料名称  
    String spec;//规格型号  
     
    public String getRp() { 
        return rp; 
    } 
 
    public void setRp(String rp) { 
        this.rp = rp; 
    } 
 
    public String getNewp() { 
        return newp; 
    } 
 
    public void setNewp(String newp) { 
        this.newp = newp; 
    } 
 
    public String getKey() { 
        return key; 
    } 
 
    public void setKey(String key) { 
        this.key = key; 
    } 
 
    public String getFields() { 
        return fields; 
    } 
 
    public void setFields(String fields) { 
        this.fields = fields; 
    } 
 
    public int getStart() { 
        return start; 
    } 
 
    public void setStart(int start) { 
        this.start = start; 
    } 
 
    public int getEnd() { 
        return end; 
    } 
 
    public void setEnd(int end) { 
        this.end = end; 
    } 
 
    public String getMaterielCode() { 
        return materielCode; 
    } 
 
    public void setMaterielCode(String materielCode) { 
        this.materielCode = materielCode; 
    } 
 
    public String getMaterielName() { 
        return materielName; 
    } 
 
    public void setMaterielName(String materielName) { 
        this.materielName = materielName; 
    } 
 
    public String getSpec() { 
        return spec; 
    } 
 
    public void setSpec(String spec) { 
        this.spec = spec; 
    } 

package com.dms.pojo;

public class Page {
 public Page(){
  super();
 }
 
 String rp;  //显示条数
 String newp;//当前页码
 String key; //关键字
 String fields;//数据库字段
 int start;   //开始
 int end;     //结束
 String materielCode;//物料编码
 String materielName;//物料名称
 String spec;//规格型号
 
 public String getRp() {
  return rp;
 }

 public void setRp(String rp) {
  this.rp = rp;
 }

 public String getNewp() {
  return newp;
 }

 public void setNewp(String newp) {
  this.newp = newp;
 }

 public String getKey() {
  return key;
 }

 public void setKey(String key) {
  this.key = key;
 }

 public String getFields() {
  return fields;
 }

 public void setFields(String fields) {
  this.fields = fields;
 }

 public int getStart() {
  return start;
 }

 public void setStart(int start) {
  this.start = start;
 }

 public int getEnd() {
  return end;
 }

 public void setEnd(int end) {
  this.end = end;
 }

 public String getMaterielCode() {
  return materielCode;
 }

 public void setMaterielCode(String materielCode) {
  this.materielCode = materielCode;
 }

 public String getMaterielName() {
  return materielName;
 }

 public void setMaterielName(String materielName) {
  this.materielName = materielName;
 }

 public String getSpec() {
  return spec;
 }

 public void setSpec(String spec) {
  this.spec = spec;
 }
}


 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论