Merge branch 'master' into feat_userprofile

# Conflicts:
#	src/main/resources/application-dev.yaml
#	src/main/resources/application-local.yaml
This commit is contained in:
niudehua
2021-03-13 21:02:01 +08:00
46 changed files with 1633 additions and 1149 deletions

View File

@@ -55,7 +55,7 @@ public class ${table.className}Controller {
@DeleteMapping("/delete")
@ApiOperation("删除${table.classComment}")
@ApiImplicitParam(name = "id", value = "编号", required = true)
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')")
@PreAuthorize("@ss.hasPermission('${permissionPrefix}:delete')")
public CommonResult<Boolean> delete${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) {
${classNameVar}Service.delete${simpleClassName}(id);
return success(true);

View File

@@ -16,6 +16,7 @@ import ${basePackage}.modules.${table.moduleName}.service.${table.businessName}.
import ${ServiceExceptionUtilClassName};
import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception;
import static ${basePackage}.modules.${table.moduleName}.enums.${simpleModuleName_upperFirst}ErrorCodeConstants.*;
/**
@@ -58,7 +59,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
private void validate${simpleClassName}Exists(${primaryColumn.javaType} id) {
if (${classNameVar}Mapper.selectById(id) == null) {
throw ServiceExceptionUtil.exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
}
}

View File

@@ -1,13 +1,11 @@
package ${basePackage}.modules.${table.moduleName}.service.${table.businessName};
import ${basePackage}.BaseSpringBootUnitTest;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import javax.annotation.Resource;
import cn.iocoder.dashboard.BaseSpringBootUnitTest;
import ${basePackage}.BaseDbUnitTest;
import ${basePackage}.modules.${table.moduleName}.service.${table.businessName}.impl.${table.className}ServiceImpl;
import ${basePackage}.modules.${table.moduleName}.controller.${table.businessName}.vo.*;
import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
@@ -16,6 +14,7 @@ import ${basePackage}.util.object.ObjectUtils;
import ${PageResultClassName};
import javax.annotation.Resource;
import org.springframework.context.annotation.Import;
import java.util.*;
import static cn.hutool.core.util.RandomUtil.*;
@@ -64,7 +63,8 @@ import static org.mockito.Mockito.*;
*
* @author ${table.author}
*/
public class ${table.className}ServiceTest extends BaseSpringBootUnitTest {
@Import(${table.className}ServiceImpl.class)
public class ${table.className}ServiceTest extends BaseDbUnitTest {
@Resource
private ${table.className}ServiceImpl ${classNameVar}Service;
@@ -78,7 +78,7 @@ public class ${table.className}ServiceTest extends BaseSpringBootUnitTest {
${table.className}CreateReqVO reqVO = randomPojo(${table.className}CreateReqVO.class);
// 调用
Long ${classNameVar}Id = ${classNameVar}Service.create${simpleClassName}(reqVO);
${primaryColumn.javaType} ${classNameVar}Id = ${classNameVar}Service.create${simpleClassName}(reqVO);
// 断言
assertNotNull(${classNameVar}Id);
// 校验记录的属性是否正确
@@ -118,7 +118,7 @@ public class ${table.className}ServiceTest extends BaseSpringBootUnitTest {
${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class);
${classNameVar}Mapper.insert(db${simpleClassName});// @Sql: 先插入出一条存在的数据
// 准备参数
Long id = db${simpleClassName}.getId();
${primaryColumn.javaType} id = db${simpleClassName}.getId();
// 调用
${classNameVar}Service.delete${simpleClassName}(id);
@@ -129,7 +129,7 @@ public class ${table.className}ServiceTest extends BaseSpringBootUnitTest {
@Test
public void testDelete${simpleClassName}_notExists() {
// 准备参数
Long id = randomLongId();
${primaryColumn.javaType} id = random${primaryColumn.javaType}Id();
// 调用, 并断言异常
assertServiceException(() -> ${classNameVar}Service.delete${simpleClassName}(id), ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);

View File

@@ -4,7 +4,7 @@ INSERT INTO `sys_menu`(
`path`, `icon`, `component`, `status`
)
VALUES (
'${table.classComment}管理', '${permissionPrefix}:query', 2, 0, ${table.parentMenuId},
'${table.classComment}管理', '', 2, 0, ${table.parentMenuId},
'${simpleClassName_strikeCase}', '', '${table.moduleName}/${classNameVar}/index', 0
);
@@ -12,8 +12,8 @@ VALUES (
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
#set ($functionNames = ['创建', '更新', '删除', '导出'])
#set ($functionOps = ['create', 'update', 'delete', 'export'])
#set ($functionNames = ['查询', '创建', '更新', '删除', '导出'])
#set ($functionOps = ['query', 'create', 'update', 'delete', 'export'])
#foreach ($functionName in $functionNames)
#set ($index = $foreach.count - 1)
INSERT INTO `sys_menu`(
@@ -21,7 +21,7 @@ INSERT INTO `sys_menu`(
`path`, `icon`, `component`, `status`
)
VALUES (
'${table.tableComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId,
'${table.classComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId,
'', '', '', 0
);
#end

View File

@@ -68,7 +68,7 @@
#if ($column.javaType == "Date")## 时间类型
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.${javaField}) }}</span>
</template>
</el-table-column>
#elseif("" != $column.dictType)## 数据字典