[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>
The XXXXMapper. xml file is as follows:
POJO class
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; // 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; // 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; // number of lines displayed
String newp; // current page number
String key; // keyword
String fields; // database Field
Int start; // start
Int end; // end
String materielCode; // material code
String materielName; // Item Name
String spec; // specification model
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; // number of lines displayed
String newp; // current page number
String key; // keyword
String fields; // database Field
Int start; // start
Int end; // end
String materielCode; // material code
String materielName; // Item Name
String spec; // specification model
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;
}
}