EasyUi Datagrid的基础使用

来源:互联网 发布:超高腰牛仔裤淘宝 编辑:程序博客网 时间:2024/05/07 18:35

Datagride的初始化方式

方式1 :class类型创建,这个创建方式比较简单,如果在已知表格内容的情况下可以使用,还是挺漂亮的

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <table class="easyui-datagrid">    
  2.     <thead>    
  3.         <tr>    
  4.             <th data-options="field:'code'">Code</th>    
  5.             <th data-options="field:'name'">Name</th>    
  6.             <th data-options="field:'price'">Price</th>    
  7.         </tr>    
  8.     </thead>    
  9.     <tbody>    
  10.         <tr>    
  11.             <td>001</td><td>name1</td><td>2323</td>    
  12.         </tr>    
  13.         <tr>    
  14.             <td>002</td><td>name2</td><td>4612</td>    
  15.         </tr>    
  16.     </tbody>    
  17. </table>    

方式2:通过JavaScript方式创建,这种方式优势在于与后台的交互比较方便

1:生明一个Table

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <table id="dg">  
  2. </table>  

2:在Js中实现

[javascript] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. $('#dg').datagrid({     
  2.     url:'datagrid_data.json',     
  3.     columns:[[     
  4.         {field:'code',title:'Code',width:100},     
  5.         {field:'name',title:'Name',width:100},     
  6.         {field:'price',title:'Price',width:100,align:'right'}     
  7.     ]]     
  8. });   
上边的只是参考帮助文档的创建方式,下面将结合前后台对具体的内容进行实现

项目的后台使用的是SpringMvc,数据库是Mybaits

加载Url与Colum

1:前台JS

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. datagrid=$("#dg").datagrid({  
  2.             url:"/Test3/ModuleBeanController/getAll.do",//加载的URL  
  3.                 isField:"id",  
  4.             pagination:true,//显示分页  
  5.             pageSize:5,//分页大小  
  6.             pageList:[5,10,15,20],//每页的个数  
  7.             fit:true,//自动补全  
  8.             fitColumns:true,  
  9.             iconCls:"icon-save",//图标  
  10.             title:"用户管理",  
  11.             columns:[[      //每个列具体内容  
  12.                       {  
  13.                           field:'id',  
  14.                           title:'id',  
  15.                           width:100,  
  16.                      },     
  17.                       {field:'pid',title:'pid',width:100},     
  18.                       {field:'text',title:'text',width:100}     
  19.                   ]]  
  20. })  

2:后台的controller层

getAll.do

[java] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. @RequestMapping(value="/getAll")  
  2. @ResponseBody  
  3. public List<ModuleBean> getAll(String page,String rows,String text) {  
  4.   
  5.     return moduleBeanService.getAll(page,rows,text);  
  6. }  

介绍一下几个参数

page:页数

rows:每页行数

Text:在以后的通过用户名查询时使用

3:service 层

getall()

[java] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. @Override  
  2. public List<ModuleBean> getAll(String page,String rows,String text) {  
  3.     // TODO Auto-generated method stub  
  4.     page = (page==null?"1":page);  
  5.     rows = (rows==null?"5":rows);  
  6.     return modulebeanmapper.getAll(PageUtil.getRowNum(Integer.parseInt(page), Integer.parseInt(rows),text));  
  7. }  

pageUtil相关代码

[java] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. package com.sc.util;  
  2.   
  3. import java.util.HashMap;  
  4. import java.util.Map;  
  5.   
  6. public class PageUtil {  
  7.   
  8.     public static Map<String,Object> getRowNum(int curPage,int pageSize,String text)  
  9.     {  
  10.         Map<String,Object> map=new HashMap<String,Object>();  
  11.         map.put("curRow", (curPage-1)*pageSize);  
  12.         map.put("pageSize", pageSize);  
  13.         if(text!=null)  
  14.         {  
  15.         map.put("text""%"+text+"%");  
  16.         }  
  17.         else  
  18.         {  
  19.             map.put("text""%%");  
  20.         }  
  21.           
  22.               
  23.         return map;  
  24.     }  
  25. }  


4:mapper层

getall()

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <select id="getAll" resultMap="BaseResultMap" parameterType="map">  
  2.  select * from tbl_sys_module  
  3.  <if test="#{text} != '%%'">  
  4.     where TEXT like #{text,jdbcType=VARCHAR}  
  5. </if>  
  6. limit #{curRow},#{pageSize}   
  7.   
  8. </select>  

就是一个查询语句select * from 表 where Text like #{text} limit rows,page

通过map返回

我的js的全部内容

[javascript] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. var datagrid;  
  2. var rowEditor=undefined;  
  3. $(function(){  
  4.     datagrid=$("#dg").datagrid({  
  5.         url:"/Test3/ModuleBeanController/getAll.do",//加载的URL  
  6.         isField:"id",  
  7.         pagination:true,//显示分页  
  8.         pageSize:5,//分页大小  
  9.         pageList:[5,10,15,20],//每页的个数  
  10.         fit:true,//自动补全  
  11.         fitColumns:true,  
  12.         iconCls:"icon-save",//图标  
  13.         title:"用户管理",  
  14.         columns:[[      //每个列具体内容  
  15.                   {  
  16.                       field:'id',  
  17.                       title:'id',  
  18.                       width:100,  
  19.                       editor : {//是否可编辑  
  20.                             type : 'validatebox',  
  21.                             options : {//必须校验  
  22.                                 required : true  
  23.                             }  
  24.                         }  
  25.                  },     
  26.                   {field:'pid',title:'pid',width:100,editor : {  
  27.                         type : 'validatebox',  
  28.                         options : {  
  29.                             required : true  
  30.                         }  
  31.                     }},     
  32.                   {field:'text',title:'text',width:100,editor : {  
  33.                         type : 'validatebox',  
  34.                         options : {  
  35.                             required : true  
  36.                         }  
  37.                     }}     
  38.               ]],  
  39.         toolbar:[              //工具条  
  40.                 {text:"增加",iconCls:"icon-add",handler:function(){//回调函数  
  41.                     if(rowEditor==undefined)  
  42.                     {  
  43.                         datagrid.datagrid('insertRow',{//如果处于未被点击状态,在第一行开启编辑  
  44.                             index: 0,     
  45.                             row: {  
  46.                             }  
  47.                         });  
  48.                         rowEditor=0;  
  49.                         datagrid.datagrid('beginEdit',rowEditor);//没有这行,即使开启了也不编辑  
  50.                           
  51.                     }  
  52.                   
  53.   
  54.                 }},  
  55.                 {text:"删除",iconCls:"icon-remove",handler:function(){  
  56.                     var rows=datagrid.datagrid('getSelections');  
  57.             
  58.                     if(rows.length<=0)  
  59.                     {  
  60.                         $.messager.alert('警告','您没有选择','error');  
  61.                     }  
  62.                     else if(rows.length>1)  
  63.                     {  
  64.                         $.messager.alert('警告','不支持批量删除','error');  
  65.                     }  
  66.                     else  
  67.                     {  
  68.                         $.messager.confirm('确定','您确定要删除吗',function(t){  
  69.                             if(t)  
  70.                             {  
  71.                                   
  72.                                 $.ajax({  
  73.                                     url : '/Test3/ModuleBeanController/deletecustomer.do',  
  74.                                     data : rows[0],  
  75.                                     dataType : 'json',  
  76.                                     success : function(r) {  
  77.                                         if (r.success) {  
  78.                                             datagrid.datagrid('acceptChanges');  
  79.                                             $.messager.show({  
  80.                                                 msg : r.msg,  
  81.                                                 title : '成功'  
  82.                                             });  
  83.                                             editRow = undefined;  
  84.                                             datagrid.datagrid('reload');  
  85.                                         } else {  
  86.                                             /*datagrid.datagrid('rejectChanges');*/  
  87.                                             datagrid.datagrid('beginEdit', editRow);  
  88.                                             $.messager.alert('错误', r.msg, 'error');  
  89.                                         }  
  90.                                         datagrid.datagrid('unselectAll');  
  91.                                     }  
  92.                                 });  
  93.                               
  94.                             }  
  95.                         })  
  96.                     }  
  97.                       
  98.                       
  99.                 }},  
  100.                 {text:"修改",iconCls:"icon-edit",handler:function(){  
  101.                     var rows=datagrid.datagrid('getSelections');  
  102.                     if(rows.length==1)  
  103.                     {  
  104.                         if(rowEditor==undefined)  
  105.                         {  
  106.                             var index=datagrid.datagrid('getRowIndex',rows[0]);  
  107.                              rowEditor=index;  
  108.                             datagrid.datagrid('unselectAll');  
  109.                             datagrid.datagrid('beginEdit',index);  
  110.                               
  111.                         }  
  112.                     }  
  113.                 }},  
  114.                 {text:"查询",iconCls:"icon-search",handler:function(){}},  
  115.                 {text:"保存",iconCls:"icon-save",handler:function(){  
  116.                       
  117.                     datagrid.datagrid('endEdit',rowEditor);  
  118.                     rowEditor=undefined;  
  119.                 }},  
  120.                 {text:"取消编辑",iconCls:"icon-redo",handler:function(){  
  121.                     rowEditor=undefined;  
  122.                     datagrid.datagrid('rejectChanges')  
  123.                 }}  
  124.                 ],  
  125.         onAfterEdit:function(rowIndex, rowData, changes){  
  126.             var inserted = datagrid.datagrid('getChanges''inserted');  
  127.             var updated = datagrid.datagrid('getChanges''updated');  
  128.             if (inserted.length < 1 && updated.length < 1) {  
  129.                 editRow = undefined;  
  130.                 datagrid.datagrid('unselectAll');  
  131.                 return;  
  132.             }  
  133.   
  134.             var url = '';  
  135.             if (inserted.length > 0) {  
  136.                 url = '/Test3/ModuleBeanController/addcustomer.do';  
  137.             }  
  138.             if (updated.length > 0) {  
  139.                 url = '/Test3/ModuleBeanController/addcustomer.do';  
  140.             }  
  141.   
  142.             $.ajax({  
  143.                 url : url,  
  144.                 data : rowData,  
  145.                 dataType : 'json',  
  146.                 success : function(r) {  
  147.                     if (r.success) {  
  148.                         datagrid.datagrid('acceptChanges');  
  149.                         $.messager.show({  
  150.                             msg : r.msg,  
  151.                             title : '成功'  
  152.                         });  
  153.                         editRow = undefined;  
  154.                         datagrid.datagrid('reload');  
  155.                     } else {  
  156.                         /*datagrid.datagrid('rejectChanges');*/  
  157.                         datagrid.datagrid('beginEdit', editRow);  
  158.                         $.messager.alert('错误', r.msg, 'error');  
  159.                     }  
  160.                     datagrid.datagrid('unselectAll');  
  161.                 }  
  162.             });  
  163.               
  164.         },  
  165.         onDblClickCell:function(rowIndex, field, value){  
  166.             if(rowEditor==undefined)  
  167.             {  
  168.                 datagrid.datagrid('beginEdit',rowIndex);  
  169.                 rowEditor=rowIndex;  
  170.             }  
  171.               
  172.         }  
  173.     });  
  174.     $("#search").click(function(){  
  175.         datagrid.datagrid('load',{  
  176.             text:$("#text").val()  
  177.         });  
  178.   
  179.     });  
  180.       
  181. })  

2:controller层全部

[java] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. package com.sc.controller;  
  2.   
  3. import java.util.HashMap;  
  4. import java.util.List;  
  5. import java.util.Map;  
  6.   
  7. import javax.servlet.http.HttpServletRequest;  
  8.   
  9. import org.springframework.beans.factory.annotation.Autowired;  
  10. import org.springframework.stereotype.Controller;  
  11. import org.springframework.web.bind.annotation.PathVariable;  
  12. import org.springframework.web.bind.annotation.RequestMapping;  
  13. import org.springframework.web.bind.annotation.ResponseBody;  
  14.   
  15. import com.sc.myservice.ModuleBeanService;  
  16. import com.sc.po.Menu;  
  17. import com.sc.po.ModuleBean;  
  18.   
  19. @Controller  
  20. @RequestMapping("ModuleBeanController")  
  21. public class ModuleBeanController {  
  22. private ModuleBeanService moduleBeanService;  
  23.       
  24.   
  25.     public ModuleBeanService getModuleBeanService() {  
  26.         return moduleBeanService;  
  27.     }  
  28.   
  29.     @Autowired  
  30.     public void setModuleBeanService(ModuleBeanService moduleBeanService) {  
  31.         this.moduleBeanService = moduleBeanService;  
  32.     }  
  33.     @RequestMapping(value="/{id}/showModuleBean" ,params="json")  
  34.     @ResponseBody  
  35.     public ModuleBean showModuleBean(@PathVariable String id) {  
  36.         Integer key=Integer.parseInt(id);  
  37.         ModuleBean moduleBean=moduleBeanService.searchByPrimaryKey(key);  
  38.         return moduleBean;  
  39.     }  
  40.       
  41.     @RequestMapping(value="/getAll")  
  42.     @ResponseBody  
  43.     public List<ModuleBean> getAll(String page,String rows,String text) {  
  44.       
  45.         return moduleBeanService.getAll(page,rows,text);  
  46.     }  
  47.       
  48.     @RequestMapping(value="/getMenu")  
  49.     @ResponseBody  
  50.     public List<Menu> getMenu(String id) {  
  51.         if(id==null)  
  52.             return moduleBeanService.searchByPrimaryPid(-1);  
  53.         else  
  54.           return moduleBeanService.searchByPrimaryPid(Integer.parseInt(id));  
  55.     }  
  56.     @RequestMapping("/addcustomer")  
  57.     @ResponseBody  
  58.     public Map<String,Object> addCustomer(ModuleBean moduleBean) {  
  59.           
  60.         Map<String,Object> map = new HashMap<String,Object>();  
  61.         int result = moduleBeanService.save(moduleBean);  
  62.         map.put("success", result);  
  63.         return map;  
  64.     }  
  65.     @RequestMapping("/upadatacustomer")  
  66.     @ResponseBody  
  67.     public Map<String,Object> upadataCustomer(ModuleBean moduleBean) {  
  68.           
  69.         Map<String,Object> map = new HashMap<String,Object>();  
  70.         int result = moduleBeanService.updateByPrimaryKey(moduleBean);  
  71.         map.put("success", result);  
  72.         return map;  
  73.     }  
  74.     @RequestMapping("/deletecustomer")  
  75.     @ResponseBody  
  76.     public Map<String,Object> deleteCustomer(String ids) {  
  77.           
  78.         Map<String,Object> map = new HashMap<String,Object>();  
  79.         int result = moduleBeanService.deleteByPrimaryKey(Integer.parseInt(ids));  
  80.           
  81.         map.put("success", result);  
  82.           
  83.         return map;  
  84.     }  
  85.       
  86.   
  87.   
  88. }  

service层实现

[java] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. package com.sc.myservice.impl;  
  2.   
  3. import java.util.ArrayList;  
  4. import java.util.List;  
  5.   
  6. import org.springframework.beans.BeanUtils;  
  7. import org.springframework.beans.factory.annotation.Autowired;  
  8. import org.springframework.stereotype.Service;  
  9.   
  10. import com.sc.dao.ModuleBeanMapper;  
  11. import com.sc.myservice.ModuleBeanService;  
  12. import com.sc.po.Menu;  
  13. import com.sc.po.ModuleBean;  
  14. import com.sc.util.PageUtil;  
  15. @Service("moduleBeanService")  
  16. public class ModuleBeanServiceImpl implements ModuleBeanService {  
  17.     private ModuleBeanMapper modulebeanmapper;  
  18.       
  19.   
  20.     public ModuleBeanMapper getModulebeanmapper() {  
  21.         return modulebeanmapper;  
  22.     }  
  23.   
  24.     @Autowired  
  25.     public void setModulebeanmapper(ModuleBeanMapper modulebeanmapper) {  
  26.         this.modulebeanmapper = modulebeanmapper;  
  27.     }  
  28.   
  29.     @Override  
  30.     public ModuleBean searchByPrimaryKey(int kay) {  
  31.          ModuleBean moduleBean=modulebeanmapper.selectByPrimaryKey(kay);  
  32.             // TODO Auto-generated method stub  
  33.             return  moduleBean;  
  34.     }  
  35.   
  36.     @Override  
  37.     public int save(ModuleBean moduleBean) {  
  38.         // TODO Auto-generated method stub  
  39.         return modulebeanmapper.insert(moduleBean);  
  40.     }  
  41.   
  42.     @Override  
  43.     public List<ModuleBean> getAll(String page,String rows,String text) {  
  44.         // TODO Auto-generated method stub  
  45.         page = (page==null?"1":page);  
  46.         rows = (rows==null?"5":rows);  
  47.         return modulebeanmapper.getAll(PageUtil.getRowNum(Integer.parseInt(page), Integer.parseInt(rows),text));  
  48.     }  
  49.   
  50.     @Override  
  51.     public int updateByPrimaryKey(ModuleBean record) {  
  52.         // TODO Auto-generated method stub  
  53.         return modulebeanmapper.updateByPrimaryKey(record);  
  54.     }  
  55.   
  56.     @Override  
  57.     public int deleteByPrimaryKey(Integer id) {  
  58.         // TODO Auto-generated method stub  
  59.         return modulebeanmapper.deleteByPrimaryKey(id);  
  60.     }  
  61.   
  62.     @Override  
  63.     public List<Menu> searchByPrimaryPid(int pid) {  
  64.         // TODO Auto-generated method stub  
  65.         List<Menu> menulist=new ArrayList<Menu>();  
  66.         List<ModuleBean> beanlist=modulebeanmapper.selectByPrimaryPid(pid);  
  67.         if(beanlist!=null)  
  68.         {  
  69.             Menu menu=new Menu();  
  70.             for(ModuleBean b:beanlist)  
  71.             {  
  72.                 BeanUtils.copyProperties(b, menu);  
  73.                 if(b.getState()==1)  
  74.                 {  
  75.                     menu.setState("closed");  
  76.                 }  
  77.                 menulist.add(menu);  
  78.             }  
  79.               
  80.         }  
  81.         return menulist;  
  82.     }  
  83.   
  84.       
  85.       
  86.   
  87. }  

mapper层

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >  
  3. <mapper namespace="com.sc.dao.ModuleBeanMapper" >  
  4.   <resultMap id="BaseResultMap" type="com.sc.po.ModuleBean" >  
  5.     <id column="ID" property="id" jdbcType="INTEGER" />  
  6.     <result column="PID" property="pid" jdbcType="INTEGER" />  
  7.     <result column="TEXT" property="text" jdbcType="VARCHAR" />  
  8.     <result column="ICONCLS" property="iconcls" jdbcType="VARCHAR" />  
  9.     <result column="SRC" property="src" jdbcType="VARCHAR" />  
  10.     <result column="SEQ" property="seq" jdbcType="INTEGER" />  
  11.     <result column="IS_MENU" property="isMenu" jdbcType="INTEGER" />  
  12.     <result column="STATE" property="state" jdbcType="INTEGER" />  
  13.   </resultMap>  
  14.   <sql id="Base_Column_List" >  
  15.     ID, PID, TEXT, ICONCLS, SRC, SEQ, IS_MENU, STATE  
  16.   </sql>  
  17.   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >  
  18.     select   
  19.     <include refid="Base_Column_List" />  
  20.     from tbl_sys_module  
  21.     where ID = #{id,jdbcType=INTEGER}  
  22.   </select>  
  23.    <select id="selectByPrimaryPid" resultMap="BaseResultMap" parameterType="java.lang.Integer" >  
  24.     select * from tbl_sys_module  
  25.     where PID = #{pid,jdbcType=INTEGER}  
  26.   </select>  
  27.   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >  
  28.     delete from tbl_sys_module  
  29.     where ID = #{id,jdbcType=INTEGER}  
  30.   </delete>  
  31.   <insert id="insert" parameterType="com.sc.po.ModuleBean" >  
  32.     insert into tbl_sys_module (ID, PID, TEXT,   
  33.       ICONCLS, SRC, SEQ,   
  34.       IS_MENU, STATE)  
  35.     values (#{id,jdbcType=INTEGER}, #{pid,jdbcType=INTEGER}, #{text,jdbcType=VARCHAR},   
  36.       #{iconcls,jdbcType=VARCHAR}, #{src,jdbcType=VARCHAR}, #{seq,jdbcType=INTEGER},   
  37.       #{isMenu,jdbcType=INTEGER}, #{state,jdbcType=INTEGER})  
  38.   </insert>  
  39.   <insert id="insertSelective" parameterType="com.sc.po.ModuleBean" >  
  40.     insert into tbl_sys_module  
  41.     <trim prefix="(" suffix=")" suffixOverrides="," >  
  42.       <if test="id != null" >  
  43.         ID,  
  44.       </if>  
  45.       <if test="pid != null" >  
  46.         PID,  
  47.       </if>  
  48.       <if test="text != null" >  
  49.         TEXT,  
  50.       </if>  
  51.       <if test="iconcls != null" >  
  52.         ICONCLS,  
  53.       </if>  
  54.       <if test="src != null" >  
  55.         SRC,  
  56.       </if>  
  57.       <if test="seq != null" >  
  58.         SEQ,  
  59.       </if>  
  60.       <if test="isMenu != null" >  
  61.         IS_MENU,  
  62.       </if>  
  63.       <if test="state != null" >  
  64.         STATE,  
  65.       </if>  
  66.     </trim>  
  67.     <trim prefix="values (" suffix=")" suffixOverrides="," >  
  68.       <if test="id != null" >  
  69.         #{id,jdbcType=INTEGER},  
  70.       </if>  
  71.       <if test="pid != null" >  
  72.         #{pid,jdbcType=INTEGER},  
  73.       </if>  
  74.       <if test="text != null" >  
  75.         #{text,jdbcType=VARCHAR},  
  76.       </if>  
  77.       <if test="iconcls != null" >  
  78.         #{iconcls,jdbcType=VARCHAR},  
  79.       </if>  
  80.       <if test="src != null" >  
  81.         #{src,jdbcType=VARCHAR},  
  82.       </if>  
  83.       <if test="seq != null" >  
  84.         #{seq,jdbcType=INTEGER},  
  85.       </if>  
  86.       <if test="isMenu != null" >  
  87.         #{isMenu,jdbcType=INTEGER},  
  88.       </if>  
  89.       <if test="state != null" >  
  90.         #{state,jdbcType=INTEGER},  
  91.       </if>  
  92.     </trim>  
  93.   </insert>  
  94.   <update id="updateByPrimaryKeySelective" parameterType="com.sc.po.ModuleBean" >  
  95.     update tbl_sys_module  
  96.     <set >  
  97.       <if test="pid != null" >  
  98.         PID = #{pid,jdbcType=INTEGER},  
  99.       </if>  
  100.       <if test="text != null" >  
  101.         TEXT = #{text,jdbcType=VARCHAR},  
  102.       </if>  
  103.       <if test="iconcls != null" >  
  104.         ICONCLS = #{iconcls,jdbcType=VARCHAR},  
  105.       </if>  
  106.       <if test="src != null" >  
  107.         SRC = #{src,jdbcType=VARCHAR},  
  108.       </if>  
  109.       <if test="seq != null" >  
  110.         SEQ = #{seq,jdbcType=INTEGER},  
  111.       </if>  
  112.       <if test="isMenu != null" >  
  113.         IS_MENU = #{isMenu,jdbcType=INTEGER},  
  114.       </if>  
  115.       <if test="state != null" >  
  116.         STATE = #{state,jdbcType=INTEGER},  
  117.       </if>  
  118.     </set>  
  119.     where ID = #{id,jdbcType=INTEGER}  
  120.   </update>  
  121.   <update id="updateByPrimaryKey" parameterType="com.sc.po.ModuleBean" >  
  122.     update tbl_sys_module  
  123.     set PID = #{pid,jdbcType=INTEGER},  
  124.       TEXT = #{text,jdbcType=VARCHAR},  
  125.       ICONCLS = #{iconcls,jdbcType=VARCHAR},  
  126.       SRC = #{src,jdbcType=VARCHAR},  
  127.       SEQ = #{seq,jdbcType=INTEGER},  
  128.       IS_MENU = #{isMenu,jdbcType=INTEGER},  
  129.       STATE = #{state,jdbcType=INTEGER}  
  130.     where ID = #{id,jdbcType=INTEGER}  
  131.   </update>  
  132.   <select id="getAll" resultMap="BaseResultMap" parameterType="map">  
  133.      select * from tbl_sys_module  
  134.    <if test="#{text} != '%%'">  
  135.     where TEXT like #{text,jdbcType=VARCHAR}  
  136.   </if>  
  137.   limit #{curRow},#{pageSize}   
  138.    
  139.   </select>  
  140. </mapper>  


效果截图




总结:

分页的地方还是有一些bug。EasyUi还是比较好用的一款前台html利器,如果需要做很多前台数据处理,强力推荐

0 0
原创粉丝点击