paging = SysUserService.getSysUserPageList(SysUserQueryParam);
return ApiResult.ok(paging);
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/web/param/SysLogQueryParam.java b/src/main/java/io/geekidea/springbootplus/system/web/param/SysLogQueryParam.java
index 0f70df35..04caee4d 100644
--- a/src/main/java/io/geekidea/springbootplus/system/web/param/SysLogQueryParam.java
+++ b/src/main/java/io/geekidea/springbootplus/system/web/param/SysLogQueryParam.java
@@ -3,6 +3,7 @@
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
import io.geekidea.springbootplus.common.web.param.QueryParam;
@@ -12,11 +13,12 @@
*
*
* @author geekidea
- * @date 2019-08-04
+ * @date 2019-10-05
*/
@Data
+@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value="SysLogQueryParam对象", description="系统日志查询参数")
+@ApiModel(value = "SysLogQueryParam对象", description = "系统日志查询参数")
public class SysLogQueryParam extends QueryParam {
private static final long serialVersionUID = 1L;
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/web/param/SysUserQueryParam.java b/src/main/java/io/geekidea/springbootplus/system/web/param/SysUserQueryParam.java
index 5210ef69..aa622979 100644
--- a/src/main/java/io/geekidea/springbootplus/system/web/param/SysUserQueryParam.java
+++ b/src/main/java/io/geekidea/springbootplus/system/web/param/SysUserQueryParam.java
@@ -3,6 +3,7 @@
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
import io.geekidea.springbootplus.common.web.param.QueryParam;
@@ -12,11 +13,12 @@
*
*
* @author geekidea
- * @date 2019-08-26
+ * @date 2019-10-05
*/
@Data
+@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value="SysUserQueryParam对象", description="SystemUser查询参数")
+@ApiModel(value = "SysUserQueryParam对象", description = "SystemUser查询参数")
public class SysUserQueryParam extends QueryParam {
private static final long serialVersionUID = 1L;
}
diff --git a/src/main/java/io/geekidea/springbootplus/system/web/vo/SysLogQueryVo.java b/src/main/java/io/geekidea/springbootplus/system/web/vo/SysLogQueryVo.java
index 3bcdc16d..e6b4df95 100644
--- a/src/main/java/io/geekidea/springbootplus/system/web/vo/SysLogQueryVo.java
+++ b/src/main/java/io/geekidea/springbootplus/system/web/vo/SysLogQueryVo.java
@@ -3,6 +3,7 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@@ -13,11 +14,12 @@
*
*
* @author geekidea
- * @date 2019-08-04
+ * @date 2019-10-05
*/
@Data
-@ApiModel(value="SysLogQueryVo对象", description="系统日志查询参数")
-public class SysLogQueryVo implements Serializable{
+@Accessors(chain = true)
+@ApiModel(value = "SysLogQueryVo对象", description = "系统日志查询参数")
+public class SysLogQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
diff --git a/src/main/java/io/geekidea/springbootplus/system/web/vo/SysUserQueryVo.java b/src/main/java/io/geekidea/springbootplus/system/web/vo/SysUserQueryVo.java
index d04063ec..8c97056a 100644
--- a/src/main/java/io/geekidea/springbootplus/system/web/vo/SysUserQueryVo.java
+++ b/src/main/java/io/geekidea/springbootplus/system/web/vo/SysUserQueryVo.java
@@ -3,6 +3,8 @@
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import lombok.experimental.Accessors;
+
import java.io.Serializable;
import java.util.Date;
@@ -13,32 +15,39 @@
*
*
* @author geekidea
- * @date 2019-08-26
+ * @date 2019-10-05
*/
@Data
-@ApiModel(value="SysUserQueryVo对象", description="SystemUser查询参数")
-public class SysUserQueryVo implements Serializable{
+@Accessors(chain = true)
+@ApiModel(value = "SysUserQueryVo对象", description = "SystemUser查询参数")
+public class SysUserQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
- @ApiModelProperty(value = "id")
+ @ApiModelProperty(value = "主键")
private Long id;
- @ApiModelProperty(value = "name")
- private String name;
+ @ApiModelProperty(value = "用户名")
+ private String username;
+
+ @ApiModelProperty(value = "昵称")
+ private String nickname;
- @ApiModelProperty(value = "account")
- private String account;
+ @ApiModelProperty(value = "密码")
+ private String password;
- @ApiModelProperty(value = "password")
- private String pwd;
+ @ApiModelProperty(value = "盐值")
+ private String salt;
@ApiModelProperty(value = "remark")
private String remark;
- @ApiModelProperty(value = "create time")
+ @ApiModelProperty(value = "状态,0:禁用,1:启用")
+ private Integer status;
+
+ @ApiModelProperty(value = "创建时间")
private Date createTime;
- @ApiModelProperty(value = "update time")
+ @ApiModelProperty(value = "修改时间")
private Date updateTime;
}
\ No newline at end of file
diff --git a/src/main/java/io/geekidea/springbootplus/util/PasswordUtil.java b/src/main/java/io/geekidea/springbootplus/util/PasswordUtil.java
index 49d22225..b0be2e12 100644
--- a/src/main/java/io/geekidea/springbootplus/util/PasswordUtil.java
+++ b/src/main/java/io/geekidea/springbootplus/util/PasswordUtil.java
@@ -1,12 +1,12 @@
/**
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,22 +22,19 @@
/**
* 密码加密工具类
+ *
* @author geekidea
* @date 2018-11-08
*/
@Slf4j
public class PasswordUtil {
- private static final String KEY = "io.geekidea.springbootplus.springbootplus.pwd.key";
- public static String encrypt(String pwd){
- if (StringUtils.isBlank(pwd)){
+ private static final String KEY = "666666";
+
+ public static String encrypt(String pwd) {
+ if (StringUtils.isBlank(pwd)) {
return null;
}
- pwd = pwd + KEY;
- String newPwd = DigestUtils.sha256Hex(pwd) + DigestUtils.md5Hex(pwd);
- return newPwd;
+ return DigestUtils.sha256Hex(KEY + pwd);
}
- public static void main(String[] args) {
- log.debug(encrypt("7c4a8d09ca3762af61e59520943dc26494f8941b"));
- }
}
diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml
index 64fc13ce..5c3e4ff9 100644
--- a/src/main/resources/config/application.yml
+++ b/src/main/resources/config/application.yml
@@ -183,7 +183,8 @@ spring:
test-on-return: false
test-while-idle: true
time-between-eviction-runs-millis: 60000
- validation-query: SELECT 1 FROM DUAL
+ validation-query: SELECT 1
+ validation-query-timeout: 60000
type: com.alibaba.druid.pool.DruidDataSource
############################### DRUID数据源配置 end ################################
diff --git a/src/main/resources/mapper/system/SysLogMapper.xml b/src/main/resources/mapper/system/SysLogMapper.xml
index 2c769fd3..82f43ad8 100644
--- a/src/main/resources/mapper/system/SysLogMapper.xml
+++ b/src/main/resources/mapper/system/SysLogMapper.xml
@@ -8,11 +8,15 @@
- select from sys_log where log_id = #{id}
+ select
+
+ from sys_log where log_id = #{id}
- select from sys_log
+ select
+
+ from sys_log
diff --git a/src/main/resources/mapper/system/SysUserMapper.xml b/src/main/resources/mapper/system/SysUserMapper.xml
index 100c3e7c..b43e7b58 100644
--- a/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/src/main/resources/mapper/system/SysUserMapper.xml
@@ -4,15 +4,26 @@
- id, name, account, pwd, remark, create_time, update_time
+ id, username, nickname, password, salt, remark, status, create_time, update_time
- select from sys_user where id = #{id}
+ select
+
+ from sys_user where id = #{id}
- select from sys_user
+ select
+
+ from sys_user
+
+
+
+ select
+
+ from sys_user
+ where username = #{username}
diff --git a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
index 2398450a..ed403b29 100644
--- a/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
+++ b/src/test/java/io/geekidea/springbootplus/test/CodeGenerator.java
@@ -1,12 +1,12 @@
/**
* Copyright 2019-2029 geekidea(https://github.com/geekidea)
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,6 +33,7 @@
/**
* spring-boot-plus代码生成器入口类
+ *
* @author geekidea
* @date 2018-11-08
*/
@@ -59,9 +60,9 @@ public class CodeGenerator {
// 作者
private static final String AUTHOR = "geekidea";
// 生成的表名称
- private static final String TABLE_NAME = "sys_log";
+ private static final String TABLE_NAME = "sys_user";
// 主键数据库列名称
- private static final String PK_ID_COLUMN_NAME = "log_id";
+ private static final String PK_ID_COLUMN_NAME = "id";
// 代码生成策略 true:All/false:SIMPLE
private static final boolean GENERATOR_STRATEGY = true;
// 分页列表查询是否排序 true:有排序参数/false:无
@@ -108,36 +109,48 @@ public static void main(String[] args) {
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
- Map map = new HashMap();
+
+ String pascalTableName = underlineToPascal(TABLE_NAME);
+
+ Map map = new HashMap<>();
map.put("customField", "Hello " + this.getConfig().getGlobalConfig().getAuthor());
// 查询参数包路径
- map.put("queryParamPath",PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".web.param." + underlineToPascal(TABLE_NAME) + "QueryParam");
+ String queryParamPackage = PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".web.param";
+ map.put("queryParamPackage", queryParamPackage);
+ // 查询参数类路径
+ map.put("queryParamPath", queryParamPackage + StringPool.DOT + pascalTableName + "QueryParam");
// 查询参数共公包路径
- map.put("queryParamCommonPath",PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "QueryParam");
+ map.put("queryParamCommonPath", PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "QueryParam");
// 查询参数共公包路径
- map.put("idParamPath",PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "IdParam");
+ map.put("idParamPath", PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "IdParam");
// 响应结果包路径
- map.put("queryVoPath",PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".web.vo." + underlineToPascal(TABLE_NAME) + "QueryVo");
+ String queryVoPackage = PARENT_PACKAGE + StringPool.DOT + pc.getModuleName() + ".web.vo";
+ map.put("queryVoPackage", queryVoPackage);
+ // 响应结果类路径
+ map.put("queryVoPath", queryVoPackage + StringPool.DOT + pascalTableName + "QueryVo");
// 实体对象名称
- map.put("entityObjectName",underlineToCamel(TABLE_NAME));
+ map.put("entityObjectName", pascalTableName);
// service对象名称
- map.put("serviceObjectName",underlineToCamel(TABLE_NAME) + "Service");
+ map.put("serviceObjectName", pascalTableName + "Service");
// mapper对象名称
- map.put("mapperObjectName",underlineToCamel(TABLE_NAME) + "Mapper");
+ map.put("mapperObjectName", pascalTableName + "Mapper");
// 主键ID列名
- map.put("pkIdColumnName",PK_ID_COLUMN_NAME);
+ map.put("pkIdColumnName", PK_ID_COLUMN_NAME);
// 主键ID驼峰名称
- map.put("pkIdCamelName",underlineToCamel(PK_ID_COLUMN_NAME));
+ map.put("pkIdCamelName", underlineToCamel(PK_ID_COLUMN_NAME));
// 导入分页类
- map.put("paging",PARENT_PACKAGE + ".common.web.vo.Paging");
+ map.put("paging", PARENT_PACKAGE + ".common.web.vo.Paging");
// 导入排序枚举
- map.put("orderEnum",PARENT_PACKAGE + ".common.enums.OrderEnum");
+ map.put("orderEnum", PARENT_PACKAGE + ".common.enums.OrderEnum");
+ // ApiResult
+ // io.geekidea.springbootplus.common.api.ApiResult;
+ map.put("apiResult", PARENT_PACKAGE + ".common.api.ApiResult");
// 分页列表查询是否排序
- map.put("pageListOrder",PAGE_LIST_ORDER);
+ map.put("pageListOrder", PAGE_LIST_ORDER);
// 导入排序查询参数类
- map.put("orderQueryParamPath",PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "OrderQueryParam");
+ map.put("orderQueryParamPath", PARENT_PACKAGE + StringPool.DOT + "common.web.param." + "OrderQueryParam");
// 代码生成策略
- map.put("generatorStrategy",GENERATOR_STRATEGY);
+ map.put("generatorStrategy", GENERATOR_STRATEGY);
this.setMap(map);
}
};
@@ -155,7 +168,7 @@ public String outputFile(TableInfo tableInfo) {
focList.add(new FileOutConfig("/templates/queryParam.java.vm") {
@Override
public String outputFile(TableInfo tableInfo) {
- return projectPath + "/src/main/java/"+ PROJECT_PACKAGE_PATH +"/" + pc.getModuleName() + "/web/param/" + tableInfo.getEntityName() + "QueryParam" + StringPool.DOT_JAVA;
+ return projectPath + "/src/main/java/" + PROJECT_PACKAGE_PATH + "/" + pc.getModuleName() + "/web/param/" + tableInfo.getEntityName() + "QueryParam" + StringPool.DOT_JAVA;
}
});
@@ -163,11 +176,11 @@ public String outputFile(TableInfo tableInfo) {
focList.add(new FileOutConfig("/templates/queryVo.java.vm") {
@Override
public String outputFile(TableInfo tableInfo) {
- return projectPath + "/src/main/java/"+ PROJECT_PACKAGE_PATH +"/" + pc.getModuleName() + "/web/vo/" + tableInfo.getEntityName() + "QueryVo" + StringPool.DOT_JAVA;
+ return projectPath + "/src/main/java/" + PROJECT_PACKAGE_PATH + "/" + pc.getModuleName() + "/web/vo/" + tableInfo.getEntityName() + "QueryVo" + StringPool.DOT_JAVA;
}
});
-
-
+
+
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
mpg.setTemplate(new TemplateConfig().setXml(null));
@@ -195,15 +208,15 @@ public String outputFile(TableInfo tableInfo) {
mpg.execute();
}
- public static String underlineToCamel(String underline){
- if (StringUtils.isNotBlank(underline)){
+ public static String underlineToCamel(String underline) {
+ if (StringUtils.isNotBlank(underline)) {
return NamingStrategy.underlineToCamel(underline);
}
return null;
}
- public static String underlineToPascal(String underline){
- if (StringUtils.isNotBlank(underline)){
+ public static String underlineToPascal(String underline) {
+ if (StringUtils.isNotBlank(underline)) {
return NamingStrategy.capitalFirst(NamingStrategy.underlineToCamel(underline));
}
return null;
diff --git a/src/test/java/io/geekidea/springbootplus/test/PasswordUtilTest.java b/src/test/java/io/geekidea/springbootplus/test/PasswordUtilTest.java
new file mode 100644
index 00000000..2e32904a
--- /dev/null
+++ b/src/test/java/io/geekidea/springbootplus/test/PasswordUtilTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.test;
+
+import io.geekidea.springbootplus.util.PasswordUtil;
+
+/**
+ * 密码工具测试类
+ * @author geekidea
+ * @date 2019-10-05
+ **/
+public class PasswordUtilTest {
+ public static void main(String[] args) {
+ String password = "123456";
+ String encryptPassword = PasswordUtil.encrypt(password);
+ System.out.println(encryptPassword);
+ System.out.println(encryptPassword.length());
+ }
+}
diff --git a/src/test/java/io/geekidea/springbootplus/test/SaltUtilTest.java b/src/test/java/io/geekidea/springbootplus/test/SaltUtilTest.java
new file mode 100644
index 00000000..dc99eb7e
--- /dev/null
+++ b/src/test/java/io/geekidea/springbootplus/test/SaltUtilTest.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2019-2029 geekidea(https://github.com/geekidea)
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.geekidea.springbootplus.test;
+
+import io.geekidea.springbootplus.shiro.util.SaltUtil;
+
+/**
+ * @author geekidea
+ * @date 2019-10-05
+ **/
+public class SaltUtilTest {
+ public static void main(String[] args) {
+ String salt = SaltUtil.generateSalt();
+ System.out.println(salt);
+ System.out.println(salt.length());
+ }
+}
diff --git a/src/test/resources/templates/controller.java.vm b/src/test/resources/templates/controller.java.vm
index 4f81d861..7930f041 100644
--- a/src/test/resources/templates/controller.java.vm
+++ b/src/test/resources/templates/controller.java.vm
@@ -4,11 +4,11 @@ import ${package.Entity}.${entity};
import ${package.Service}.${table.serviceName};
import ${cfg.queryParamPath};
import ${cfg.queryVoPath};
+import ${cfg.apiResult};
#if(${superControllerClassPackage})
import ${superControllerClassPackage};
#end
-import io.geekidea.springbootplus.common.api.ApiResult;
- #if(${swagger2})
+#if(${swagger2})
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
#end
@@ -59,41 +59,41 @@ public class ${table.controllerName} {
#if(${cfg.generatorStrategy})
/**
- * 添加$!{table.comment}
- */
+ * 添加$!{table.comment}
+ */
@PostMapping("/add")
- @ApiOperation(value = "添加${entity}对象",notes = "添加$!{table.comment}",response = ApiResult.class)
- public ApiResult add${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception{
+ @ApiOperation(value = "添加${entity}对象", notes = "添加$!{table.comment}", response = ApiResult.class)
+ public ApiResult add${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception {
boolean flag = ${cfg.serviceObjectName}.save(${cfg.entityObjectName});
return ApiResult.result(flag);
}
/**
- * 修改$!{table.comment}
- */
+ * 修改$!{table.comment}
+ */
@PostMapping("/update")
- @ApiOperation(value = "修改${entity}对象",notes = "修改$!{table.comment}",response = ApiResult.class)
- public ApiResult update${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception{
+ @ApiOperation(value = "修改${entity}对象", notes = "修改$!{table.comment}", response = ApiResult.class)
+ public ApiResult update${entity}(@Valid @RequestBody ${entity} ${cfg.entityObjectName}) throws Exception {
boolean flag = ${cfg.serviceObjectName}.updateById(${cfg.entityObjectName});
return ApiResult.result(flag);
}
/**
- * 删除$!{table.comment}
- */
+ * 删除$!{table.comment}
+ */
@PostMapping("/delete")
- @ApiOperation(value = "删除${entity}对象",notes = "删除$!{table.comment}",response = ApiResult.class)
- public ApiResult delete${entity}(@Valid @RequestBody IdParam idParam) throws Exception{
+ @ApiOperation(value = "删除${entity}对象", notes = "删除$!{table.comment}", response = ApiResult.class)
+ public ApiResult delete${entity}(@Valid @RequestBody IdParam idParam) throws Exception {
boolean flag = ${cfg.serviceObjectName}.removeById(idParam.getId());
return ApiResult.result(flag);
}
/**
- * 获取$!{table.comment}
- */
+ * 获取$!{table.comment}
+ */
@PostMapping("/info")
- @ApiOperation(value = "获取${entity}对象详情",notes = "查看$!{table.comment}",response = ${entity}QueryVo.class)
- public ApiResult<${entity}QueryVo> get${entity}(@Valid @RequestBody IdParam idParam) throws Exception{
+ @ApiOperation(value = "获取${entity}对象详情", notes = "查看$!{table.comment}", response = ${entity}QueryVo.class)
+ public ApiResult<${entity}QueryVo> get${entity}(@Valid @RequestBody IdParam idParam) throws Exception {
${entity}QueryVo ${cfg.entityObjectName}QueryVo = ${cfg.serviceObjectName}.get${entity}ById(idParam.getId());
return ApiResult.ok(${cfg.entityObjectName}QueryVo);
}
@@ -102,8 +102,8 @@ public class ${table.controllerName} {
* $!{table.comment}分页列表
*/
@PostMapping("/getPageList")
- @ApiOperation(value = "获取${entity}分页列表",notes = "$!{table.comment}分页列表",response = ${entity}QueryVo.class)
- public ApiResult> get${entity}PageList(@Valid @RequestBody(required = false) ${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception{
+ @ApiOperation(value = "获取${entity}分页列表", notes = "$!{table.comment}分页列表", response = ${entity}QueryVo.class)
+ public ApiResult> get${entity}PageList(@Valid @RequestBody(required = false) ${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception {
Paging<${entity}QueryVo> paging = ${cfg.entityObjectName}Service.get${entity}PageList(${cfg.entityObjectName}QueryParam);
return ApiResult.ok(paging);
}
diff --git a/src/test/resources/templates/entity.java.vm b/src/test/resources/templates/entity.java.vm
index 61c3326a..fc801134 100644
--- a/src/test/resources/templates/entity.java.vm
+++ b/src/test/resources/templates/entity.java.vm
@@ -10,11 +10,9 @@ import io.swagger.annotations.ApiModelProperty;
#if(${entityLombokModel})
import lombok.Data;
import lombok.EqualsAndHashCode;
-## import lombok.experimental.Accessors;
+import lombok.experimental.Accessors;
#end
-import java.util.Date;
-
/**
*
* $!{table.comment}
@@ -25,18 +23,18 @@ import java.util.Date;
*/
#if(${entityLombokModel})
@Data
+@Accessors(chain = true)
#if(${superEntityClass})
@EqualsAndHashCode(callSuper = true)
#else
@EqualsAndHashCode(callSuper = false)
#end
-## @Accessors(chain = true)
#end
#if(${table.convert})
@TableName("${table.name}")
#end
#if(${swagger2})
-@ApiModel(value="${entity}对象", description="$!{table.comment}")
+@ApiModel(value = "${entity}对象", description = "$!{table.comment}")
#end
#if(${superEntityClass})
public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
diff --git a/src/test/resources/templates/mapper.java.vm b/src/test/resources/templates/mapper.java.vm
index 207c1cbb..74d2b97d 100644
--- a/src/test/resources/templates/mapper.java.vm
+++ b/src/test/resources/templates/mapper.java.vm
@@ -28,6 +28,7 @@ public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
/**
* 根据ID获取查询对象
+ *
* @param id
* @return
*/
@@ -35,6 +36,7 @@ public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
/**
* 获取分页对象
+ *
* @param page
* @param ${cfg.entityObjectName}QueryParam
* @return
diff --git a/src/test/resources/templates/mapper.xml.vm b/src/test/resources/templates/mapper.xml.vm
index b3829d3f..3d6ebd75 100644
--- a/src/test/resources/templates/mapper.xml.vm
+++ b/src/test/resources/templates/mapper.xml.vm
@@ -36,11 +36,15 @@
#if(${cfg.generatorStrategy})
- select from ${table.name} where ${cfg.pkIdColumnName} = #{id}
+ select
+
+ from ${table.name} where ${cfg.pkIdColumnName} = #{id}
- select from ${table.name}
+ select
+
+ from ${table.name}
#end
diff --git a/src/test/resources/templates/queryParam.java.vm b/src/test/resources/templates/queryParam.java.vm
index 15357e73..a8dea102 100644
--- a/src/test/resources/templates/queryParam.java.vm
+++ b/src/test/resources/templates/queryParam.java.vm
@@ -1,8 +1,9 @@
-package io.geekidea.springbootplus.${package.ModuleName}.web.param;
+package ${cfg.queryParamPackage};
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
#if(${cfg.pageListOrder})
import ${cfg.orderQueryParamPath};
@@ -19,8 +20,9 @@ import ${cfg.queryParamCommonPath};
* @date ${date}
*/
@Data
+@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
-@ApiModel(value="${entity}QueryParam对象", description="$!{table.comment}查询参数")
+@ApiModel(value = "${entity}QueryParam对象", description = "$!{table.comment}查询参数")
#if(${cfg.pageListOrder})
public class ${entity}QueryParam extends OrderQueryParam {
#else
diff --git a/src/test/resources/templates/queryVo.java.vm b/src/test/resources/templates/queryVo.java.vm
index 4ccd4ce4..bf964cd5 100644
--- a/src/test/resources/templates/queryVo.java.vm
+++ b/src/test/resources/templates/queryVo.java.vm
@@ -1,4 +1,4 @@
-package io.geekidea.springbootplus.${package.ModuleName}.web.vo;
+package ${cfg.queryVoPackage};
#if(${swagger2})
import io.swagger.annotations.ApiModel;
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
#end
#if(${entityLombokModel})
import lombok.Data;
+import lombok.experimental.Accessors;
#end
import java.io.Serializable;
@@ -21,12 +22,13 @@ import java.util.Date;
*/
#if(${entityLombokModel})
@Data
+@Accessors(chain = true)
#end
#if(${table.convert})
@TableName("${table.name}")
#end
-@ApiModel(value="${entity}QueryVo对象", description="$!{table.comment}查询参数")
-public class ${entity}QueryVo implements Serializable{
+@ApiModel(value = "${entity}QueryVo对象", description = "$!{table.comment}查询参数")
+public class ${entity}QueryVo implements Serializable {
private static final long serialVersionUID = 1L;
## ---------- BEGIN 字段循环遍历 ----------
#foreach($field in ${table.fields})
diff --git a/src/test/resources/templates/service.java.vm b/src/test/resources/templates/service.java.vm
index 9009d5c1..5295594a 100644
--- a/src/test/resources/templates/service.java.vm
+++ b/src/test/resources/templates/service.java.vm
@@ -24,6 +24,7 @@ public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
/**
* 根据ID获取查询对象
+ *
* @param id
* @return
*/
@@ -31,6 +32,7 @@ public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
/**
* 获取分页对象
+ *
* @param ${cfg.entityObjectName}QueryParam
* @return
*/
diff --git a/src/test/resources/templates/serviceImpl.java.vm b/src/test/resources/templates/serviceImpl.java.vm
index 648f327d..152620a7 100644
--- a/src/test/resources/templates/serviceImpl.java.vm
+++ b/src/test/resources/templates/serviceImpl.java.vm
@@ -41,14 +41,14 @@ public class ${table.serviceImplName} extends BaseServiceImpl<${table.mapperName
#if(${cfg.generatorStrategy})
@Override
- public ${entity}QueryVo get${entity}ById(Serializable id) throws Exception{
+ public ${entity}QueryVo get${entity}ById(Serializable id) throws Exception {
return ${cfg.mapperObjectName}.get${entity}ById(id);
}
@Override
- public Paging<${entity}QueryVo> get${entity}PageList(${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception{
- Page page = setPageParam(${cfg.entityObjectName}QueryParam,OrderItem.desc("create_time"));
- IPage<${entity}QueryVo> iPage = ${cfg.mapperObjectName}.get${entity}PageList(page,${cfg.entityObjectName}QueryParam);
+ public Paging<${entity}QueryVo> get${entity}PageList(${entity}QueryParam ${cfg.entityObjectName}QueryParam) throws Exception {
+ Page page = setPageParam(${cfg.entityObjectName}QueryParam, OrderItem.desc("create_time"));
+ IPage<${entity}QueryVo> iPage = ${cfg.mapperObjectName}.get${entity}PageList(page, ${cfg.entityObjectName}QueryParam);
return new Paging(iPage);
}
#end