From 411cd3f1b4f34419c5cb611f9498079008bcc6fc Mon Sep 17 00:00:00 2001 From: qi_liang Date: Sun, 25 Aug 2019 22:46:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E5=90=88mybatis-plus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 +++- .../lq/cms/emun/BasicsPermissionKeyEnum.java | 27 ++++++--- src/main/java/com/lq/code/dto/QueueDto.java | 4 -- .../java/com/lq/code/entity/IdEntity.java | 4 ++ ...InstantiationTracingBeanPostProcessor.java | 2 +- .../resources/mybatis/mapping/SysUserDao.xml | 6 ++ src/main/resources/mybatis/mybatis-config.xml | 2 + .../views/jsp/cms/sys/permission/index.jsp | 1 + src/test/java/com/lq/BaseTest.java | 10 ++++ .../java/com/lq/SysPermissionServiceTest.java | 57 +++++++++++++++++++ 10 files changed, 112 insertions(+), 13 deletions(-) create mode 100644 src/test/java/com/lq/BaseTest.java create mode 100644 src/test/java/com/lq/SysPermissionServiceTest.java diff --git a/pom.xml b/pom.xml index 469eaa2..bf4b28f 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ junit junit - 4.11 + 4.12 test @@ -512,6 +512,7 @@ com.github.jsonzou jmockdata 3.0.1 + test @@ -521,6 +522,15 @@ 2.6.2 + + + + cn.hutool + hutool-all + 4.6.3 + + + diff --git a/src/main/java/com/lq/cms/emun/BasicsPermissionKeyEnum.java b/src/main/java/com/lq/cms/emun/BasicsPermissionKeyEnum.java index 0da4d33..d2a19a6 100644 --- a/src/main/java/com/lq/cms/emun/BasicsPermissionKeyEnum.java +++ b/src/main/java/com/lq/cms/emun/BasicsPermissionKeyEnum.java @@ -1,5 +1,8 @@ package com.lq.cms.emun; +import java.util.HashMap; +import java.util.Map; + /** * @Author: qi * @Description: @@ -7,22 +10,25 @@ package com.lq.cms.emun; */ public enum BasicsPermissionKeyEnum { - SELECT_MENU_KEY("SELECT_MENU_KEY","查看菜单"), - SELECT_DATA_KEY("SELECT_DATA_KEY","查询全部数据"), - INSERT_KEY("INSERT_KEY","新增数据权限"), - UPDATE_key("UPDATE_key","更新数据权限"), - DELETE_KEY("DELETE_KEY","删除数据权限") + SELECT_MENU_KEY("SELECT_MENU_KEY","查看菜单","SELECT"), + SELECT_DATA_KEY("SELECT_DATA_KEY","查询全部数据","SELECT"), + INSERT_KEY("INSERT_KEY","新增数据","INSERT"), + UPDATE_key("UPDATE_key","更新数据","UPDATE"), + DELETE_KEY("DELETE_KEY","删除数据","DELETE") ; - BasicsPermissionKeyEnum(String value, String desc) { + BasicsPermissionKeyEnum(String value, String desc,String type) { this.value = value; this.desc = desc; + this.type = type; } private String value; private String desc; + private String type; + public String getValue() { return value; } @@ -38,4 +44,11 @@ public enum BasicsPermissionKeyEnum { public void setDesc(String desc) { this.desc = desc; } -} + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + }} diff --git a/src/main/java/com/lq/code/dto/QueueDto.java b/src/main/java/com/lq/code/dto/QueueDto.java index d6f996b..6bb06d6 100644 --- a/src/main/java/com/lq/code/dto/QueueDto.java +++ b/src/main/java/com/lq/code/dto/QueueDto.java @@ -1,11 +1,7 @@ package com.lq.code.dto; -import com.github.jsonzou.jmockdata.JMockData; -import com.lq.entity.SysUser; - import java.util.ArrayList; import java.util.List; -import java.util.concurrent.ThreadPoolExecutor; /** * @Author: qi diff --git a/src/main/java/com/lq/code/entity/IdEntity.java b/src/main/java/com/lq/code/entity/IdEntity.java index e7cd4c7..2637726 100755 --- a/src/main/java/com/lq/code/entity/IdEntity.java +++ b/src/main/java/com/lq/code/entity/IdEntity.java @@ -1,9 +1,12 @@ package com.lq.code.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.lq.code.util.BeanUtil; import java.io.Serializable; import java.lang.reflect.Field; +import java.lang.reflect.Type; import java.util.List; /** @@ -14,6 +17,7 @@ public class IdEntity implements Serializable { /** * 数据id */ + @TableId(type = IdType.AUTO) protected Long id; /** * 数据状态(与业务逻辑无关) 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 7babbe0..edbce5f 100755 --- a/src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java +++ b/src/main/java/com/lq/code/executor/processor/InstantiationTracingBeanPostProcessor.java @@ -45,7 +45,7 @@ public class InstantiationTracingBeanPostProcessor implements ApplicationListene //扫描实体类 if (isUpdateDB) { Set set = BeanUtil.getClassSet(packagePath); - QueueDto queueDto = BeanUtil.getQueueDto(packagePath); + // QueueDto queueDto = BeanUtil.getQueueDto(packagePath); DbBuilerFactory dbBuilerFactory = new DefaultDbBuilerFactory(); AbstractDbBuiler dbBuiler = dbBuilerFactory.getSqlBuilder(SqlConstant.DB_TYPE_MYSQL); String sql = dbBuiler.automaticUpdateDb(set); diff --git a/src/main/resources/mybatis/mapping/SysUserDao.xml b/src/main/resources/mybatis/mapping/SysUserDao.xml index b3f951b..0261fc5 100644 --- a/src/main/resources/mybatis/mapping/SysUserDao.xml +++ b/src/main/resources/mybatis/mapping/SysUserDao.xml @@ -18,6 +18,12 @@ AND status = 1 + +