1.试图引入vue.js

2.同步表结构插件采用多线程池+自定义队列的方式实现
master
星期八 6 years ago
parent 76b22afd6a
commit 6106d7e076
  1. 19
      src/main/java/com/lq/cms/service/impl/SysRoleResourcePermissionServiceImpl.java
  2. 12
      src/main/java/com/lq/code/dto/QueueDto.java
  3. 3
      src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java
  4. 1
      src/main/java/com/lq/code/util/sql/MysqlBuilder.java
  5. 9
      src/main/java/com/lq/dao/SysRoleResourcePermissionDao.java
  6. 2
      src/main/java/com/lq/webUtil/util/IPUtil.java
  7. 1
      src/main/resources/mybatis/mapping/SysRoleDao.xml
  8. 2
      src/main/resources/mybatis/mapping/SysRoleResourcePermissionDao.xml
  9. 2
      src/main/resources/mybatis/mapping/SysUserDao.xml
  10. 11944
      src/main/webapp/resources/code/js/vue.js

@ -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<SysRol
@Override
public List<ZtreeComposite> findZtree(Long roleId) {
Long startTime = System.currentTimeMillis();
List<ZtreeComposite> ztreeList=new ArrayList<>();
List<SysResource> resourceList=sysResourceDao.findByParentId(0L);
List<SysPermission> permissionList=sysPermissionDao.findAll();
@ -84,9 +86,11 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol
ztreeList.add(ztreeItem);
}
System.out.println("耗时:"+(System.currentTimeMillis()-startTime)+"(毫秒)");
return ztreeList;
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateRolePermission(List<SysRoleResourcePermissionVo> list) {
//角色id
@ -97,7 +101,7 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol
sysRoleResourcePermissionDao.updateByRoleIdAndStatus(map);
for (SysRoleResourcePermissionVo vo:list){
SysRoleResourcePermission sysRoleResourcePermission=sysRoleResourcePermissionDao.findByResourceIdAndPermissionIdAndRoleId(vo.getResourceId(),vo.getPermissionId(),vo.getRoleId());
SysRoleResourcePermission sysRoleResourcePermission=sysRoleResourcePermissionDao.getByResourceIdAndPermissionIdAndRoleId(vo.getResourceId(),vo.getPermissionId(),vo.getRoleId());
if (sysRoleResourcePermission==null){
sysRoleResourcePermission=new SysRoleResourcePermission();
sysRoleResourcePermission.setCreateTime(new Date());
@ -113,7 +117,8 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol
}
return true;}
return true;
}
@Override
public List<PermissionVo> findByRoleId(Long roleId) {
@ -144,9 +149,11 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol
return list;
}
//内部方法,用于判断角色是否有权限
/**
*内部方法用于判断角色是否有权限
*/
private boolean isCheck(Long resourceId,Long permissionId,Long roleId){
SysRoleResourcePermission roleResourcePermission=sysRoleResourcePermissionDao.findByResourceIdAndPermissionIdAndRoleId(resourceId,permissionId,roleId);
SysRoleResourcePermission roleResourcePermission=sysRoleResourcePermissionDao.getByResourceIdAndPermissionIdAndRoleId(resourceId,permissionId,roleId);
if (roleResourcePermission!=null&&StatusTypeEnum.STATUS_ACTIVITY_YES.getValue().equals(roleResourcePermission.getStatus())){
return true;
}else{
@ -154,7 +161,9 @@ public class SysRoleResourcePermissionServiceImpl extends BaseServiceImpl<SysRol
}
}
//内部方法,拼接资源和权限ID
/**
*内部方法拼接资源和权限ID
*/
private Map<String,Object> getAttributes(Long resourceId,Long permissionId){
Map<String,Object> map=new HashMap<>();
map.put(PERMISSIONID_KEY,resourceId+RESOURCE_SYMBOL+permissionId);

@ -18,6 +18,7 @@ public class QueueDto<T> {
private int index;
public QueueDto() {
this.list = new ArrayList<>();
}
@ -28,13 +29,13 @@ public class QueueDto<T> {
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<T> {
* 判断是否还有元素存在
* @return
*/
public boolean hasNext(){
public synchronized boolean hasNext(){
boolean result = true;
if (index==0){
result = false;
@ -52,4 +53,9 @@ public class QueueDto<T> {
return result;
}
public int getIndex(){
return this.index;
}
}

@ -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<Class> set = BeanUtil.getClassSet(packagePath);
QueueDto<Class> queueDto = BeanUtil.getQueueDto(packagePath);
AbstractDbBuiler dbBuiler = new MysqlBuilder();
// String sql = dbBuiler.automaticUpdateDbNew(queueDto);
String sql = dbBuiler.automaticUpdateDb(set);
// JdbcUtils.createTable(sql);
System.out.println("=========实体同步数据结构===========");

@ -150,6 +150,7 @@ public class MysqlBuilder extends AbstractDbBuiler {
}
});
}
executorService.shutdown();
return sql.toString();
}

@ -15,7 +15,14 @@ public interface SysRoleResourcePermissionDao extends BaseDao<SysRoleResourcePer
List<PermissionVo> 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<String, Object> param);

@ -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;
}

@ -75,6 +75,7 @@
SELECT <include refid="column_list"/>
FROM sys_role
WHERE status=1
ORDER BY create_time DESC ,update_time DESC
</select>

@ -49,7 +49,7 @@
id=#{id}
</update>
<select id="findByResourceIdAndPermissionIdAndRoleId" resultType="SysRoleResourcePermission">
<select id="getByResourceIdAndPermissionIdAndRoleId" resultType="SysRoleResourcePermission">
SELECT <include refid="column_list"/>
FROM sys_role_resource_permission
WHERE 1=1

@ -34,7 +34,7 @@
SELECT <include refid="column_list"/>
FROM sys_user
WHERE status = 1
ORDER BY update_time,create_time ASC
ORDER BY create_time DESC ,update_time DESC
</select>
<select id="count" parameterType="SysUserVo" resultType="Int">

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save