作者 zhangFan

新增redis设置

1 package com.tianbo.warehouse.security.handel; 1 package com.tianbo.warehouse.security.handel;
2 2
  3 +import com.alibaba.fastjson.JSON;
3 import com.fasterxml.jackson.databind.ObjectMapper; 4 import com.fasterxml.jackson.databind.ObjectMapper;
4 import com.tianbo.warehouse.bean.AuthSuccessResponse; 5 import com.tianbo.warehouse.bean.AuthSuccessResponse;
5 import com.tianbo.warehouse.model.USERS; 6 import com.tianbo.warehouse.model.USERS;
  7 +import com.tianbo.warehouse.security.config.SecurityProperties;
6 import com.tianbo.warehouse.security.filter.JwtTokenUtil; 8 import com.tianbo.warehouse.security.filter.JwtTokenUtil;
7 import com.tianbo.warehouse.security.model.LoginType; 9 import com.tianbo.warehouse.security.model.LoginType;
8 import com.tianbo.warehouse.service.PermissionService; 10 import com.tianbo.warehouse.service.PermissionService;
  11 +import com.tianbo.warehouse.util.RedisUtils;
9 import org.apache.commons.logging.Log; 12 import org.apache.commons.logging.Log;
10 import org.apache.commons.logging.LogFactory; 13 import org.apache.commons.logging.LogFactory;
11 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
12 -import com.tianbo.warehouse.security.config.SecurityProperties;  
13 import org.springframework.beans.factory.annotation.Value; 15 import org.springframework.beans.factory.annotation.Value;
14 import org.springframework.security.core.Authentication; 16 import org.springframework.security.core.Authentication;
15 import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; 17 import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
@@ -45,6 +47,8 @@ public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticat @@ -45,6 +47,8 @@ public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticat
45 @Autowired 47 @Autowired
46 private SecurityProperties securityProperties; 48 private SecurityProperties securityProperties;
47 49
  50 + @Autowired
  51 + RedisUtils redisUtils;
48 @Override 52 @Override
49 public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException { 53 public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException {
50 logger.info("登录成功"); 54 logger.info("登录成功");
@@ -65,7 +69,9 @@ public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticat @@ -65,7 +69,9 @@ public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticat
65 //设置用户的TOKEN的有效时间,时间配置在配置文件中设置 69 //设置用户的TOKEN的有效时间,时间配置在配置文件中设置
66 String jwtToken = JwtTokenUtil.generateToken(loginedUser.getUsername(), jwtMaxAlive); 70 String jwtToken = JwtTokenUtil.generateToken(loginedUser.getUsername(), jwtMaxAlive);
67 loginedUser.setToken(jwtToken); 71 loginedUser.setToken(jwtToken);
68 - 72 + //这里将登录成功的[user]对象数据写入redis缓存,KEY为token value为user的JSON对象
  73 + String json = JSON.toJSONString(user);
  74 + redisUtils.set(jwtToken, json,3600*24*7);
69 Map<String,Object> menuMap = permissionService.getUserMenus(user.getUserId()); 75 Map<String,Object> menuMap = permissionService.getUserMenus(user.getUserId());
70 //返回用户信息和用户可访问的目录列表 76 //返回用户信息和用户可访问的目录列表
71 response.getWriter().write(objectMapper.writeValueAsString(new AuthSuccessResponse(loginedUser,menuMap))); 77 response.getWriter().write(objectMapper.writeValueAsString(new AuthSuccessResponse(loginedUser,menuMap)));
  1 +package com.tianbo.warehouse.util;
  2 +import org.springframework.beans.factory.annotation.Autowired;
  3 +import org.springframework.data.redis.core.BoundListOperations;
  4 +import org.springframework.data.redis.core.StringRedisTemplate;
  5 +import org.springframework.stereotype.Component;
  6 +import org.springframework.util.CollectionUtils;
  7 +
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +import java.util.Set;
  11 +import java.util.concurrent.TimeUnit;
  12 +
  13 +
  14 +/**
  15 + * redisTemplate封装
  16 + *
  17 + * @author yinxp@dist.com.cn
  18 + */
  19 +@Component
  20 +public class RedisUtils {
  21 +
  22 + @Autowired
  23 + private StringRedisTemplate redisTemplate;
  24 +
  25 + public RedisUtils(StringRedisTemplate redisTemplate) {
  26 + this.redisTemplate = redisTemplate;
  27 + }
  28 +
  29 + /**
  30 + * 指定缓存失效时间
  31 + * @param key 键
  32 + * @param time 时间(秒)
  33 + * @return
  34 + */
  35 + public boolean expire(String key,long time){
  36 + try {
  37 + if(time>0){
  38 + redisTemplate.expire(key, time, TimeUnit.SECONDS);
  39 + }
  40 + return true;
  41 + } catch (Exception e) {
  42 + e.printStackTrace();
  43 + return false;
  44 + }
  45 + }
  46 +
  47 + /**
  48 + * 根据key 获取过期时间
  49 + * @param key 键 不能为null
  50 + * @return 时间(秒) 返回0代表为永久有效
  51 + */
  52 + public long getExpire(String key){
  53 + return redisTemplate.getExpire(key,TimeUnit.SECONDS);
  54 + }
  55 +
  56 + /**
  57 + * 判断key是否存在
  58 + * @param key 键
  59 + * @return true 存在 false不存在
  60 + */
  61 + public boolean hasKey(String key){
  62 + try {
  63 + return redisTemplate.hasKey(key);
  64 + } catch (Exception e) {
  65 + e.printStackTrace();
  66 + return false;
  67 + }
  68 + }
  69 +
  70 + /**
  71 + * 删除缓存
  72 + * @param key 可以传一个值 或多个
  73 + */
  74 + @SuppressWarnings("unchecked")
  75 + public void del(String ... key){
  76 + if(key!=null&&key.length>0){
  77 + if(key.length==1){
  78 + redisTemplate.delete(key[0]);
  79 + }else{
  80 + redisTemplate.delete(CollectionUtils.arrayToList(key));
  81 + }
  82 + }
  83 + }
  84 +
  85 + //============================String=============================
  86 + /**
  87 + * 普通缓存获取
  88 + * @param key 键
  89 + * @return 值
  90 + */
  91 + public String get(String key){
  92 + return key==null?null:redisTemplate.opsForValue().get(key);
  93 + }
  94 +
  95 + /**
  96 + * 普通缓存放入
  97 + * @param key 键
  98 + * @param value 值
  99 + * @return true成功 false失败
  100 + */
  101 + public boolean set(String key,String value) {
  102 + try {
  103 + redisTemplate.opsForValue().set(key, value);
  104 + return true;
  105 + } catch (Exception e) {
  106 + e.printStackTrace();
  107 + return false;
  108 + }
  109 + }
  110 +
  111 + /**
  112 + * 普通缓存放入并设置时间
  113 + * @param key 键
  114 + * @param value 值
  115 + * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
  116 + * @return true成功 false 失败
  117 + */
  118 + public boolean set(String key,String value,long time){
  119 + try {
  120 + if(time>0){
  121 + redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
  122 + }else{
  123 + set(key, value);
  124 + }
  125 + return true;
  126 + } catch (Exception e) {
  127 + e.printStackTrace();
  128 + return false;
  129 + }
  130 + }
  131 +
  132 + /**
  133 + * 递增
  134 + * @param key 键
  135 + * @param delta 要增加几(大于0)
  136 + * @return
  137 + */
  138 + public long incr(String key, long delta){
  139 + if(delta<0){
  140 + throw new RuntimeException("递增因子必须大于0");
  141 + }
  142 + return redisTemplate.opsForValue().increment(key, delta);
  143 + }
  144 +
  145 + /**
  146 + * 递减
  147 + * @param key 键
  148 + * @param delta 要减少几(小于0)
  149 + * @return
  150 + */
  151 + public long decr(String key, long delta){
  152 + if(delta<0){
  153 + throw new RuntimeException("递减因子必须大于0");
  154 + }
  155 + return redisTemplate.opsForValue().increment(key, -delta);
  156 + }
  157 +
  158 + //================================Map=================================
  159 + /**
  160 + * HashGet
  161 + * @param key 键 不能为null
  162 + * @param item 项 不能为null
  163 + * @return 值
  164 + */
  165 + public Object hget(String key,String item){
  166 + return redisTemplate.opsForHash().get(key, item);
  167 + }
  168 +
  169 + /**
  170 + * 获取hashKey对应的所有键值
  171 + * @param key 键
  172 + * @return 对应的多个键值
  173 + */
  174 + public Map<Object,Object> hmget(String key){
  175 + return redisTemplate.opsForHash().entries(key);
  176 + }
  177 +
  178 + /**
  179 + * HashSet
  180 + * @param key 键
  181 + * @param map 对应多个键值
  182 + * @return true 成功 false 失败
  183 + */
  184 + public boolean hmset(String key, Map<String,String> map){
  185 + try {
  186 + redisTemplate.opsForHash().putAll(key, map);
  187 + return true;
  188 + } catch (Exception e) {
  189 + e.printStackTrace();
  190 + return false;
  191 + }
  192 + }
  193 +
  194 + /**
  195 + * HashSet 并设置时间
  196 + * @param key 键
  197 + * @param map 对应多个键值
  198 + * @param time 时间(秒)
  199 + * @return true成功 false失败
  200 + */
  201 + public boolean hmset(String key, Map<String,String> map, long time){
  202 + try {
  203 + redisTemplate.opsForHash().putAll(key, map);
  204 + if(time>0){
  205 + expire(key, time);
  206 + }
  207 + return true;
  208 + } catch (Exception e) {
  209 + e.printStackTrace();
  210 + return false;
  211 + }
  212 + }
  213 +
  214 + /**
  215 + * 向一张hash表中放入数据,如果不存在将创建
  216 + * @param key 键
  217 + * @param item 项
  218 + * @param value 值
  219 + * @return true 成功 false失败
  220 + */
  221 + public boolean hset(String key,String item,String value) {
  222 + try {
  223 + redisTemplate.opsForHash().put(key, item, value);
  224 + return true;
  225 + } catch (Exception e) {
  226 + e.printStackTrace();
  227 + return false;
  228 + }
  229 + }
  230 +
  231 + /**
  232 + * 向一张hash表中放入数据,如果不存在将创建
  233 + * @param key 键
  234 + * @param item 项
  235 + * @param value 值
  236 + * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
  237 + * @return true 成功 false失败
  238 + */
  239 + public boolean hset(String key,String item,String value,long time) {
  240 + try {
  241 + redisTemplate.opsForHash().put(key, item, value);
  242 + if(time>0){
  243 + expire(key, time);
  244 + }
  245 + return true;
  246 + } catch (Exception e) {
  247 + e.printStackTrace();
  248 + return false;
  249 + }
  250 + }
  251 +
  252 + /**
  253 + * 删除hash表中的值
  254 + * @param key 键 不能为null
  255 + * @param item 项 可以使多个 不能为null
  256 + */
  257 + public void hdel(String key, String... item){
  258 + redisTemplate.opsForHash().delete(key,item);
  259 + }
  260 +
  261 + /**
  262 + * 判断hash表中是否有该项的值
  263 + * @param key 键 不能为null
  264 + * @param item 项 不能为null
  265 + * @return true 存在 false不存在
  266 + */
  267 + public boolean hHasKey(String key, String item){
  268 + return redisTemplate.opsForHash().hasKey(key, item);
  269 + }
  270 +
  271 + /**
  272 + * hash递增 如果不存在,就会创建一个 并把新增后的值返回
  273 + * @param key 键
  274 + * @param item 项
  275 + * @param by 要增加几(大于0)
  276 + * @return
  277 + */
  278 + public double hincr(String key, String item,double by){
  279 + return redisTemplate.opsForHash().increment(key, item, by);
  280 + }
  281 +
  282 + /**
  283 + * hash递减
  284 + * @param key 键
  285 + * @param item 项
  286 + * @param by 要减少记(小于0)
  287 + * @return
  288 + */
  289 + public double hdecr(String key, String item,double by){
  290 + return redisTemplate.opsForHash().increment(key, item,-by);
  291 + }
  292 +
  293 + //============================set=============================
  294 + /**
  295 + * 根据key获取Set中的所有值
  296 + * @param key 键
  297 + * @return
  298 + */
  299 + public Set<String> sGet(String key){
  300 + try {
  301 + return redisTemplate.opsForSet().members(key);
  302 + } catch (Exception e) {
  303 + e.printStackTrace();
  304 + return null;
  305 + }
  306 + }
  307 +
  308 + /**
  309 + * 根据value从一个set中查询,是否存在
  310 + * @param key 键
  311 + * @param value 值
  312 + * @return true 存在 false不存在
  313 + */
  314 + public boolean sHasKey(String key,String value){
  315 + try {
  316 + return redisTemplate.opsForSet().isMember(key, value);
  317 + } catch (Exception e) {
  318 + e.printStackTrace();
  319 + return false;
  320 + }
  321 + }
  322 +
  323 + /**
  324 + * 将数据放入set缓存
  325 + * @param key 键
  326 + * @param values 值 可以是多个
  327 + * @return 成功个数
  328 + */
  329 + public long sSet(String key, String...values) {
  330 + try {
  331 + return redisTemplate.opsForSet().add(key, values);
  332 + } catch (Exception e) {
  333 + e.printStackTrace();
  334 + return 0;
  335 + }
  336 + }
  337 +
  338 + /**
  339 + * 将set数据放入缓存
  340 + * @param key 键
  341 + * @param time 时间(秒)
  342 + * @param values 值 可以是多个
  343 + * @return 成功个数
  344 + */
  345 + public long sSetAndTime(String key,long time,String...values) {
  346 + try {
  347 + Long count = redisTemplate.opsForSet().add(key, values);
  348 + if(time>0) {
  349 + expire(key, time);
  350 + }
  351 + return count;
  352 + } catch (Exception e) {
  353 + e.printStackTrace();
  354 + return 0;
  355 + }
  356 + }
  357 +
  358 + /**
  359 + * 获取set缓存的长度
  360 + * @param key 键
  361 + * @return
  362 + */
  363 + public long sGetSetSize(String key){
  364 + try {
  365 + return redisTemplate.opsForSet().size(key);
  366 + } catch (Exception e) {
  367 + e.printStackTrace();
  368 + return 0;
  369 + }
  370 + }
  371 +
  372 + /**
  373 + * 移除值为value的
  374 + * @param key 键
  375 + * @param values 值 可以是多个
  376 + * @return 移除的个数
  377 + */
  378 + public long setRemove(String key, String ...values) {
  379 + try {
  380 + Long count = redisTemplate.opsForSet().remove(key, values);
  381 + return count;
  382 + } catch (Exception e) {
  383 + e.printStackTrace();
  384 + return 0;
  385 + }
  386 + }
  387 + //===============================list=================================
  388 +
  389 + /**
  390 + * 获取list缓存的内容
  391 + * @param key 键
  392 + * @param start 开始
  393 + * @param end 结束 0 到 -1代表所有值
  394 + * @return
  395 + */
  396 + public List<String> lGet(String key, long start, long end){
  397 + try {
  398 + return redisTemplate.opsForList().range(key, start, end);
  399 + } catch (Exception e) {
  400 + e.printStackTrace();
  401 + return null;
  402 + }
  403 + }
  404 +
  405 + /**
  406 + * 获取list缓存的长度
  407 + * @param key 键
  408 + * @return
  409 + */
  410 + public long lGetListSize(String key){
  411 + try {
  412 + return redisTemplate.opsForList().size(key);
  413 + } catch (Exception e) {
  414 + e.printStackTrace();
  415 + return 0;
  416 + }
  417 + }
  418 +
  419 + /**
  420 + * 通过索引 获取list中的值
  421 + * @param key 键
  422 + * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
  423 + * @return
  424 + */
  425 + public String lGetIndex(String key,long index){
  426 + try {
  427 + return redisTemplate.opsForList().index(key, index);
  428 + } catch (Exception e) {
  429 + e.printStackTrace();
  430 + return null;
  431 + }
  432 + }
  433 +
  434 + /**
  435 + * 将list放入缓存
  436 + * @param key 键
  437 + * @param value 值
  438 + * @return
  439 + */
  440 + public boolean lSet(String key, String value) {
  441 + try {
  442 + redisTemplate.opsForList().rightPush(key, value);
  443 + return true;
  444 + } catch (Exception e) {
  445 + e.printStackTrace();
  446 + return false;
  447 + }
  448 + }
  449 +
  450 + /**
  451 + * 将list放入缓存
  452 + * @param key 键
  453 + * @param value 值
  454 + * @param time 时间(秒)
  455 + * @return
  456 + */
  457 + public boolean lSet(String key, String value, long time) {
  458 + try {
  459 + redisTemplate.opsForList().rightPush(key, value);
  460 + if (time > 0) {
  461 + expire(key, time);
  462 + }
  463 + return true;
  464 + } catch (Exception e) {
  465 + e.printStackTrace();
  466 + return false;
  467 + }
  468 + }
  469 +
  470 + /**
  471 + * 将list放入缓存
  472 + * @param key 键
  473 + * @param value 值
  474 + * @return
  475 + */
  476 + public boolean lSet(String key, List<String> value) {
  477 + try {
  478 + redisTemplate.opsForList().rightPushAll(key, value);
  479 + return true;
  480 + } catch (Exception e) {
  481 + e.printStackTrace();
  482 + return false;
  483 + }
  484 + }
  485 +
  486 + /**
  487 + * 将list放入缓存
  488 + * @param key 键
  489 + * @param value 值
  490 + * @param time 时间(秒)
  491 + * @return
  492 + */
  493 + public boolean lSet(String key, List<String> value, long time) {
  494 + try {
  495 + redisTemplate.opsForList().rightPushAll(key, value);
  496 + if (time > 0) {
  497 + expire(key, time);
  498 + }
  499 + return true;
  500 + } catch (Exception e) {
  501 + e.printStackTrace();
  502 + return false;
  503 + }
  504 + }
  505 +
  506 + /**
  507 + * 根据索引修改list中的某条数据
  508 + * @param key 键
  509 + * @param index 索引
  510 + * @param value 值
  511 + * @return
  512 + */
  513 + public boolean lUpdateIndex(String key, long index,String value) {
  514 + try {
  515 + redisTemplate.opsForList().set(key, index, value);
  516 + return true;
  517 + } catch (Exception e) {
  518 + e.printStackTrace();
  519 + return false;
  520 + }
  521 + }
  522 +
  523 + /**
  524 + * 移除N个值为value
  525 + * @param key 键
  526 + * @param count 移除多少个
  527 + * @param value 值
  528 + * @return 移除的个数
  529 + */
  530 + public long lRemove(String key,long count,String value) {
  531 + try {
  532 + Long remove = redisTemplate.opsForList().remove(key, count, value);
  533 + return remove;
  534 + } catch (Exception e) {
  535 + e.printStackTrace();
  536 + return 0;
  537 + }
  538 + }
  539 +
  540 + /**
  541 + * 模糊查询获取key值
  542 + * @param pattern
  543 + * @return
  544 + */
  545 + public Set keys(String pattern){
  546 + return redisTemplate.keys(pattern);
  547 + }
  548 +
  549 + /**
  550 + * 使用Redis的消息队列
  551 + * @param channel
  552 + * @param message 消息内容
  553 + */
  554 + public void convertAndSend(String channel, String message){
  555 + redisTemplate.convertAndSend(channel,message);
  556 + }
  557 +
  558 +
  559 + //=========BoundListOperations 用法 start============
  560 +
  561 + /**
  562 + *将数据添加到Redis的list中(从右边添加)
  563 + * @param listKey
  564 + * @param expireEnum 有效期的枚举类
  565 + * @param values 待添加的数据
  566 + */
  567 +// public void addToListRight(String listKey, Status.ExpireEnum expireEnum, String... values) {
  568 +// //绑定操作
  569 +// BoundListOperations<String, String> boundValueOperations = redisTemplate.boundListOps(listKey);
  570 +// //插入数据
  571 +// boundValueOperations.rightPushAll(values);
  572 +// //设置过期时间
  573 +// boundValueOperations.expire(expireEnum.getTime(),expireEnum.getTimeUnit());
  574 +// }
  575 + /**
  576 + * 根据起始结束序号遍历Redis中的list
  577 + * @param listKey
  578 + * @param start 起始序号
  579 + * @param end 结束序号
  580 + * @return
  581 + */
  582 + public List<String> rangeList(String listKey, long start, long end) {
  583 + //绑定操作
  584 + BoundListOperations<String, String> boundValueOperations = redisTemplate.boundListOps(listKey);
  585 + //查询数据
  586 + return boundValueOperations.range(start, end);
  587 + }
  588 + /**
  589 + * 弹出右边的值 --- 并且移除这个值
  590 + * @param listKey
  591 + */
  592 + public String rifhtPop(String listKey){
  593 + //绑定操作
  594 + BoundListOperations<String, String> boundValueOperations = redisTemplate.boundListOps(listKey);
  595 + return boundValueOperations.rightPop();
  596 + }
  597 +
  598 + //=========BoundListOperations 用法 End============
  599 +
  600 +}
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 path, url, method, iconCls, component 20 path, url, method, iconCls, component
21 </sql> 21 </sql>
22 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > 22 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
23 - select 23 + select
24 <include refid="Base_Column_List" /> 24 <include refid="Base_Column_List" />
25 from permission 25 from permission
26 where permission_id = #{permissionId,jdbcType=INTEGER} ORDER BY permission_order 26 where permission_id = #{permissionId,jdbcType=INTEGER} ORDER BY permission_order
@@ -35,8 +35,8 @@ @@ -35,8 +35,8 @@
35 FROM role R 35 FROM role R
36 LEFT JOIN role_permission RP ON R.role_id = RP.role_id 36 LEFT JOIN role_permission RP ON R.role_id = RP.role_id
37 LEFT JOIN permission P ON RP.permission_id = P.permission_id 37 LEFT JOIN permission P ON RP.permission_id = P.permission_id
38 - WHERE r.role_id=#{roleId,jdbcType=INTEGER}  
39 - ORDER BY P.ismenu,P.name,p.permission_order DESC 38 + WHERE R.role_id=#{roleId,jdbcType=INTEGER}
  39 + ORDER BY P.ismenu,P.name,P.permission_order DESC
40 </select> 40 </select>
41 <select id="getAllMenus" resultMap="BaseResultMap" > 41 <select id="getAllMenus" resultMap="BaseResultMap" >
42 SELECT 42 SELECT
@@ -117,7 +117,7 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order @@ -117,7 +117,7 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order
117 description, ismenu,hidden, parent_id, 117 description, ismenu,hidden, parent_id,
118 path, url, method, iconCls, 118 path, url, method, iconCls,
119 component) 119 component)
120 - values (#{permissionId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{permissionOrder,jdbcType=VARCHAR}, 120 + values (#{permissionId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{permissionOrder,jdbcType=VARCHAR},
121 #{description,jdbcType=VARCHAR}, #{ismenu,jdbcType=BOOLEAN},#{hidden,jdbcType=BOOLEAN},#{parentId,jdbcType=INTEGER}, 121 #{description,jdbcType=VARCHAR}, #{ismenu,jdbcType=BOOLEAN},#{hidden,jdbcType=BOOLEAN},#{parentId,jdbcType=INTEGER},
122 #{path,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{iconCls,jdbcType=VARCHAR}, 122 #{path,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{iconCls,jdbcType=VARCHAR},
123 #{component,jdbcType=VARCHAR}) 123 #{component,jdbcType=VARCHAR})
@@ -255,4 +255,4 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order @@ -255,4 +255,4 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order
255 component = #{component,jdbcType=VARCHAR} 255 component = #{component,jdbcType=VARCHAR}
256 where permission_id = #{permissionId,jdbcType=INTEGER} 256 where permission_id = #{permissionId,jdbcType=INTEGER}
257 </update> 257 </update>
258 -</mapper>  
  258 +</mapper>
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 user_id, username, birthday, sex, address, state, mobilePhone,userFace, realName, email, age 38 user_id, username, birthday, sex, address, state, mobilePhone,userFace, realName, email, age
39 </sql> 39 </sql>
40 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > 40 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
41 - select 41 + select
42 <include refid="Base_Column_List" /> 42 <include refid="Base_Column_List" />
43 from users 43 from users
44 where user_id = #{userId,jdbcType=INTEGER} 44 where user_id = #{userId,jdbcType=INTEGER}
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <select id="selectAllUser" resultMap="SecurityResult" parameterType="com.tianbo.warehouse.model.USERS" > 52 <select id="selectAllUser" resultMap="SecurityResult" parameterType="com.tianbo.warehouse.model.USERS" >
53 select 53 select
54 <include refid="user_List" /> 54 <include refid="user_List" />
55 - from USERS 55 + from users
56 WHERE 1=1 56 WHERE 1=1
57 <if test="username != null" > 57 <if test="username != null" >
58 and username = #{username,jdbcType=VARCHAR} 58 and username = #{username,jdbcType=VARCHAR}
@@ -66,14 +66,14 @@ @@ -66,14 +66,14 @@
66 where user_id = #{userId,jdbcType=INTEGER} 66 where user_id = #{userId,jdbcType=INTEGER}
67 </delete> 67 </delete>
68 <insert id="insert" parameterType="com.tianbo.warehouse.model.USERS" > 68 <insert id="insert" parameterType="com.tianbo.warehouse.model.USERS" >
69 - insert into users (user_id, username, password,  
70 - birthday, sex, address,  
71 - state, mobilePhone, creatTime, 69 + insert into users (user_id, username, password,
  70 + birthday, sex, address,
  71 + state, mobilePhone, creatTime,
72 updateTime, userFace, realName, 72 updateTime, userFace, realName,
73 email, age) 73 email, age)
74 - values (#{userId,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},  
75 - #{birthday,jdbcType=TIMESTAMP}, #{sex,jdbcType=CHAR}, #{address,jdbcType=VARCHAR},  
76 - #{state,jdbcType=BIT}, #{mobilephone,jdbcType=VARCHAR}, #{creattime,jdbcType=TIMESTAMP}, 74 + values (#{userId,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
  75 + #{birthday,jdbcType=TIMESTAMP}, #{sex,jdbcType=CHAR}, #{address,jdbcType=VARCHAR},
  76 + #{state,jdbcType=BIT}, #{mobilephone,jdbcType=VARCHAR}, #{creattime,jdbcType=TIMESTAMP},
77 #{updatetime,jdbcType=TIMESTAMP}, #{userface,jdbcType=VARCHAR}, #{realname,jdbcType=VARCHAR}, 77 #{updatetime,jdbcType=TIMESTAMP}, #{userface,jdbcType=VARCHAR}, #{realname,jdbcType=VARCHAR},
78 #{email,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER}) 78 #{email,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER})
79 </insert> 79 </insert>
@@ -226,4 +226,4 @@ @@ -226,4 +226,4 @@
226 age = #{age,jdbcType=INTEGER} 226 age = #{age,jdbcType=INTEGER}
227 where user_id = #{userId,jdbcType=INTEGER} 227 where user_id = #{userId,jdbcType=INTEGER}
228 </update> 228 </update>
229 -</mapper>  
  229 +</mapper>