From bf4f552ebaa538be609bfeee53aed670077baeec Mon Sep 17 00:00:00 2001 From: SimonSun Date: Tue, 4 Sep 2018 15:10:10 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=8C=89=E5=A4=A9?= =?UTF-8?q?=E6=8C=89=E5=A4=A7=E5=B0=8F=E5=BD=92=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 426474d..13db401 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -9,9 +9,12 @@ ${log.dir}/${log.file.name}.log - - ${log.dir}/${log.file.name}-%d{yyyy-MM-dd}.log + + ${log.dir}/${log.file.name}-%d{yyyy-MM-dd}.%i.log + 30 + 1MB + 10MB ${log.pattern} -- Gitee From 7056db5ccd685bf6bbb6622babd7597d3cf62dd3 Mon Sep 17 00:00:00 2001 From: SimonSun Date: Tue, 4 Sep 2018 21:52:51 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0mysql=E5=BB=BA=E8=A1=A8sq?= =?UTF-8?q?l=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/schema-mysql.sql | 36 +++++++++++++++++------------ 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/main/resources/schema-mysql.sql b/src/main/resources/schema-mysql.sql index 520776b..83b9483 100644 --- a/src/main/resources/schema-mysql.sql +++ b/src/main/resources/schema-mysql.sql @@ -42,25 +42,31 @@ create table if NOT EXISTS oauth_code ( ); CREATE TABLE if NOT EXISTS users ( - id BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY, - username varchar(255) NOT NULL, - password varchar(255) NOT NULL, - enabled tinyint(1) NOT NULL, - phone varchar(255) DEFAULT NULL UNIQUE, - email varchar(255) DEFAULT NULL UNIQUE, - address varchar(255), - age int(4), - birth varchar(255), - head_photo varchar(255), - person_brief varchar(255), - sex tinyint(1), - visit_card varchar(255) + id bigint(20) not null auto_increment comment 'id', + username varchar(255) not null comment '用户名', + password varchar(255) not null comment '密码', + enabled tinyint(1) not null comment '有效', + phone varchar(255) comment '手机号', + email varchar(255) comment '邮箱', + address varchar(255) comment '地址', + age int(4) comment '年龄', + birth varchar(255) comment '生日', + head_photo varchar(255) comment '头像', + person_brief varchar(255) comment '个人简介', + sex tinyint(1) comment '性别', + visit_card varchar(255) comment '邀请码', + primary key (id), + key email (email), + key phone (phone) ); +alter table users comment '用户表'; CREATE TABLE if NOT EXISTS authorities ( -user_id BIGINT NOT NULL, -authority VARCHAR(50) NOT NULL + user_id bigint(20) not null comment '用户id', + authority varchar(50) not null comment '权限', + key ix_auth_username (user_id, authority) ); +alter table authorities comment '权限表'; -- 登录日志 CREATE TABLE IF NOT EXISTS log_login ( -- Gitee From 0ad024e3e06536d9ab3c81671e87946108f86b94 Mon Sep 17 00:00:00 2001 From: SimonSun Date: Tue, 4 Sep 2018 21:53:26 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/simon/common/code/CodeGenerator.java | 2 +- .../java/com/simon/common/code/FreeMarkerGeneratorUtil.java | 4 ++-- src/main/java/com/simon/common/code/TypeTranslator.java | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simon/common/code/CodeGenerator.java b/src/main/java/com/simon/common/code/CodeGenerator.java index 50b4ab6..b6b3db5 100644 --- a/src/main/java/com/simon/common/code/CodeGenerator.java +++ b/src/main/java/com/simon/common/code/CodeGenerator.java @@ -18,7 +18,7 @@ import java.util.*; */ public class CodeGenerator { - private static String BASE_PACKAGE;//项目基础包名称,根据自己的项目修改 + static String BASE_PACKAGE;//项目基础包名称,根据自己的项目修改 /*生成文件地址配置*/ private static String MODEL_PACKAGE;//生成的Model类所在包 diff --git a/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java b/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java index a926d35..226e98a 100644 --- a/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java +++ b/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java @@ -158,12 +158,12 @@ public class FreeMarkerGeneratorUtil { annotation = "@Id\n" + " @KeySql(genId = SnowflakeGenId.class)\n" + " @GeneratedValue(generator = \"sequenceId\")\n" + - " @GenericGenerator(name = \"sequenceId\", strategy = \"com.simon.common.utils.snowflake.SequenceId\")"; + " @GenericGenerator(name = \"sequenceId\", strategy = \"" + CodeGenerator.BASE_PACKAGE + ".common.utils.snowflake.SequenceId\")"; }else if(propertyType.equalsIgnoreCase("String")){ annotation = "@Id\n" + " @KeySql(genId = UUIdGenId.class)\n" + " @GeneratedValue(generator = \"uuid\")\n" + - " @GenericGenerator(name = \"uuid\", strategy = \"com.simon.common.utils.UuidGenerator\")"; + " @GenericGenerator(name = \"uuid\", strategy = \"" + CodeGenerator.BASE_PACKAGE + ".common.utils.UuidGenerator\")"; }else if(propertyType.equalsIgnoreCase("Integer")){ annotation = "@Id\n" + " @GeneratedValue(strategy = GenerationType.IDENTITY)"; diff --git a/src/main/java/com/simon/common/code/TypeTranslator.java b/src/main/java/com/simon/common/code/TypeTranslator.java index 8766dfc..816bd91 100644 --- a/src/main/java/com/simon/common/code/TypeTranslator.java +++ b/src/main/java/com/simon/common/code/TypeTranslator.java @@ -110,4 +110,9 @@ public class TypeTranslator { } return "String"; } + + public static String translateOracle(String columnType, String dataType){ + + return "String"; + } } -- Gitee From 08ae18fc4a397fd7315185bc679e97bad2e1ba80 Mon Sep 17 00:00:00 2001 From: SimonSun Date: Mon, 10 Sep 2018 17:29:54 +0800 Subject: [PATCH 4/9] =?UTF-8?q?mysql=E9=85=8D=E7=BD=AE=E4=BD=BF=E7=94=A8ut?= =?UTF-8?q?f8mb4=E7=BC=96=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-mysql.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application-mysql.yml b/src/main/resources/application-mysql.yml index 8cb745d..2c020d7 100644 --- a/src/main/resources/application-mysql.yml +++ b/src/main/resources/application-mysql.yml @@ -1,12 +1,15 @@ spring: datasource: + tomcat: + init-s-q-l: SET NAMES utf8mb4 # MySQL连接信息 driver-class-name: com.mysql.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf-8&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true username: ENC(YiYjVwTulDGN//YaB3KbuA==) #明文root password: ENC(BZUIhx1tIC75T4JTYROwbsPIRuhrPQMx) #明文19941017 druid: validation-query: SELECT 1 + connection-init-sqls: SET NAMES utf8mb4 #pagehelper分页插件 pagehelper: -- Gitee From 5964319e3732ad6ef4547b90c47e9b238ba2b04a Mon Sep 17 00:00:00 2001 From: SimonSun Date: Wed, 12 Sep 2018 17:49:01 +0800 Subject: [PATCH 5/9] =?UTF-8?q?mybatis=E4=BA=8C=E7=BA=A7=E7=BC=93=E5=AD=98?= =?UTF-8?q?=EF=BC=9B=E5=A2=9E=E5=8A=A0=E5=AD=97=E5=85=B8=E8=A1=A8=EF=BC=9B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0BaseController=EF=BC=9B=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=BD=BF=E7=94=A8mysql=E6=95=B0=E6=8D=AE=E5=BA=93=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 + .../com/simon/common/code/CodeGenerator.java | 2 +- .../com/simon/common/code/TypeTranslator.java | 108 ++++++++---- .../com/simon/common/config/Swagger2.java | 6 +- .../common/controller/BaseController.java | 42 +++++ .../java/com/simon/common/utils/DictUtil.java | 61 +++++++ .../com/simon/common/utils/SpringUtils.java | 63 +++++++ .../com/simon/mapper/DictTypeGroupMapper.java | 10 ++ .../java/com/simon/mapper/DictTypeMapper.java | 19 +++ src/main/java/com/simon/model/DictType.java | 62 +++++++ .../java/com/simon/model/DictTypeGroup.java | 54 ++++++ .../repository/DictTypeGroupRepository.java | 13 ++ .../simon/repository/DictTypeRepository.java | 13 ++ .../simon/service/DictTypeGroupService.java | 12 ++ .../com/simon/service/DictTypeService.java | 19 +++ .../impl/DictTypeGroupServiceImpl.java | 98 +++++++++++ .../service/impl/DictTypeServiceImpl.java | 103 ++++++++++++ src/main/resources/application.yml | 13 +- src/main/resources/code-gen.properties | 16 +- .../resources/mapping/DictTypeGroupMapper.xml | 16 ++ src/main/resources/mapping/DictTypeMapper.xml | 28 +++ src/main/resources/schema-mysql.sql | 159 +++++++++++++----- src/main/resources/schema-oracle.sql | 22 +-- src/main/resources/scheme-pg.sql | 58 +++++-- .../resources/templates/code/controller.ftl | 5 +- .../resources/templates/code/service-impl.ftl | 2 +- 26 files changed, 905 insertions(+), 106 deletions(-) create mode 100644 src/main/java/com/simon/common/controller/BaseController.java create mode 100644 src/main/java/com/simon/common/utils/DictUtil.java create mode 100644 src/main/java/com/simon/common/utils/SpringUtils.java create mode 100644 src/main/java/com/simon/mapper/DictTypeGroupMapper.java create mode 100644 src/main/java/com/simon/mapper/DictTypeMapper.java create mode 100644 src/main/java/com/simon/model/DictType.java create mode 100644 src/main/java/com/simon/model/DictTypeGroup.java create mode 100644 src/main/java/com/simon/repository/DictTypeGroupRepository.java create mode 100644 src/main/java/com/simon/repository/DictTypeRepository.java create mode 100644 src/main/java/com/simon/service/DictTypeGroupService.java create mode 100644 src/main/java/com/simon/service/DictTypeService.java create mode 100644 src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java create mode 100644 src/main/java/com/simon/service/impl/DictTypeServiceImpl.java create mode 100644 src/main/resources/mapping/DictTypeGroupMapper.xml create mode 100644 src/main/resources/mapping/DictTypeMapper.xml diff --git a/pom.xml b/pom.xml index 952e292..7d49247 100644 --- a/pom.xml +++ b/pom.xml @@ -321,6 +321,13 @@ [7.2.0, 7.2.99] + + + commons-beanutils + commons-beanutils + 1.9.3 + + diff --git a/src/main/java/com/simon/common/code/CodeGenerator.java b/src/main/java/com/simon/common/code/CodeGenerator.java index b6b3db5..26432d4 100644 --- a/src/main/java/com/simon/common/code/CodeGenerator.java +++ b/src/main/java/com/simon/common/code/CodeGenerator.java @@ -70,7 +70,7 @@ public class CodeGenerator { MAPPER_PACKAGE = BASE_PACKAGE + ".mapper"; REPOSITORY_PACKAGE = BASE_PACKAGE + ".repository"; SERVICE_PACKAGE = BASE_PACKAGE + ".service"; - SERVICE_IMPL_PACKAGE = BASE_PACKAGE + ".serviceImpl"; + SERVICE_IMPL_PACKAGE = BASE_PACKAGE + ".service.impl"; CONTROLLER_PACKAGE = BASE_PACKAGE + ".controller"; MAPPER_INTERFACE_REFERENCE = prop.getProperty("mapper_interface_reference"); diff --git a/src/main/java/com/simon/common/code/TypeTranslator.java b/src/main/java/com/simon/common/code/TypeTranslator.java index 816bd91..0792024 100644 --- a/src/main/java/com/simon/common/code/TypeTranslator.java +++ b/src/main/java/com/simon/common/code/TypeTranslator.java @@ -8,104 +8,152 @@ package com.simon.common.code; **/ public class TypeTranslator { - //https://documentation.progress.com/output/DataDirect/DataDirectCloud/index.html#page/queries%2Fmysql-data-types.html%23 + private static String BIT = "BIT"; + private static String BIT1 = "BIT(1)"; + private static String TINYINT = "TINYINT"; + private static String TINYINT1 = "TINYINT(1)"; + private static String SMALLINT = "SMALLINT"; + private static String MEDIUMINT = "MEDIUMINT"; + private static String INTEGER = "INTEGER"; + private static String INT = "INT"; + private static String YEAR = "YEAR"; + private static String UNSIGNED = "UNSIGNED"; + private static String BIGINT = "BIGINT"; + private static String FLOAT = "FLOAT"; + private static String DOUBLE = "DOUBLE"; + private static String DECIMAL = "DECIMAL"; + private static String NUMERIC = "NUMERIC"; + private static String DATE = "DATE"; + private static String TIME = "TIME"; + private static String DATETIME = "DATETIME"; + private static String TIMESTAMP = "TIMESTAMP"; + private static String VARCHAR = "VARCHAR"; + private static String CHAR = "CHAR"; + private static String TEXT = "TEXT"; + private static String BINARY = "BINARY"; + private static String BLOB = "BLOB"; + private static String SERIAL = "SERIAL"; + private static String BIGSERIAL = "BIGSERIAL"; + private static String CHARACTER = "CHARACTER"; + private static String BOOLEAN = "BOOLEAN"; + private static String BOOL = "BOOL"; + private static String REAL = "REAL"; + private static String BYTEA = "BYTEA"; + + /** + * 参考https://documentation.progress.com/output/DataDirect/DataDirectCloud/index.html#page/queries%2Fmysql-data-types.html%23 + * @param columnType 列类型 + * @param dataType 数据类型 + * @return java数据类型 + */ public static String translateMySQL(String columnType, String dataType){ columnType = columnType.toUpperCase(); dataType = dataType.toUpperCase(); - if(dataType.equals("BIT")){ - if(columnType.equals("BIT(1)")){ + if(dataType.contains(BIT)){ + if(BIT1.equals(dataType)){ return "Boolean"; }else{ return "Byte[]"; } } - if(dataType.equals("TINYINT")){ - if(columnType.equals("TINYINT(1)")){ + if(dataType.contains(TINYINT)){ + if(TINYINT1.equals(columnType)){ return "Boolean"; }else{ return "Integer"; } } - if(dataType.equals("SMALLINT")){ + if(BOOLEAN.equals(dataType) || BOOL.equals(dataType)){ + return "Boolean"; + } + if(SMALLINT.equals(dataType)){ return "Short"; } - if(dataType.equals("MEDIUMINT") || dataType.equals("YEAR") || dataType.equals("INT")){ + if(MEDIUMINT.equals(dataType) || YEAR.equals(dataType) || INT.equals(dataType)){ return "Integer"; } - if(dataType.contains("INTEGER")){ - if(dataType.contains("UNSIGNED")){ + if(dataType.contains(INTEGER)){ + if(dataType.contains(UNSIGNED)){ return "Long"; }else{ return "Integer"; } } - if(dataType.contains("BIGINT")){ - if(dataType.contains("UNSIGNED")){ + if(dataType.contains(BIGINT)){ + if(dataType.contains(UNSIGNED)){ return "BigInteger"; } return "Long"; } - if(dataType.equals("FLOAT")){ + if(FLOAT.equals(dataType)){ return "Float"; } - if(dataType.equals("DOUBLE")){ + if(DOUBLE.equals(dataType)){ return "Double"; } - if(dataType.equals("DECIMAL") || dataType.equals("NUMERIC")){ + if(DECIMAL.equals(dataType) || NUMERIC.equals(dataType)){ return "BigDecimal"; } - if(dataType.equals("DATE") || dataType.equals("DATETIME") || dataType.equals("TIMESTAMP") || dataType.equals("TIME")){ + if(DATE.equals(dataType) || DATETIME.equals(dataType) || TIMESTAMP.equals(dataType)){ return "Date"; } - if(dataType.contains("CHAR") || dataType.equals("TEXT")){ + if(TIME.equals(dataType)){ + return "Time"; + } + if(dataType.contains(CHAR) || TEXT.equals(dataType)){ return "String"; } - if(dataType.contains("BINARY") || dataType.equals("BLOB")){ + if(dataType.contains(BINARY) || BLOB.equals(dataType)){ return "Byte[]"; } return "String"; } - //https://documentation.progress.com/output/DataDirect/DataDirectCloud/index.html#page/queries/postgresql-data-types.html + /** + * 参考https://documentation.progress.com/output/DataDirect/DataDirectCloud/index.html#page/queries/postgresql-data-types.html + * @param columnType 列类型 + * @param dataType 数据类型 + * @return java数据类型 + */ public static String translatePostgreSQL(String columnType, String dataType){ columnType = columnType.toUpperCase(); dataType = dataType.toUpperCase(); - if(dataType.equals("BIT")){ - if(columnType.equals("BIT(1)")){ + if(dataType.contains(BIT)){ + if(BIT1.equals(dataType)){ return "Boolean"; }else{ return "Byte[]"; } } - if(dataType.equals("SMALLINT")){ + if(SMALLINT.equals(dataType)){ return "Short"; } - if(dataType.equals("INTEGER") || dataType.equals("SERIAL")){ + if(INTEGER.equals(dataType) || SERIAL.equals(dataType)){ return "Integer"; } - if(dataType.equals("BIGINT") || dataType.equals("BIGSERIAL")){ + if(BIGINT.equals(dataType) || BIGSERIAL.equals(dataType)){ return "Long"; } - if(dataType.contains("CHARACTER") || dataType.contains("TEXT")){ + if(dataType.contains(CHARACTER) || dataType.contains(TEXT)){ return "String"; } - if(dataType.equals("BOOLEAN")){ + if(BOOLEAN.equals(dataType)){ return "Boolean"; } - if(dataType.equals("DECIMAL") || dataType.equals("NUMERIC")){ + if(DECIMAL.equals(dataType) || NUMERIC.equals(dataType)){ return "BigDecimal"; } - if(dataType.equals("REAL")){ + if(REAL.equals(dataType)){ return "Float"; } - if(dataType.contains("DOUBLE")){ + if(dataType.contains(DOUBLE)){ return "Double"; } - if(dataType.contains("TIME") || dataType.equals("DATE")){ + if(dataType.contains(TIME) || DATE.equals(dataType)){ return "Date"; } - if(dataType.equals("BYTEA")){ + if(BYTEA.equals(dataType)){ return "Byte[]"; } return "String"; diff --git a/src/main/java/com/simon/common/config/Swagger2.java b/src/main/java/com/simon/common/config/Swagger2.java index ae54eba..d55a08b 100644 --- a/src/main/java/com/simon/common/config/Swagger2.java +++ b/src/main/java/com/simon/common/config/Swagger2.java @@ -12,7 +12,9 @@ import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; +import java.sql.Time; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -62,7 +64,9 @@ public class Swagger2 { .paths(PathSelectors.regex("^(?!oauth).*$")) .build() .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()); + .securityContexts(securityContexts()) + .directModelSubstitute(Date.class, String.class) + .directModelSubstitute(Time.class, String.class); } private ApiInfo apiInfo() { diff --git a/src/main/java/com/simon/common/controller/BaseController.java b/src/main/java/com/simon/common/controller/BaseController.java new file mode 100644 index 0000000..87508c4 --- /dev/null +++ b/src/main/java/com/simon/common/controller/BaseController.java @@ -0,0 +1,42 @@ +package com.simon.common.controller; + +import org.springframework.beans.propertyeditors.CustomDateEditor; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +import java.sql.Time; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Base Controller + * + * @author simon + * @create 2018-09-06 17:49 + **/ + +public class BaseController { + /** + * 字符串绑定Date类型 + * @param binder + */ + @InitBinder + protected void initDateBinder(WebDataBinder binder) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + dateFormat.setLenient(false); + //第二个参数是控制是否支持传入的值是空,这个值很关键,如果指定为false,那么如果前台没有传值的话就会报错 + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); + } + + /** + * 字符串绑定Time类型 + * @param binder + */ + @InitBinder + protected void initTimeBinder(WebDataBinder binder){ + SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss"); + dateFormat.setLenient(false); + //第二个参数是控制是否支持传入的值是空,这个值很关键,如果指定为false,那么如果前台没有传值的话就会报错 + binder.registerCustomEditor(Time.class, new CustomDateEditor(dateFormat, true)); + } +} diff --git a/src/main/java/com/simon/common/utils/DictUtil.java b/src/main/java/com/simon/common/utils/DictUtil.java new file mode 100644 index 0000000..e832fb6 --- /dev/null +++ b/src/main/java/com/simon/common/utils/DictUtil.java @@ -0,0 +1,61 @@ +package com.simon.common.utils; + +import com.google.common.base.Joiner; +import com.simon.model.DictType; +import com.simon.service.DictTypeService; +import lombok.var; +import org.apache.commons.lang3.StringUtils; +import org.springframework.context.ApplicationContext; + +import java.util.List; + +/** + * 字典工具类 + * + * @author simon + * @create 2018-09-06 11:25 + **/ + +public class DictUtil { + private static ApplicationContext applicationContext = SpringUtils.getApplicationContext(); + private static DictTypeService dictTypeService = applicationContext.getBean(DictTypeService.class); + + public static String getTypeName(String groupCode, String typeCode){ + var types = dictTypeService.getTypeByGroupCode(groupCode); + if(null == types || types.size() <= 0){ + return null; + } + if(StringUtils.isEmpty(typeCode)){ + return null; + } + + String[] typeCodes = typeCode.split(","); + String[] typeCodeNames = new String[typeCodes.length]; + + for(var i = 0; i < typeCodes.length; i++){ + var code = typeCodes[i]; + for(var j = 0; j < types.size(); j++){ + var type = types.get(j); + if(code.equals(type.getTypeCode())){ + typeCodeNames[i] = type.getTypeName(); + break; + } + } + if(StringUtils.isEmpty(typeCodeNames[i])){ + typeCodeNames[i] = ""; + } + } + + //数组合并成字符串,用逗号隔开 + return Joiner.on(",").join(typeCodeNames); + } + + /** + * 获取字典组编码对应的字典列表 + * @param groupCode + * @return + */ + public static List getTypeNames(String groupCode){ + return dictTypeService.getTypeByGroupCode(groupCode); + } +} diff --git a/src/main/java/com/simon/common/utils/SpringUtils.java b/src/main/java/com/simon/common/utils/SpringUtils.java new file mode 100644 index 0000000..a60214d --- /dev/null +++ b/src/main/java/com/simon/common/utils/SpringUtils.java @@ -0,0 +1,63 @@ +package com.simon.common.utils; + + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * @author simon + */ +@Component +public class SpringUtils implements ApplicationContextAware { + + private static ApplicationContext applicationContext = null; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + if(SpringUtils.applicationContext == null){ + SpringUtils.applicationContext = applicationContext; + } + } + + + /** + * 获取applicationContext + * @return + */ + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + /** + * 通过name获取 Bean. + * @param name + * @return + */ + public static Object getBean(String name){ + return getApplicationContext().getBean(name); + } + + /** + * 通过class获取Bean. + * @param clazz + * @param + * @return + */ + public static T getBean(Class clazz){ + return getApplicationContext().getBean(clazz); + } + + /** + * 通过name,以及Clazz返回指定的Bean + * @param name + * @param clazz + * @param + * @return + */ + public static T getBean(String name,Class clazz){ + return getApplicationContext().getBean(name, clazz); + } + +} \ No newline at end of file diff --git a/src/main/java/com/simon/mapper/DictTypeGroupMapper.java b/src/main/java/com/simon/mapper/DictTypeGroupMapper.java new file mode 100644 index 0000000..6ba266c --- /dev/null +++ b/src/main/java/com/simon/mapper/DictTypeGroupMapper.java @@ -0,0 +1,10 @@ +package com.simon.mapper; + +import com.simon.common.mapper.MyMapper; +import com.simon.model.DictTypeGroup; + +/** + * @author simon + */ +public interface DictTypeGroupMapper extends MyMapper { +} \ No newline at end of file diff --git a/src/main/java/com/simon/mapper/DictTypeMapper.java b/src/main/java/com/simon/mapper/DictTypeMapper.java new file mode 100644 index 0000000..18d51bc --- /dev/null +++ b/src/main/java/com/simon/mapper/DictTypeMapper.java @@ -0,0 +1,19 @@ +package com.simon.mapper; + +import com.simon.common.mapper.MyMapper; +import com.simon.model.DictType; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author simon + */ +public interface DictTypeMapper extends MyMapper { + /** + * 根据字典组编码查询字典列表 + * @param groupCode + * @return + */ + List getByGroupCode(@Param("groupCode") String groupCode); +} \ No newline at end of file diff --git a/src/main/java/com/simon/model/DictType.java b/src/main/java/com/simon/model/DictType.java new file mode 100644 index 0000000..c55b903 --- /dev/null +++ b/src/main/java/com/simon/model/DictType.java @@ -0,0 +1,62 @@ +package com.simon.model; + +import com.simon.common.utils.SnowflakeGenId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.annotations.GenericGenerator; +import tk.mybatis.mapper.annotation.KeySql; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +@ApiModel(description = "DictType") +@Data +@Entity +@Table(name="t_dict_type") +public class DictType implements Serializable{ + private static final long serialVersionUID = 1L; + + @Id + @KeySql(genId = SnowflakeGenId.class) + @GeneratedValue(generator = "sequenceId") + @GenericGenerator(name = "sequenceId", strategy = "com.boya.common.utils.snowflake.SequenceId") + private Long id; + + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + + @ApiModelProperty(value = "字典编码") + @Column(name = "type_code", nullable = false) + private String typeCode; + + @ApiModelProperty(value = "字典编码名称") + @Column(name = "type_name", nullable = false) + private String typeName; + + @ApiModelProperty(value = "字典组id") + @Column(name = "type_group_id", nullable = false) + private Long typeGroupId; + + @ApiModelProperty(value = "排序") + @Column(name = "order_num") + private Integer orderNum; +} \ No newline at end of file diff --git a/src/main/java/com/simon/model/DictTypeGroup.java b/src/main/java/com/simon/model/DictTypeGroup.java new file mode 100644 index 0000000..f9da7ed --- /dev/null +++ b/src/main/java/com/simon/model/DictTypeGroup.java @@ -0,0 +1,54 @@ +package com.simon.model; + +import com.simon.common.utils.SnowflakeGenId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.annotations.GenericGenerator; +import tk.mybatis.mapper.annotation.KeySql; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +@ApiModel(description = "DictTypeGroup") +@Data +@Entity +@Table(name="t_dict_type_group") +public class DictTypeGroup implements Serializable{ + private static final long serialVersionUID = 1L; + + @Id + @KeySql(genId = SnowflakeGenId.class) + @GeneratedValue(generator = "sequenceId") + @GenericGenerator(name = "sequenceId", strategy = "com.boya.common.utils.snowflake.SequenceId") + private Long id; + + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + + @ApiModelProperty(value = "字典组编码") + @Column(name = "type_group_code", nullable = false) + private String typeGroupCode; + + @ApiModelProperty(value = "字典组名称") + @Column(name = "type_group_name", nullable = false) + private String typeGroupName; +} \ No newline at end of file diff --git a/src/main/java/com/simon/repository/DictTypeGroupRepository.java b/src/main/java/com/simon/repository/DictTypeGroupRepository.java new file mode 100644 index 0000000..473f333 --- /dev/null +++ b/src/main/java/com/simon/repository/DictTypeGroupRepository.java @@ -0,0 +1,13 @@ +package com.simon.repository; + +import com.simon.model.DictTypeGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +@Repository +public interface DictTypeGroupRepository extends JpaRepository { +} diff --git a/src/main/java/com/simon/repository/DictTypeRepository.java b/src/main/java/com/simon/repository/DictTypeRepository.java new file mode 100644 index 0000000..eeeb25d --- /dev/null +++ b/src/main/java/com/simon/repository/DictTypeRepository.java @@ -0,0 +1,13 @@ +package com.simon.repository; + +import com.simon.model.DictType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +@Repository +public interface DictTypeRepository extends JpaRepository { +} diff --git a/src/main/java/com/simon/service/DictTypeGroupService.java b/src/main/java/com/simon/service/DictTypeGroupService.java new file mode 100644 index 0000000..f6ef52c --- /dev/null +++ b/src/main/java/com/simon/service/DictTypeGroupService.java @@ -0,0 +1,12 @@ +package com.simon.service; + +import com.simon.common.service.BasicService; +import com.simon.model.DictTypeGroup; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +public interface DictTypeGroupService extends BasicService { + +} \ No newline at end of file diff --git a/src/main/java/com/simon/service/DictTypeService.java b/src/main/java/com/simon/service/DictTypeService.java new file mode 100644 index 0000000..a2628b2 --- /dev/null +++ b/src/main/java/com/simon/service/DictTypeService.java @@ -0,0 +1,19 @@ +package com.simon.service; + +import com.simon.common.service.BasicService; +import com.simon.model.DictType; + +import java.util.List; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +public interface DictTypeService extends BasicService { + /** + * 根据字典组编码查询字典列表 + * @param groupCode 字典组编码 + * @return + */ + List getTypeByGroupCode(String groupCode); +} \ No newline at end of file diff --git a/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java b/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java new file mode 100644 index 0000000..4fd43c9 --- /dev/null +++ b/src/main/java/com/simon/service/impl/DictTypeGroupServiceImpl.java @@ -0,0 +1,98 @@ + +package com.simon.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simon.common.config.AppConfig; +import com.simon.mapper.DictTypeGroupMapper; +import com.simon.model.DictTypeGroup; +import com.simon.repository.DictTypeGroupRepository; +import com.simon.service.DictTypeGroupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +@Service +@Transactional(rollbackFor = {Exception.class}) +public class DictTypeGroupServiceImpl implements DictTypeGroupService { + @Autowired + private DictTypeGroupMapper dictTypeGroupMapper; + + @Autowired + private DictTypeGroupRepository dictTypeGroupRepository; + + @Override + public DictTypeGroup save(DictTypeGroup dictTypeGroup){ + return dictTypeGroupRepository.save(dictTypeGroup); + } + + @Override + public List save(List dictTypeGroupList) { + return dictTypeGroupRepository.save(dictTypeGroupList); + } + + @Override + public PageInfo findAll(int pageNo){ + PageHelper.startPage(pageNo, AppConfig.DEFAULT_PAGE_SIZE); + List list = dictTypeGroupMapper.selectAll(); + return new PageInfo<>(list); + } + + @Override + public Page findAll(Pageable pageable){ + return dictTypeGroupRepository.findAll(pageable); + } + + @Override + public List findAll(){ + return dictTypeGroupRepository.findAll(); + } + + @Override + public void delete(Long id){ + dictTypeGroupRepository.delete(id); + } + + @Override + public int deleteByIds(String ids){ + return dictTypeGroupMapper.deleteByIds(ids); + } + + @Override + public DictTypeGroup findById(Long id){ + return dictTypeGroupRepository.findOne(id); + } + + @Override + public int insertList(List list){ + return dictTypeGroupMapper.insertList(list); + } + + @Override + public int insert(DictTypeGroup dictTypeGroup){ + return dictTypeGroupMapper.insert(dictTypeGroup); + } + + @Override + public int insertSelective(DictTypeGroup dictTypeGroup){ + return dictTypeGroupMapper.insertSelective(dictTypeGroup); + } + + @Override + public int updateByPrimaryKey(DictTypeGroup dictTypeGroup){ + return dictTypeGroupMapper.updateByPrimaryKey(dictTypeGroup); + } + + @Override + public int updateByPrimaryKeySelective(DictTypeGroup dictTypeGroup){ + return dictTypeGroupMapper.updateByPrimaryKeySelective(dictTypeGroup); + } +} \ No newline at end of file diff --git a/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java b/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java new file mode 100644 index 0000000..8447489 --- /dev/null +++ b/src/main/java/com/simon/service/impl/DictTypeServiceImpl.java @@ -0,0 +1,103 @@ + +package com.simon.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simon.common.config.AppConfig; +import com.simon.mapper.DictTypeMapper; +import com.simon.model.DictType; +import com.simon.repository.DictTypeRepository; +import com.simon.service.DictTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** +* @author SimonSun +* @date 2018-09-06 10:03:50 +**/ +@Service +@Transactional(rollbackFor = {Exception.class}) +public class DictTypeServiceImpl implements DictTypeService { + @Autowired + private DictTypeMapper dictTypeMapper; + + @Autowired + private DictTypeRepository dictTypeRepository; + + @Override + public DictType save(DictType dictType){ + return dictTypeRepository.save(dictType); + } + + @Override + public List save(List dictTypeList) { + return dictTypeRepository.save(dictTypeList); + } + + @Override + public PageInfo findAll(int pageNo){ + PageHelper.startPage(pageNo, AppConfig.DEFAULT_PAGE_SIZE); + List list = dictTypeMapper.selectAll(); + return new PageInfo<>(list); + } + + @Override + public Page findAll(Pageable pageable){ + return dictTypeRepository.findAll(pageable); + } + + @Override + public List findAll(){ + return dictTypeRepository.findAll(); + } + + @Override + public void delete(Long id){ + dictTypeRepository.delete(id); + } + + @Override + public int deleteByIds(String ids){ + return dictTypeMapper.deleteByIds(ids); + } + + @Override + public DictType findById(Long id){ + return dictTypeRepository.findOne(id); + } + + @Override + public int insertList(List list){ + return dictTypeMapper.insertList(list); + } + + @Override + public int insert(DictType dictType){ + return dictTypeMapper.insert(dictType); + } + + @Override + public int insertSelective(DictType dictType){ + return dictTypeMapper.insertSelective(dictType); + } + + @Override + public int updateByPrimaryKey(DictType dictType){ + return dictTypeMapper.updateByPrimaryKey(dictType); + } + + @Override + public int updateByPrimaryKeySelective(DictType dictType){ + return dictTypeMapper.updateByPrimaryKeySelective(dictType); + } + + @Override + public List getTypeByGroupCode(String groupCode) { + return dictTypeMapper.getByGroupCode(groupCode); + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 7e3da00..ead4271 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,7 +5,7 @@ security: enabled: false spring: profiles: - active: pg #pg, mysql, oracle。默认使用PostgreSQL数据库连接配置。 + active: mysql #pg, mysql, oracle。默认使用PostgreSQL数据库连接配置。 thymeleaf: prefix: classpath:/templates/ #默认值 suffix: .html @@ -64,7 +64,7 @@ spring: cache-names: userDetailsCache,oauthUserCache jpa: hibernate: - ddl-auto: update + ddl-auto: validate show-sql: true jackson: serialization: true @@ -121,5 +121,10 @@ management: # mybatis配置 mybatis: - mapper-locations: classpath:/mapping/*Mapper.xml - type-aliases-package: com.simon.model \ No newline at end of file + check-config-location: false + type-aliases-package: com.simon.model + configuration: + map-underscore-to-camel-case: true + # 二级缓存的总开关 + cache-enabled: true + mapper-locations: classpath:mapping/*.xml \ No newline at end of file diff --git a/src/main/resources/code-gen.properties b/src/main/resources/code-gen.properties index aadffc7..4340b35 100644 --- a/src/main/resources/code-gen.properties +++ b/src/main/resources/code-gen.properties @@ -1,15 +1,15 @@ # # MySQL -#jdbc_url=jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf-8&useSSL=false -#jdbc_username=root -#jdbc_password=19941017 -#jdbc_driver_class_name=com.mysql.jdbc.Driver +jdbc_url=jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true +jdbc_username=root +jdbc_password=19941017 +jdbc_driver_class_name=com.mysql.jdbc.Driver # PostgreSQL -jdbc_url=jdbc:postgresql://127.0.0.1:5432/thymelte?useUnicode=true&characterEncoding=UTF-8 -jdbc_username=postgres -jdbc_password=19961120 -jdbc_driver_class_name=org.postgresql.Driver +#jdbc_url=jdbc:postgresql://127.0.0.1:5432/thymelte?useUnicode=true&characterEncoding=UTF-8 +#jdbc_username=postgres +#jdbc_password=19961120 +#jdbc_driver_class_name=org.postgresql.Driver # Oracle #jdbc_url=jdbc:oracle:thin:@localhost:1521:orcl diff --git a/src/main/resources/mapping/DictTypeGroupMapper.xml b/src/main/resources/mapping/DictTypeGroupMapper.xml new file mode 100644 index 0000000..344a89a --- /dev/null +++ b/src/main/resources/mapping/DictTypeGroupMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapping/DictTypeMapper.xml b/src/main/resources/mapping/DictTypeMapper.xml new file mode 100644 index 0000000..cd43045 --- /dev/null +++ b/src/main/resources/mapping/DictTypeMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/schema-mysql.sql b/src/main/resources/schema-mysql.sql index 83b9483..2c6e85a 100644 --- a/src/main/resources/schema-mysql.sql +++ b/src/main/resources/schema-mysql.sql @@ -1,6 +1,6 @@ -- MySQL create table if NOT EXISTS oauth_client_details ( - client_id VARCHAR(255) PRIMARY KEY, + client_id VARCHAR(36) PRIMARY KEY, resource_ids VARCHAR(255), client_secret VARCHAR(255), scope VARCHAR(255), @@ -14,25 +14,25 @@ create table if NOT EXISTS oauth_client_details ( ); create table if NOT EXISTS oauth_client_token ( - token_id VARCHAR(255), + token_id VARCHAR(36), token BLOB, - authentication_id VARCHAR(255), + authentication_id VARCHAR(36), user_name VARCHAR(255), - client_id VARCHAR(255) + client_id VARCHAR(36) ); create table if NOT EXISTS oauth_access_token ( - token_id VARCHAR(255), + token_id VARCHAR(36), token BLOB, - authentication_id VARCHAR(255), + authentication_id VARCHAR(36), user_name VARCHAR(255), - client_id VARCHAR(255), + client_id VARCHAR(36), authentication BLOB, refresh_token VARCHAR(255) ); create table if NOT EXISTS oauth_refresh_token ( - token_id VARCHAR(255), + token_id VARCHAR(36), token BLOB, authentication BLOB ); @@ -41,44 +41,72 @@ create table if NOT EXISTS oauth_code ( code VARCHAR(255), authentication BLOB ); -CREATE TABLE if NOT EXISTS users ( +/*==============================================================*/ +/* Table: t_users */ +/*==============================================================*/ +create table if NOT EXISTS t_users +( id bigint(20) not null auto_increment comment 'id', - username varchar(255) not null comment '用户名', - password varchar(255) not null comment '密码', + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', + username national varchar(255) not null comment '用户名', + password national varchar(255) not null comment '密码', enabled tinyint(1) not null comment '有效', - phone varchar(255) comment '手机号', - email varchar(255) comment '邮箱', - address varchar(255) comment '地址', + phone national varchar(255) comment '手机号', + email national varchar(255) comment '邮箱', + ssoid national varchar(255) comment 'oppo账号ssoid', + album_id bigint(20) comment '播放列表id', + address national varchar(255) comment '地址', age int(4) comment '年龄', - birth varchar(255) comment '生日', - head_photo varchar(255) comment '头像', - person_brief varchar(255) comment '个人简介', + birth national varchar(255) comment '生日', + head_photo national varchar(255) comment '头像', + person_brief national varchar(255) comment '个人简介', sex tinyint(1) comment '性别', - visit_card varchar(255) comment '邀请码', + visit_card national varchar(255) comment '邀请码', + login_type int(4) comment '登录方式', + login_status varchar(25) comment '登录状态', + login_date datetime comment '登录时间', primary key (id), key email (email), key phone (phone) ); -alter table users comment '用户表'; -CREATE TABLE if NOT EXISTS authorities ( +alter table t_users comment '用户表'; + +CREATE TABLE if NOT EXISTS t_authorities ( + id bigint(20) not null auto_increment comment 'id', + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', user_id bigint(20) not null comment '用户id', authority varchar(50) not null comment '权限', + primary key (id), key ix_auth_username (user_id, authority) ); -alter table authorities comment '权限表'; +alter table t_authorities comment '权限表'; -- 登录日志 -CREATE TABLE IF NOT EXISTS log_login ( +CREATE TABLE IF NOT EXISTS t_log_login ( id BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY, + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', create_time datetime(0), ip varchar(255), username varchar(255) ); -- 重置密码 -CREATE TABLE IF NOT EXISTS reset_pwd_info ( +CREATE TABLE IF NOT EXISTS t_reset_pwd_info ( id BIGINT AUTO_INCREMENT NOT NULL primary key, + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', expires_in timestamp(6), secret_key varchar(255), user_id bigint, @@ -86,8 +114,12 @@ valid bool NOT NULL ); -- 验证码 -CREATE TABLE IF NOT EXISTS veri_code ( +CREATE TABLE IF NOT EXISTS t_veri_code ( id BIGINT AUTO_INCREMENT NOT null primary key, + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', code int(4), create_time int(8), expires int(4), @@ -95,8 +127,12 @@ phone varchar(255) ); -- 二维码(用于扫码登录) -CREATE TABLE IF NOT EXISTS qr_code ( +CREATE TABLE IF NOT EXISTS t_qr_code ( id BIGINT AUTO_INCREMENT not null primary key, + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', is_ok bool, sid varchar(255), token varchar(255), @@ -104,8 +140,12 @@ username varchar(255) ); -- 新闻 -CREATE TABLE IF NOT EXISTS news_info ( +CREATE TABLE IF NOT EXISTS t_news_info ( id BIGINT AUTO_INCREMENT not null primary key, + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', title varchar(255), user_id bigint, status int(4), @@ -116,30 +156,73 @@ tags varchar(255) ); -- 新闻标签 -CREATE TABLE IF NOT EXISTS news_tag ( +CREATE TABLE IF NOT EXISTS t_news_tag ( id BIGINT AUTO_INCREMENT not null primary key, + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', news_info_id bigint, tag_id bigint ); +/*==============================================================*/ +/* Table: t_dict_type */ +/*==============================================================*/ +create table if NOT EXISTS t_dict_type +( + id bigint(20) not null auto_increment comment 'id', + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', + type_code national varchar(255) not null comment '字典编码', + type_name national varchar(255) not null comment '字典编码名称', + type_group_id bigint(20) not null comment '字典组id', + order_num int(4) comment '排序', + primary key (id) +); + +alter table t_dict_type comment '字典'; + +/*==============================================================*/ +/* Table: t_dict_type_group */ +/*==============================================================*/ +create table if NOT EXISTS t_dict_type_group +( + id bigint(20) not null auto_increment comment 'id', + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', + type_group_code national varchar(255) not null comment '字典组编码', + type_group_name national varchar(255) not null comment '字典组名称', + primary key (id) +); + +alter table t_dict_type_group comment '字典组'; + -- 两列唯一索引 -set @x := (select count(*) from information_schema.statistics where table_name = 'authorities' and index_name = 'ix_auth_username' and table_schema = database()); -set @sql := if( @x > 0, 'select ''Index exists.''', 'CREATE UNIQUE INDEX ix_auth_username ON authorities(user_id, authority)'); +set @x := (select count(*) from information_schema.statistics where table_name = 't_authorities' and index_name = 'ix_auth_username' and table_schema = database()); +set @sql := if( @x > 0, 'select ''Index exists.''', 'CREATE UNIQUE INDEX ix_auth_username ON t_authorities(user_id, authority)'); PREPARE stmt FROM @sql; EXECUTE stmt; -- 添加外键 -ALTER TABLE authorities ADD FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE NO ACTION ON UPDATE NO ACTION; +ALTER TABLE t_authorities ADD FOREIGN KEY (user_id) REFERENCES t_users (id) ON DELETE NO ACTION ON UPDATE NO ACTION; + +alter table t_dict_type add constraint fk_type_group_id foreign key (type_group_id) + references t_dict_type_group (id) on delete restrict on update restrict; -- 密码经过了加密,是secret -- INSERT INTO oauth_client_details VALUES ('clientIdPassword', 'oauth2-resource', '$2a$11$uBcjOC6qWFpxkQJtPyMhPOweH.8gP3Ig1mt27mGDpBncR7gErOuF6', 'read,write,trust', 'password,authorization_code,refresh_token', null, 'ROLE_ADMIN,ROLE_USER', 7200, 5184000, null, 'false'); -- 密码经过了加密,全都是1234567890c -INSERT INTO users (id, username, password, enabled, email, phone) VALUES (1, 'jeesun', '$2a$11$t4akVchfgOv00XxB/ZKLlOmweUoL/Aed4CiJqQjaiRLZpBU3AWfxu', true, 'simon.sun.dev@hotmail.com', '18362102427'); -INSERT INTO users (id, username, password, enabled, email, phone) VALUES (2, 'user2711', '$2a$11$BUiKPp8.pcym7sxXYPvZeOjl0BOoVl3PZT.1Wfb3kmIgooO/GfQ4G', true, '18860902711@163.com', '18860902711'); -INSERT INTO users (id, username, password, enabled, email, phone) VALUES (3, 'user6745', '$2a$11$a7XDbu2RvLjZdr4kCvqh2u7gwVXhwxdauIzbX3ZizbBU.HeV8BOky', true, null, '18550046745'); - -INSERT INTO authorities VALUES (1, 'ROLE_ADMIN'); -INSERT INTO authorities VALUES (1, 'ROLE_USER'); -INSERT INTO authorities VALUES (2, 'ROLE_USER'); -INSERT INTO authorities VALUES (3, 'ROLE_USER'); +INSERT INTO t_users (id, username, password, enabled, email, phone) VALUES (1, 'jeesun', '$2a$11$t4akVchfgOv00XxB/ZKLlOmweUoL/Aed4CiJqQjaiRLZpBU3AWfxu', true, 'simon.sun.dev@hotmail.com', '18362102427'); +INSERT INTO t_users (id, username, password, enabled, email, phone) VALUES (2, 'user2711', '$2a$11$BUiKPp8.pcym7sxXYPvZeOjl0BOoVl3PZT.1Wfb3kmIgooO/GfQ4G', true, '18860902711@163.com', '18860902711'); +INSERT INTO t_users (id, username, password, enabled, email, phone) VALUES (3, 'user6745', '$2a$11$a7XDbu2RvLjZdr4kCvqh2u7gwVXhwxdauIzbX3ZizbBU.HeV8BOky', true, null, '18550046745'); + +INSERT INTO t_authorities VALUES (1, 'ROLE_ADMIN'); +INSERT INTO t_authorities VALUES (1, 'ROLE_USER'); +INSERT INTO t_authorities VALUES (2, 'ROLE_USER'); +INSERT INTO t_authorities VALUES (3, 'ROLE_USER'); diff --git a/src/main/resources/schema-oracle.sql b/src/main/resources/schema-oracle.sql index 01c0af6..df06602 100644 --- a/src/main/resources/schema-oracle.sql +++ b/src/main/resources/schema-oracle.sql @@ -1,6 +1,6 @@ -- used in tests that use HSQL create table oauth_client_details ( - client_id VARCHAR(256) PRIMARY KEY, + client_id VARCHAR(36) PRIMARY KEY, resource_ids VARCHAR(256), client_secret VARCHAR(256), scope VARCHAR(256), @@ -14,25 +14,25 @@ create table oauth_client_details ( ); create table oauth_client_token ( - token_id VARCHAR(256), + token_id VARCHAR(36), token BLOB, - authentication_id VARCHAR(256) PRIMARY KEY, + authentication_id VARCHAR(36) PRIMARY KEY, user_name VARCHAR(256), - client_id VARCHAR(256) + client_id VARCHAR(36) ); create table oauth_access_token ( - token_id VARCHAR(256), + token_id VARCHAR(36), token BLOB, - authentication_id VARCHAR(256) PRIMARY KEY, + authentication_id VARCHAR(36) PRIMARY KEY, user_name VARCHAR(256), - client_id VARCHAR(256), + client_id VARCHAR(36), authentication BLOB, refresh_token VARCHAR(256) ); create table oauth_refresh_token ( - token_id VARCHAR(256), + token_id VARCHAR(36), token BLOB, authentication BLOB ); @@ -42,8 +42,8 @@ create table oauth_code ( ); create table oauth_approvals ( - userId VARCHAR(256), - clientId VARCHAR(256), + userId VARCHAR(36), + clientId VARCHAR(36), scope VARCHAR(256), status VARCHAR(10), expiresAt TIMESTAMP, @@ -52,7 +52,7 @@ create table oauth_approvals ( -- customized oauth_client_details table create table ClientDetails ( - appId VARCHAR(256) PRIMARY KEY, + appId VARCHAR(36) PRIMARY KEY, resourceIds VARCHAR(256), appSecret VARCHAR(256), scope VARCHAR(256), diff --git a/src/main/resources/scheme-pg.sql b/src/main/resources/scheme-pg.sql index c309887..4167b5b 100644 --- a/src/main/resources/scheme-pg.sql +++ b/src/main/resources/scheme-pg.sql @@ -1,6 +1,6 @@ -- PostgreSQL CREATE TABLE IF NOT EXISTS oauth_client_details ( - client_id VARCHAR(256) PRIMARY KEY, + client_id VARCHAR(36) PRIMARY KEY, resource_ids VARCHAR(256), client_secret VARCHAR(256), scope VARCHAR(256), @@ -14,25 +14,25 @@ CREATE TABLE IF NOT EXISTS oauth_client_details ( ); CREATE TABLE IF NOT EXISTS oauth_client_token ( - token_id VARCHAR(256), + token_id VARCHAR(36), token bytea, - authentication_id VARCHAR(256), + authentication_id VARCHAR(36), user_name VARCHAR(256), - client_id VARCHAR(256) + client_id VARCHAR(36) ); CREATE TABLE IF NOT EXISTS oauth_access_token ( - token_id VARCHAR(256), + token_id VARCHAR(36), token bytea, - authentication_id VARCHAR(256), + authentication_id VARCHAR(36), user_name VARCHAR(256), - client_id VARCHAR(256), + client_id VARCHAR(36), authentication bytea, refresh_token VARCHAR(256) ); CREATE TABLE IF NOT EXISTS oauth_refresh_token ( - token_id VARCHAR(256), + token_id VARCHAR(36), token bytea, authentication bytea ); @@ -42,8 +42,8 @@ CREATE TABLE IF NOT EXISTS oauth_code ( ); CREATE TABLE IF NOT EXISTS oauth_approvals ( - userId VARCHAR(256), - clientId VARCHAR(256), + userId VARCHAR(36), + clientId VARCHAR(36), scope VARCHAR(256), status VARCHAR(10), expiresAt TIMESTAMP, @@ -126,6 +126,42 @@ news_info_id bigint, tag_id bigint ); +/*==============================================================*/ +/* Table: t_dict_type */ +/*==============================================================*/ +create table if NOT EXISTS t_dict_type +( + id bigint(20) not null auto_increment comment 'id', + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', + type_code national varchar(255) not null comment '字典编码', + type_name national varchar(255) not null comment '字典编码名称', + type_group_id bigint(20) not null comment '字典组id', + order_num int(4) comment '排序', + primary key (id) +); + +alter table t_dict_type comment '字典'; + +/*==============================================================*/ +/* Table: t_dict_type_group */ +/*==============================================================*/ +create table if NOT EXISTS t_dict_type_group +( + id bigint(20) not null auto_increment comment 'id', + create_by bigint(20) comment '创建人id', + create_date datetime comment '创建时间', + update_by bigint(20) comment '更新人id', + update_date datetime comment '更新时间', + type_group_code national varchar(255) not null comment '字典组编码', + type_group_name national varchar(255) not null comment '字典组名称', + primary key (id) +); + +alter table t_dict_type_group comment '字典组'; + -- 自增序列 CREATE SEQUENCE if NOT EXISTS users_id_seq; ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'); @@ -147,6 +183,8 @@ CREATE UNIQUE INDEX if NOT EXISTS ix_auth_username ON authorities (user_id, auth -- 添加外键 ALTER TABLE authorities ADD FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE NO ACTION ON UPDATE NO ACTION; +alter table t_dict_type add constraint fk_type_group_id foreign key (type_group_id) + references t_dict_type_group (id) on delete restrict on update restrict; -- 密码经过了加密,是secret -- INSERT INTO oauth_client_details VALUES ('clientIdPassword', 'oauth2-resource', '$2a$11$uBcjOC6qWFpxkQJtPyMhPOweH.8gP3Ig1mt27mGDpBncR7gErOuF6', 'read,write,trust', 'password,authorization_code,refresh_token', null, 'ROLE_ADMIN,ROLE_USER', 7200, 5184000, null, 'false'); diff --git a/src/main/resources/templates/code/controller.ftl b/src/main/resources/templates/code/controller.ftl index ed3064a..3f37e6e 100644 --- a/src/main/resources/templates/code/controller.ftl +++ b/src/main/resources/templates/code/controller.ftl @@ -1,5 +1,6 @@ package ${basePackage}.controller; +import ${basePackage}.common.controller.BaseController; import ${basePackage}.model.${modelNameUpperCamel}; import ${basePackage}.service.${modelNameUpperCamel}Service; import ${basePackage}.repository.${modelNameUpperCamel}Repository; @@ -29,9 +30,9 @@ import java.util.Locale; @Api(value = "xx", description = "xx") @RestController @RequestMapping("${baseRequestMapping}") -public class ${modelNameUpperCamel}Controller { +public class ${modelNameUpperCamel}Controller extends BaseController{ @Autowired - private ${modelNameUpperCamel}Service services; + private ${modelNameUpperCamel}Service ${modelNameLowerCamel}Service; } \ No newline at end of file diff --git a/src/main/resources/templates/code/service-impl.ftl b/src/main/resources/templates/code/service-impl.ftl index f2788e6..555ed81 100644 --- a/src/main/resources/templates/code/service-impl.ftl +++ b/src/main/resources/templates/code/service-impl.ftl @@ -93,7 +93,7 @@ public class ${modelNameUpperCamel}ServiceImpl implements ${modelNameUpperCamel} } @Override - public int updateByPrimaryKeySelective(){ + public int updateByPrimaryKeySelective(${modelNameUpperCamel} ${modelNameLowerCamel}){ return ${modelNameLowerCamel}Mapper.updateByPrimaryKeySelective(${modelNameLowerCamel}); } } \ No newline at end of file -- Gitee From 1fa7495a02210ce691192b1eb80f8f676d41705b Mon Sep 17 00:00:00 2001 From: SimonSun Date: Wed, 12 Sep 2018 17:59:35 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simon/common/code/CodeGenerator.java | 19 +++-- .../java/com/simon/mapper/LogLoginMapper.java | 3 - .../java/com/simon/mapper/NewsInfoMapper.java | 2 - .../java/com/simon/mapper/QrCodeMapper.java | 1 - .../com/simon/mapper/ResetPwdInfoMapper.java | 1 - src/main/java/com/simon/model/LogLogin.java | 20 ++++- src/main/java/com/simon/model/NewsInfo.java | 20 ++++- src/main/java/com/simon/model/NewsTag.java | 21 +++++- src/main/java/com/simon/model/OauthUser.java | 75 ++++++++++++++----- src/main/java/com/simon/model/QrCode.java | 25 ++++++- .../java/com/simon/model/ResetPwdInfo.java | 24 +++++- src/main/java/com/simon/model/VeriCode.java | 21 +++++- src/main/resources/application-mysql.yml | 2 +- src/main/resources/code-gen.properties | 2 +- src/main/resources/mapping/LogLoginMapper.xml | 7 ++ src/main/resources/mapping/NewsInfoMapper.xml | 6 +- src/main/resources/mapping/NewsTagMapper.xml | 7 ++ .../resources/mapping/OauthUserMapper.xml | 26 +++++-- src/main/resources/mapping/QrCodeMapper.xml | 7 ++ .../resources/mapping/ResetPwdInfoMapper.xml | 7 ++ src/main/resources/mapping/VeriCodeMapper.xml | 7 ++ src/main/resources/schema-mysql.sql | 2 +- 22 files changed, 243 insertions(+), 62 deletions(-) diff --git a/src/main/java/com/simon/common/code/CodeGenerator.java b/src/main/java/com/simon/common/code/CodeGenerator.java index 26432d4..c22fefe 100644 --- a/src/main/java/com/simon/common/code/CodeGenerator.java +++ b/src/main/java/com/simon/common/code/CodeGenerator.java @@ -50,7 +50,7 @@ public class CodeGenerator { private static String GEN_MODULES;//要生成的模块 static String AUTHOR;//@author - static final String CREATE = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());//@date + static final String CREATE = new SimpleDateFormat("yyyy-MM-dd").format(new Date());//@date private static Properties prop; static { @@ -94,15 +94,14 @@ public class CodeGenerator { //genCode("users", "news_info"); //genCodeByCustomModelName("输入表名","输入自定义Model名称"); - /*genCodeByCustomModelName("authorities", "Authority"); - genCodeByCustomModelName("news_info","NewsInfo"); - genCodeByCustomModelName("users", "OauthUser"); - genCodeByCustomModelName("veri_code", "VeriCode"); - genCodeByCustomModelName("reset_pwd_info", "ResetPwdInfo"); - genCodeByCustomModelName("qr_code", "QrCode"); - genCodeByCustomModelName("log_login", "LogLogin"); - genCodeByCustomModelName("news_tag", "NewsTag");*/ - genCodeByCustomModelName("news_tag", "NewsTag"); + //genCodeByCustomModelName("t_authorities", "Authority"); + genCodeByCustomModelName("t_news_info","NewsInfo"); + genCodeByCustomModelName("t_users", "OauthUser"); + genCodeByCustomModelName("t_veri_code", "VeriCode"); + genCodeByCustomModelName("t_reset_pwd_info", "ResetPwdInfo"); + genCodeByCustomModelName("t_qr_code", "QrCode"); + genCodeByCustomModelName("t_log_login", "LogLogin"); + genCodeByCustomModelName("t_news_tag", "NewsTag"); } /** diff --git a/src/main/java/com/simon/mapper/LogLoginMapper.java b/src/main/java/com/simon/mapper/LogLoginMapper.java index ebca4be..fbb0751 100644 --- a/src/main/java/com/simon/mapper/LogLoginMapper.java +++ b/src/main/java/com/simon/mapper/LogLoginMapper.java @@ -2,9 +2,6 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.LogLogin; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; public interface LogLoginMapper extends MyMapper { - LogLogin selectByPrimaryKey(@Param("id") Long id); } \ No newline at end of file diff --git a/src/main/java/com/simon/mapper/NewsInfoMapper.java b/src/main/java/com/simon/mapper/NewsInfoMapper.java index 485ab40..96ab238 100644 --- a/src/main/java/com/simon/mapper/NewsInfoMapper.java +++ b/src/main/java/com/simon/mapper/NewsInfoMapper.java @@ -2,8 +2,6 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.NewsInfo; -import org.springframework.stereotype.Repository; public interface NewsInfoMapper extends MyMapper { - } \ No newline at end of file diff --git a/src/main/java/com/simon/mapper/QrCodeMapper.java b/src/main/java/com/simon/mapper/QrCodeMapper.java index 00f4f6a..ea4b8c5 100644 --- a/src/main/java/com/simon/mapper/QrCodeMapper.java +++ b/src/main/java/com/simon/mapper/QrCodeMapper.java @@ -2,7 +2,6 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.QrCode; -import org.springframework.stereotype.Repository; public interface QrCodeMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java b/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java index ac34b17..032dbb1 100644 --- a/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java +++ b/src/main/java/com/simon/mapper/ResetPwdInfoMapper.java @@ -2,7 +2,6 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.ResetPwdInfo; -import org.springframework.stereotype.Repository; public interface ResetPwdInfoMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/simon/model/LogLogin.java b/src/main/java/com/simon/model/LogLogin.java index 0d83526..7382775 100644 --- a/src/main/java/com/simon/model/LogLogin.java +++ b/src/main/java/com/simon/model/LogLogin.java @@ -13,12 +13,12 @@ import java.util.Date; /** * @author SimonSun -* @create 2018-08-17 23:33:01 +* @create 2018-09-12 **/ @ApiModel(description = "LogLogin") @Data @Entity -@Table(name="log_login") +@Table(name="t_log_login") public class LogLogin implements Serializable{ private static final long serialVersionUID = 1L; @@ -28,6 +28,22 @@ public class LogLogin implements Serializable{ @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + @ApiModelProperty(value = "create_time") @Column(name = "create_time") private Date createTime; diff --git a/src/main/java/com/simon/model/NewsInfo.java b/src/main/java/com/simon/model/NewsInfo.java index 81cd7a3..387fbd5 100644 --- a/src/main/java/com/simon/model/NewsInfo.java +++ b/src/main/java/com/simon/model/NewsInfo.java @@ -13,12 +13,12 @@ import java.util.Date; /** * @author SimonSun -* @create 2018-08-17 23:33:01 +* @create 2018-09-12 **/ @ApiModel(description = "NewsInfo") @Data @Entity -@Table(name="news_info") +@Table(name="t_news_info") public class NewsInfo implements Serializable{ private static final long serialVersionUID = 1L; @@ -28,6 +28,22 @@ public class NewsInfo implements Serializable{ @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + @ApiModelProperty(value = "title") @Column(name = "title") private String title; diff --git a/src/main/java/com/simon/model/NewsTag.java b/src/main/java/com/simon/model/NewsTag.java index 2ee8ee5..3e41acc 100644 --- a/src/main/java/com/simon/model/NewsTag.java +++ b/src/main/java/com/simon/model/NewsTag.java @@ -9,15 +9,16 @@ import tk.mybatis.mapper.annotation.KeySql; import javax.persistence.*; import java.io.Serializable; +import java.util.Date; /** * @author SimonSun -* @create 2018-08-18 00:41:52 +* @create 2018-09-12 **/ @ApiModel(description = "NewsTag") @Data @Entity -@Table(name="news_tag") +@Table(name="t_news_tag") public class NewsTag implements Serializable{ private static final long serialVersionUID = 1L; @@ -27,6 +28,22 @@ public class NewsTag implements Serializable{ @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + @ApiModelProperty(value = "news_info_id") @Column(name = "news_info_id") private Long newsInfoId; diff --git a/src/main/java/com/simon/model/OauthUser.java b/src/main/java/com/simon/model/OauthUser.java index f0cfca8..c44dd9c 100644 --- a/src/main/java/com/simon/model/OauthUser.java +++ b/src/main/java/com/simon/model/OauthUser.java @@ -1,23 +1,26 @@ package com.simon.model; +import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; +import lombok.Data; import javax.persistence.*; import java.io.Serializable; +import java.util.Date; +import java.math.BigDecimal; /** * @author SimonSun -* @create 2018-08-17 23:33:01 +* @create 2018-09-12 **/ @ApiModel(description = "OauthUser") @Data @Entity -@Table(name="users") +@Table(name="t_users") public class OauthUser implements Serializable{ private static final long serialVersionUID = 1L; @@ -27,55 +30,87 @@ public class OauthUser implements Serializable{ @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; - @ApiModelProperty(value = "username") + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + + @ApiModelProperty(value = "用户名") @Column(name = "username", nullable = false) private String username; - @ApiModelProperty(value = "password") + @ApiModelProperty(value = "密码") @Column(name = "password", nullable = false) private String password; - @ApiModelProperty(value = "enabled") + @ApiModelProperty(value = "有效") @Column(name = "enabled", nullable = false) private Boolean enabled; - @ApiModelProperty(value = "email") + @ApiModelProperty(value = "手机号") + @Column(name = "phone") + private String phone; + + @ApiModelProperty(value = "邮箱") @Column(name = "email") private String email; - @ApiModelProperty(value = "phone") - @Column(name = "phone") - private String phone; + @ApiModelProperty(value = "oppo账号ssoid") + @Column(name = "ssoid") + private String ssoid; - @ApiModelProperty(value = "enable") - @Column(name = "enable") - private Boolean enable; + @ApiModelProperty(value = "播放列表id") + @Column(name = "album_id") + private Long albumId; - @ApiModelProperty(value = "address") + @ApiModelProperty(value = "地址") @Column(name = "address") private String address; - @ApiModelProperty(value = "age") + @ApiModelProperty(value = "年龄") @Column(name = "age") private Integer age; - @ApiModelProperty(value = "birth") + @ApiModelProperty(value = "生日") @Column(name = "birth") private String birth; - @ApiModelProperty(value = "head_photo") + @ApiModelProperty(value = "头像") @Column(name = "head_photo") private String headPhoto; - @ApiModelProperty(value = "person_brief") + @ApiModelProperty(value = "个人简介") @Column(name = "person_brief") private String personBrief; - @ApiModelProperty(value = "sex") + @ApiModelProperty(value = "性别") @Column(name = "sex") private Boolean sex; - @ApiModelProperty(value = "visit_card") + @ApiModelProperty(value = "邀请码") @Column(name = "visit_card") private String visitCard; + + @ApiModelProperty(value = "登录方式") + @Column(name = "login_type") + private Integer loginType; + + @ApiModelProperty(value = "登录状态") + @Column(name = "login_status") + private String loginStatus; + + @ApiModelProperty(value = "登录时间") + @Column(name = "login_date") + private Date loginDate; } \ No newline at end of file diff --git a/src/main/java/com/simon/model/QrCode.java b/src/main/java/com/simon/model/QrCode.java index a8c9efc..608e37c 100644 --- a/src/main/java/com/simon/model/QrCode.java +++ b/src/main/java/com/simon/model/QrCode.java @@ -1,23 +1,26 @@ package com.simon.model; +import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; +import lombok.Data; import javax.persistence.*; import java.io.Serializable; +import java.util.Date; +import java.math.BigDecimal; /** * @author SimonSun -* @create 2018-08-17 23:33:01 +* @create 2018-09-12 **/ @ApiModel(description = "QrCode") @Data @Entity -@Table(name="qr_code") +@Table(name="t_qr_code") public class QrCode implements Serializable{ private static final long serialVersionUID = 1L; @@ -27,6 +30,22 @@ public class QrCode implements Serializable{ @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + @ApiModelProperty(value = "is_ok") @Column(name = "is_ok") private Boolean isOk; diff --git a/src/main/java/com/simon/model/ResetPwdInfo.java b/src/main/java/com/simon/model/ResetPwdInfo.java index e3b948c..9b02c97 100644 --- a/src/main/java/com/simon/model/ResetPwdInfo.java +++ b/src/main/java/com/simon/model/ResetPwdInfo.java @@ -1,24 +1,26 @@ package com.simon.model; +import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; +import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.math.BigDecimal; /** * @author SimonSun -* @create 2018-08-17 23:33:01 +* @create 2018-09-12 **/ @ApiModel(description = "ResetPwdInfo") @Data @Entity -@Table(name="reset_pwd_info") +@Table(name="t_reset_pwd_info") public class ResetPwdInfo implements Serializable{ private static final long serialVersionUID = 1L; @@ -28,6 +30,22 @@ public class ResetPwdInfo implements Serializable{ @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + @ApiModelProperty(value = "expires_in") @Column(name = "expires_in") private Date expiresIn; diff --git a/src/main/java/com/simon/model/VeriCode.java b/src/main/java/com/simon/model/VeriCode.java index 7666c49..28a8b4c 100644 --- a/src/main/java/com/simon/model/VeriCode.java +++ b/src/main/java/com/simon/model/VeriCode.java @@ -9,15 +9,16 @@ import tk.mybatis.mapper.annotation.KeySql; import javax.persistence.*; import java.io.Serializable; +import java.util.Date; /** * @author SimonSun -* @create 2018-08-17 23:33:01 +* @create 2018-09-12 **/ @ApiModel(description = "VeriCode") @Data @Entity -@Table(name="veri_code") +@Table(name="t_veri_code") public class VeriCode implements Serializable{ private static final long serialVersionUID = 1L; @@ -27,6 +28,22 @@ public class VeriCode implements Serializable{ @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + @ApiModelProperty(value = "code") @Column(name = "code") private Integer code; diff --git a/src/main/resources/application-mysql.yml b/src/main/resources/application-mysql.yml index 2c020d7..de8ca13 100644 --- a/src/main/resources/application-mysql.yml +++ b/src/main/resources/application-mysql.yml @@ -4,7 +4,7 @@ spring: init-s-q-l: SET NAMES utf8mb4 # MySQL连接信息 driver-class-name: com.mysql.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true + url: jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false username: ENC(YiYjVwTulDGN//YaB3KbuA==) #明文root password: ENC(BZUIhx1tIC75T4JTYROwbsPIRuhrPQMx) #明文19941017 druid: diff --git a/src/main/resources/code-gen.properties b/src/main/resources/code-gen.properties index 4340b35..11320b8 100644 --- a/src/main/resources/code-gen.properties +++ b/src/main/resources/code-gen.properties @@ -1,6 +1,6 @@ # # MySQL -jdbc_url=jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true +jdbc_url=jdbc:mysql://127.0.0.1:3306/thymelte?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false jdbc_username=root jdbc_password=19941017 jdbc_driver_class_name=com.mysql.jdbc.Driver diff --git a/src/main/resources/mapping/LogLoginMapper.xml b/src/main/resources/mapping/LogLoginMapper.xml index 570938d..5188784 100644 --- a/src/main/resources/mapping/LogLoginMapper.xml +++ b/src/main/resources/mapping/LogLoginMapper.xml @@ -2,7 +2,14 @@ + + + + + diff --git a/src/main/resources/mapping/NewsInfoMapper.xml b/src/main/resources/mapping/NewsInfoMapper.xml index cd95ec0..160c399 100644 --- a/src/main/resources/mapping/NewsInfoMapper.xml +++ b/src/main/resources/mapping/NewsInfoMapper.xml @@ -6,12 +6,16 @@ WARNING - @mbg.generated --> + + + + - + \ No newline at end of file diff --git a/src/main/resources/mapping/NewsTagMapper.xml b/src/main/resources/mapping/NewsTagMapper.xml index 533b62a..3b8b083 100644 --- a/src/main/resources/mapping/NewsTagMapper.xml +++ b/src/main/resources/mapping/NewsTagMapper.xml @@ -2,7 +2,14 @@ + + + + + diff --git a/src/main/resources/mapping/OauthUserMapper.xml b/src/main/resources/mapping/OauthUserMapper.xml index a9b8139..a25da51 100644 --- a/src/main/resources/mapping/OauthUserMapper.xml +++ b/src/main/resources/mapping/OauthUserMapper.xml @@ -2,25 +2,37 @@ + + + + + - - - + + + - - + + + + - + + + + id, username, password, enabled, email, phone, enable - update users set password=#{password} where phone=#{phone} + update t_users set password=#{password} where phone=#{phone} \ No newline at end of file diff --git a/src/main/resources/mapping/QrCodeMapper.xml b/src/main/resources/mapping/QrCodeMapper.xml index c697eea..6592850 100644 --- a/src/main/resources/mapping/QrCodeMapper.xml +++ b/src/main/resources/mapping/QrCodeMapper.xml @@ -2,7 +2,14 @@ + + + + + diff --git a/src/main/resources/mapping/ResetPwdInfoMapper.xml b/src/main/resources/mapping/ResetPwdInfoMapper.xml index 29df84d..b08d04c 100644 --- a/src/main/resources/mapping/ResetPwdInfoMapper.xml +++ b/src/main/resources/mapping/ResetPwdInfoMapper.xml @@ -2,7 +2,14 @@ + + + + + diff --git a/src/main/resources/mapping/VeriCodeMapper.xml b/src/main/resources/mapping/VeriCodeMapper.xml index a27d26a..0e8ffa4 100644 --- a/src/main/resources/mapping/VeriCodeMapper.xml +++ b/src/main/resources/mapping/VeriCodeMapper.xml @@ -2,7 +2,14 @@ + + + + + diff --git a/src/main/resources/schema-mysql.sql b/src/main/resources/schema-mysql.sql index 2c6e85a..9907c30 100644 --- a/src/main/resources/schema-mysql.sql +++ b/src/main/resources/schema-mysql.sql @@ -121,7 +121,7 @@ id BIGINT AUTO_INCREMENT NOT null primary key, update_by bigint(20) comment '更新人id', update_date datetime comment '更新时间', code int(4), -create_time int(8), +create_time bigint(20), expires int(4), phone varchar(255) ); -- Gitee From 9fbf3a3b1ebb94684f4519d5991948a0dc44372c Mon Sep 17 00:00:00 2001 From: SimonSun Date: Wed, 12 Sep 2018 18:24:50 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simon/common/code/CodeGenerator.java | 18 ++++---- .../common/code/FreeMarkerGeneratorUtil.java | 2 +- .../com/simon/mapper/AuthorityMapper.java | 1 - .../com/simon/mapper/DictTypeGroupMapper.java | 3 -- src/main/java/com/simon/model/Authority.java | 42 ++++++++++++++----- src/main/java/com/simon/model/DictType.java | 6 +-- .../java/com/simon/model/DictTypeGroup.java | 10 +++-- src/main/java/com/simon/model/LogLogin.java | 2 +- src/main/java/com/simon/model/NewsInfo.java | 4 +- src/main/java/com/simon/model/NewsTag.java | 6 ++- src/main/java/com/simon/model/OauthUser.java | 6 +-- src/main/java/com/simon/model/QrCode.java | 6 +-- .../java/com/simon/model/ResetPwdInfo.java | 6 +-- src/main/java/com/simon/model/VeriCode.java | 2 +- .../resources/mapping/AuthorityMapper.xml | 8 ++++ .../resources/mapping/DictTypeGroupMapper.xml | 4 +- src/main/resources/mapping/DictTypeMapper.xml | 6 +-- src/main/resources/templates/code/entity.ftl | 2 +- 18 files changed, 80 insertions(+), 54 deletions(-) diff --git a/src/main/java/com/simon/common/code/CodeGenerator.java b/src/main/java/com/simon/common/code/CodeGenerator.java index c22fefe..5fa2576 100644 --- a/src/main/java/com/simon/common/code/CodeGenerator.java +++ b/src/main/java/com/simon/common/code/CodeGenerator.java @@ -94,14 +94,16 @@ public class CodeGenerator { //genCode("users", "news_info"); //genCodeByCustomModelName("输入表名","输入自定义Model名称"); - //genCodeByCustomModelName("t_authorities", "Authority"); - genCodeByCustomModelName("t_news_info","NewsInfo"); - genCodeByCustomModelName("t_users", "OauthUser"); - genCodeByCustomModelName("t_veri_code", "VeriCode"); - genCodeByCustomModelName("t_reset_pwd_info", "ResetPwdInfo"); - genCodeByCustomModelName("t_qr_code", "QrCode"); - genCodeByCustomModelName("t_log_login", "LogLogin"); - genCodeByCustomModelName("t_news_tag", "NewsTag"); + genCodeByCustomModelName("t_authorities", "Authority"); + genCodeByCustomModelName("t_dict_type", "DictType"); + genCodeByCustomModelName("t_dict_type_group", "DictTypeGroup"); +// genCodeByCustomModelName("t_news_info","NewsInfo"); +// genCodeByCustomModelName("t_users", "OauthUser"); +// genCodeByCustomModelName("t_veri_code", "VeriCode"); +// genCodeByCustomModelName("t_reset_pwd_info", "ResetPwdInfo"); +// genCodeByCustomModelName("t_qr_code", "QrCode"); +// genCodeByCustomModelName("t_log_login", "LogLogin"); +// genCodeByCustomModelName("t_news_tag", "NewsTag"); } /** diff --git a/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java b/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java index 226e98a..b41273d 100644 --- a/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java +++ b/src/main/java/com/simon/common/code/FreeMarkerGeneratorUtil.java @@ -106,7 +106,7 @@ public class FreeMarkerGeneratorUtil { if(StringUtils.isEmpty(tableComment)){ tableComment = tableName; }else{ - if(tableComment.lastIndexOf("表") == (tableComment.length() - 1)){ + if(tableComment.contains("表")&&tableComment.lastIndexOf("表") == (tableComment.length() - 1)){ tableComment = tableComment.substring(0, tableComment.length() - 1); } } diff --git a/src/main/java/com/simon/mapper/AuthorityMapper.java b/src/main/java/com/simon/mapper/AuthorityMapper.java index 5898a72..3d771b8 100644 --- a/src/main/java/com/simon/mapper/AuthorityMapper.java +++ b/src/main/java/com/simon/mapper/AuthorityMapper.java @@ -4,5 +4,4 @@ import com.simon.common.mapper.MyMapper; import com.simon.model.Authority; public interface AuthorityMapper extends MyMapper { - } \ No newline at end of file diff --git a/src/main/java/com/simon/mapper/DictTypeGroupMapper.java b/src/main/java/com/simon/mapper/DictTypeGroupMapper.java index 6ba266c..50f6b5a 100644 --- a/src/main/java/com/simon/mapper/DictTypeGroupMapper.java +++ b/src/main/java/com/simon/mapper/DictTypeGroupMapper.java @@ -3,8 +3,5 @@ package com.simon.mapper; import com.simon.common.mapper.MyMapper; import com.simon.model.DictTypeGroup; -/** - * @author simon - */ public interface DictTypeGroupMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/simon/model/Authority.java b/src/main/java/com/simon/model/Authority.java index 05c4a70..6622112 100644 --- a/src/main/java/com/simon/model/Authority.java +++ b/src/main/java/com/simon/model/Authority.java @@ -1,33 +1,55 @@ package com.simon.model; +import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.hibernate.annotations.GenericGenerator; import org.springframework.security.core.GrantedAuthority; +import tk.mybatis.mapper.annotation.KeySql; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import javax.persistence.*; import java.io.Serializable; +import java.util.Date; /** * @author SimonSun -* @create 2018-08-17 23:33:01 +* @create 2018-09-12 **/ -@ApiModel(description = "Authority") +@ApiModel(value = "权限") @Data @Entity -@Table(name="authorities") -public class Authority implements GrantedAuthority, Serializable { +@Table(name="t_authorities") +public class Authority implements GrantedAuthority, Serializable{ private static final long serialVersionUID = 1L; @Id - @ApiModelProperty(value = "user_id") + @KeySql(genId = SnowflakeGenId.class) + @GeneratedValue(generator = "sequenceId") + @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") + private Long id; + + @ApiModelProperty(value = "创建人id") + @Column(name = "create_by") + private Long createBy; + + @ApiModelProperty(value = "创建时间") + @Column(name = "create_date") + private Date createDate; + + @ApiModelProperty(value = "更新人id") + @Column(name = "update_by") + private Long updateBy; + + @ApiModelProperty(value = "更新时间") + @Column(name = "update_date") + private Date updateDate; + + @ApiModelProperty(value = "用户id") @Column(name = "user_id", nullable = false) private Long userId; - @ApiModelProperty(value = "authority") + @ApiModelProperty(value = "权限") @Column(name = "authority", nullable = false) private String authority; } \ No newline at end of file diff --git a/src/main/java/com/simon/model/DictType.java b/src/main/java/com/simon/model/DictType.java index c55b903..cc2c181 100644 --- a/src/main/java/com/simon/model/DictType.java +++ b/src/main/java/com/simon/model/DictType.java @@ -13,9 +13,9 @@ import java.util.Date; /** * @author SimonSun -* @date 2018-09-06 10:03:50 +* @create 2018-09-12 **/ -@ApiModel(description = "DictType") +@ApiModel(value = "字典") @Data @Entity @Table(name="t_dict_type") @@ -25,7 +25,7 @@ public class DictType implements Serializable{ @Id @KeySql(genId = SnowflakeGenId.class) @GeneratedValue(generator = "sequenceId") - @GenericGenerator(name = "sequenceId", strategy = "com.boya.common.utils.snowflake.SequenceId") + @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; @ApiModelProperty(value = "创建人id") diff --git a/src/main/java/com/simon/model/DictTypeGroup.java b/src/main/java/com/simon/model/DictTypeGroup.java index f9da7ed..3327707 100644 --- a/src/main/java/com/simon/model/DictTypeGroup.java +++ b/src/main/java/com/simon/model/DictTypeGroup.java @@ -1,21 +1,23 @@ package com.simon.model; +import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; +import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.math.BigDecimal; /** * @author SimonSun -* @date 2018-09-06 10:03:50 +* @create 2018-09-12 **/ -@ApiModel(description = "DictTypeGroup") +@ApiModel(value = "字典组") @Data @Entity @Table(name="t_dict_type_group") @@ -25,7 +27,7 @@ public class DictTypeGroup implements Serializable{ @Id @KeySql(genId = SnowflakeGenId.class) @GeneratedValue(generator = "sequenceId") - @GenericGenerator(name = "sequenceId", strategy = "com.boya.common.utils.snowflake.SequenceId") + @GenericGenerator(name = "sequenceId", strategy = "com.simon.common.utils.snowflake.SequenceId") private Long id; @ApiModelProperty(value = "创建人id") diff --git a/src/main/java/com/simon/model/LogLogin.java b/src/main/java/com/simon/model/LogLogin.java index 7382775..f51899f 100644 --- a/src/main/java/com/simon/model/LogLogin.java +++ b/src/main/java/com/simon/model/LogLogin.java @@ -15,7 +15,7 @@ import java.util.Date; * @author SimonSun * @create 2018-09-12 **/ -@ApiModel(description = "LogLogin") +@ApiModel(value = "t_log_login") @Data @Entity @Table(name="t_log_login") diff --git a/src/main/java/com/simon/model/NewsInfo.java b/src/main/java/com/simon/model/NewsInfo.java index 387fbd5..705f824 100644 --- a/src/main/java/com/simon/model/NewsInfo.java +++ b/src/main/java/com/simon/model/NewsInfo.java @@ -15,7 +15,7 @@ import java.util.Date; * @author SimonSun * @create 2018-09-12 **/ -@ApiModel(description = "NewsInfo") +@ApiModel(value = "t_news_info") @Data @Entity @Table(name="t_news_info") @@ -57,7 +57,7 @@ public class NewsInfo implements Serializable{ private Integer status; @ApiModelProperty(value = "content") - @Column(name = "content") + @Column(name = "content", columnDefinition = "TEXT") private String content; @ApiModelProperty(value = "image_url") diff --git a/src/main/java/com/simon/model/NewsTag.java b/src/main/java/com/simon/model/NewsTag.java index 3e41acc..85d2e39 100644 --- a/src/main/java/com/simon/model/NewsTag.java +++ b/src/main/java/com/simon/model/NewsTag.java @@ -1,21 +1,23 @@ package com.simon.model; +import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; +import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.Date; +import java.math.BigDecimal; /** * @author SimonSun * @create 2018-09-12 **/ -@ApiModel(description = "NewsTag") +@ApiModel(value = "t_news_tag") @Data @Entity @Table(name="t_news_tag") diff --git a/src/main/java/com/simon/model/OauthUser.java b/src/main/java/com/simon/model/OauthUser.java index c44dd9c..649d35d 100644 --- a/src/main/java/com/simon/model/OauthUser.java +++ b/src/main/java/com/simon/model/OauthUser.java @@ -1,23 +1,21 @@ package com.simon.model; -import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; -import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.Date; -import java.math.BigDecimal; /** * @author SimonSun * @create 2018-09-12 **/ -@ApiModel(description = "OauthUser") +@ApiModel(value = "用户") @Data @Entity @Table(name="t_users") diff --git a/src/main/java/com/simon/model/QrCode.java b/src/main/java/com/simon/model/QrCode.java index 608e37c..fbb1dcb 100644 --- a/src/main/java/com/simon/model/QrCode.java +++ b/src/main/java/com/simon/model/QrCode.java @@ -1,23 +1,21 @@ package com.simon.model; -import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; -import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.Date; -import java.math.BigDecimal; /** * @author SimonSun * @create 2018-09-12 **/ -@ApiModel(description = "QrCode") +@ApiModel(value = "t_qr_code") @Data @Entity @Table(name="t_qr_code") diff --git a/src/main/java/com/simon/model/ResetPwdInfo.java b/src/main/java/com/simon/model/ResetPwdInfo.java index 9b02c97..f3ce637 100644 --- a/src/main/java/com/simon/model/ResetPwdInfo.java +++ b/src/main/java/com/simon/model/ResetPwdInfo.java @@ -1,23 +1,21 @@ package com.simon.model; -import com.simon.common.utils.UUIdGenId; import com.simon.common.utils.SnowflakeGenId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import org.hibernate.annotations.GenericGenerator; import tk.mybatis.mapper.annotation.KeySql; -import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.Date; -import java.math.BigDecimal; /** * @author SimonSun * @create 2018-09-12 **/ -@ApiModel(description = "ResetPwdInfo") +@ApiModel(value = "t_reset_pwd_info") @Data @Entity @Table(name="t_reset_pwd_info") diff --git a/src/main/java/com/simon/model/VeriCode.java b/src/main/java/com/simon/model/VeriCode.java index 28a8b4c..24f2cbf 100644 --- a/src/main/java/com/simon/model/VeriCode.java +++ b/src/main/java/com/simon/model/VeriCode.java @@ -15,7 +15,7 @@ import java.util.Date; * @author SimonSun * @create 2018-09-12 **/ -@ApiModel(description = "VeriCode") +@ApiModel(value = "t_veri_code") @Data @Entity @Table(name="t_veri_code") diff --git a/src/main/resources/mapping/AuthorityMapper.xml b/src/main/resources/mapping/AuthorityMapper.xml index 4d0ecf1..e3e267f 100644 --- a/src/main/resources/mapping/AuthorityMapper.xml +++ b/src/main/resources/mapping/AuthorityMapper.xml @@ -2,6 +2,14 @@ + + + + + + diff --git a/src/main/resources/mapping/DictTypeGroupMapper.xml b/src/main/resources/mapping/DictTypeGroupMapper.xml index 344a89a..a80899d 100644 --- a/src/main/resources/mapping/DictTypeGroupMapper.xml +++ b/src/main/resources/mapping/DictTypeGroupMapper.xml @@ -1,7 +1,7 @@ - - + + diff --git a/src/main/resources/mapping/DictTypeMapper.xml b/src/main/resources/mapping/DictTypeMapper.xml index cd43045..575bbe6 100644 --- a/src/main/resources/mapping/DictTypeMapper.xml +++ b/src/main/resources/mapping/DictTypeMapper.xml @@ -1,8 +1,7 @@ - - - + + @@ -16,6 +15,7 @@ +