其他分享
首页 > 其他分享> > 03BaseRoleImpl

03BaseRoleImpl

作者:互联网

 1 package edu.must.uh.impl;
 2 import java.util.List;
 3 import java.util.Map;
 4 import com.alibaba.fastjson.JSON;
 5 import edu.must.uh.bean.BaseRole;
 6 import edu.must.uh.util.BeanUtils;
 7 import edu.must.uh.util.JedisUtil;
 8 import edu.must.uh.util.MySqlUtils;
 9 import edu.must.uh.util.PageHelper;
10 import edu.must.uh.util.Tools;
11 import edu.must.uh.util.ToolsOfString;
12  
13 public class BaseRoleImpl extends BaseImpl { 
14   
15     public BaseRoleImpl() {
16         super.cashkey = "BaseRole"; 
17         super.cashListkey = "BaseRoleList "; 
18         super.keyFields ="RoleId ";
19         super.tableName ="base_role ";  
20     }
21     
22     public Integer update(BaseRole bean,String keyValue) throws Exception   { 
23         return MySqlUtils.update(tableName,bean,keyFields,keyValue);  
24     }  
25      public Integer save(BaseRole bean) throws Exception 
26      { 
27        return  MySqlUtils.save(super.tableName, bean); 
28      } 
29    public List<Map<String, Object>> GetListByCache() throws Exception 
30     { 
31     String strList=ToolsOfString.NulltoEmpty(JedisUtil.get(cashkey,cashListkey)) ; 
32     if(strList.equals("")) { 
33        String sqlString = "SELECT OrganizeId, SortCode, Description, ModifyUserId, CreateUserId, DeleteMark, EnabledMark, CreateDate, ModifyDate, RoleId, Category, CreateUserName, FullName, IsPublic, ModifyUserName, OverdueTime, EnCode FROM base_role Where DeleteMark = 0 AND EnabledMark = 1 order by SortCode"; 
34        List<Map<String, Object>> resList = MySqlUtils.getlist(sqlString); 
35        JedisUtil.set(cashkey, cashListkey, JSON.toJSONString(resList)); 
36        return  resList; 
37     }else{ 
38         List<Map<String, Object>> Ja =BeanUtils.parseJsonArrayStrToListForMaps(strList);
39      return  Ja; 
40      } 
41    }   
42  
43  
44   public List<Map<String, Object>> getList(Map<String, Object> searchcondition,String sqlcondition) throws Exception  
45     { 
46        String sqlString = "SELECT OrganizeId, SortCode, Description, ModifyUserId, CreateUserId, DeleteMark, EnabledMark, CreateDate, ModifyDate, RoleId, Category, CreateUserName, FullName, IsPublic, ModifyUserName, OverdueTime, EnCode FROM base_role  Where 1 = 1 "; 
47        sqlString = sqlString + Tools.getSQLCondition(searchcondition); 
48        sqlString = sqlString +ToolsOfString.NulltoEmpty(sqlcondition) ; 
49        sqlString = sqlString +" order by SortCode "; 
50        sqlString = sqlString + PageHelper.getLimit(_PageBean) ;
51        
52        List<Map<String, Object>> resList = MySqlUtils.getlist(sqlString); 
53        return  resList; 
54    }  
55   
56   public Integer getCountList(Map<String, Object> searchcondition,String sqlcondition) throws Exception  
57   { 
58      String sqlString = "SELECT count(*) as strcount FROM base_role  Where 1 = 1 "; 
59      sqlString = sqlString + Tools.getSQLCondition(searchcondition); 
60      sqlString = sqlString +ToolsOfString.NulltoEmpty(sqlcondition) ; 
61      List<Map<String, Object>> resList = MySqlUtils.getlist(sqlString); 
62      return  Integer.valueOf(resList.get(0).get("strcount").toString()) ; 
63  } 
64 }

 

标签:util,03BaseRoleImpl,uh,sqlString,edu,import,must
来源: https://www.cnblogs.com/chuangjie1988/p/14694465.html