From 6106d7e0764d474f571b1c50e374e026b72e8e91 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Tue, 18 Jun 2019 01:27:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=AF=95=E5=9B=BE=E5=BC=95=E5=85=A5vue.js=20?= =?UTF-8?q?2.=E5=90=8C=E6=AD=A5=E8=A1=A8=E7=BB=93=E6=9E=84=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E9=87=87=E7=94=A8=E5=A4=9A=E7=BA=BF=E7=A8=8B=E6=B1=A0?= =?UTF-8?q?+=E8=87=AA=E5=AE=9A=E4=B9=89=E9=98=9F=E5=88=97=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SysRoleResourcePermissionServiceImpl.java | 19 +- src/main/java/com/lq/code/dto/QueueDto.java | 12 +- ...InstantiationTracingBeanPostProcessor.java | 3 + .../com/lq/code/util/sql/MysqlBuilder.java | 1 + .../lq/dao/SysRoleResourcePermissionDao.java | 9 +- src/main/java/com/lq/webUtil/util/IPUtil.java | 2 +- .../resources/mybatis/mapping/SysRoleDao.xml | 1 + .../mapping/SysRoleResourcePermissionDao.xml | 2 +- .../resources/mybatis/mapping/SysUserDao.xml | 2 +- src/main/webapp/resources/code/js/vue.js | 11944 ++++++++++++++++ 10 files changed, 11983 insertions(+), 12 deletions(-) create mode 100644 src/main/webapp/resources/code/js/vue.js diff --git a/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java b/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java index 8aabbfc..492a26d 100755 --- a/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java +++ b/src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java @@ -18,6 +18,7 @@ import com.lq.entity.SysResource; import com.lq.entity.SysRoleResourcePermission; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.*; @@ -47,6 +48,7 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl findZtree(Long roleId) { + Long startTime = System.currentTimeMillis(); List ztreeList=new ArrayList<>(); List resourceList=sysResourceDao.findByParentId(0L); List permissionList=sysPermissionDao.findAll(); @@ -84,9 +86,11 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl list) { //角色id @@ -97,7 +101,7 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl findByRoleId(Long roleId) { @@ -144,9 +149,11 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl getAttributes(Long resourceId,Long permissionId){ Map map=new HashMap<>(); map.put(PERMISSIONID_KEY,resourceId+RESOURCE_SYMBOL+permissionId); diff --git a/src/main/java/com/lq/code/dto/QueueDto.java b/src/main/java/com/lq/code/dto/QueueDto.java index 262fcb5..d6f996b 100644 --- a/src/main/java/com/lq/code/dto/QueueDto.java +++ b/src/main/java/com/lq/code/dto/QueueDto.java @@ -18,6 +18,7 @@ public class QueueDto { private int index; + public QueueDto() { this.list = new ArrayList<>(); } @@ -28,13 +29,13 @@ public class QueueDto { public void add(T t){ list.add(t); - index++; + index ++; } public synchronized T pop(){ T t = null; - index--; if (hasNext()) { + index--; t = list.get(index); } return t; @@ -44,7 +45,7 @@ public class QueueDto { * 判断是否还有元素存在 * @return */ - public boolean hasNext(){ + public synchronized boolean hasNext(){ boolean result = true; if (index==0){ result = false; @@ -52,4 +53,9 @@ public class QueueDto { return result; } + public int getIndex(){ + + return this.index; + } + } diff --git a/src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java b/src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java index 1995832..2edb3cb 100755 --- a/src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java +++ b/src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java @@ -1,5 +1,6 @@ package com.lq.code.executor.processor; +import com.lq.code.dto.QueueDto; import com.lq.code.util.BeanUtil; import com.lq.code.util.jdbc.JdbcUtils; import com.lq.code.util.sql.AbstractDbBuiler; @@ -43,7 +44,9 @@ public class InstantiationTracingBeanPostProcessor implements ApplicationListene if (isUpdateDB) { long startTime = System.currentTimeMillis(); Set set = BeanUtil.getClassSet(packagePath); + QueueDto queueDto = BeanUtil.getQueueDto(packagePath); AbstractDbBuiler dbBuiler = new MysqlBuilder(); +// String sql = dbBuiler.automaticUpdateDbNew(queueDto); String sql = dbBuiler.automaticUpdateDb(set); // JdbcUtils.createTable(sql); System.out.println("=========实体同步数据结构==========="); diff --git a/src/main/java/com/lq/code/util/sql/MysqlBuilder.java b/src/main/java/com/lq/code/util/sql/MysqlBuilder.java index bf4e9cf..0adc887 100755 --- a/src/main/java/com/lq/code/util/sql/MysqlBuilder.java +++ b/src/main/java/com/lq/code/util/sql/MysqlBuilder.java @@ -150,6 +150,7 @@ public class MysqlBuilder extends AbstractDbBuiler { } }); } + executorService.shutdown(); return sql.toString(); } diff --git a/src/main/java/com/lq/dao/SysRoleResourcePermissionDao.java b/src/main/java/com/lq/dao/SysRoleResourcePermissionDao.java index 1fa3f97..6800cf3 100755 --- a/src/main/java/com/lq/dao/SysRoleResourcePermissionDao.java +++ b/src/main/java/com/lq/dao/SysRoleResourcePermissionDao.java @@ -15,7 +15,14 @@ public interface SysRoleResourcePermissionDao extends BaseDao findByRoleId(@Param("roleId") Long roleId); - SysRoleResourcePermission findByResourceIdAndPermissionIdAndRoleId(@Param("resourceId") Long resourceId, @Param("permissonId") Long permissonId, @Param("roleId") Long roleId); + /** + * 通过资源ID,权限ID和角色ID查找3者关联表 + * @param resourceId(角色ID) + * @param permissonId + * @param roleId + * @return + */ + SysRoleResourcePermission getByResourceIdAndPermissionIdAndRoleId(@Param("resourceId") Long resourceId, @Param("permissonId") Long permissonId, @Param("roleId") Long roleId); void updateByRoleIdAndStatus(Map param); diff --git a/src/main/java/com/lq/webUtil/util/IPUtil.java b/src/main/java/com/lq/webUtil/util/IPUtil.java index 3167da7..d96b86a 100755 --- a/src/main/java/com/lq/webUtil/util/IPUtil.java +++ b/src/main/java/com/lq/webUtil/util/IPUtil.java @@ -21,7 +21,7 @@ public class IPUtil { if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)){ ip = request.getRemoteAddr(); } - return ip.equals("0:0:0:0:0:0:0:1")?"127.0.0.1":ip; + return "0:0:0:0:0:0:0:1".equals(ip) ?"127.0.0.1":ip; } diff --git a/src/main/resources/mybatis/mapping/SysRoleDao.xml b/src/main/resources/mybatis/mapping/SysRoleDao.xml index bc02c45..f66dc85 100644 --- a/src/main/resources/mybatis/mapping/SysRoleDao.xml +++ b/src/main/resources/mybatis/mapping/SysRoleDao.xml @@ -75,6 +75,7 @@ SELECT FROM sys_role WHERE status=1 + ORDER BY create_time DESC ,update_time DESC diff --git a/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml b/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml index ecb5503..feaefc3 100644 --- a/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml +++ b/src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml @@ -49,7 +49,7 @@ id=#{id} - SELECT FROM sys_role_resource_permission WHERE 1=1 diff --git a/src/main/resources/mybatis/mapping/SysUserDao.xml b/src/main/resources/mybatis/mapping/SysUserDao.xml index 7dedbd2..b3f951b 100644 --- a/src/main/resources/mybatis/mapping/SysUserDao.xml +++ b/src/main/resources/mybatis/mapping/SysUserDao.xml @@ -34,7 +34,7 @@ SELECT FROM sys_user WHERE status = 1 - ORDER BY update_time,create_time ASC + ORDER BY create_time DESC ,update_time DESC