修改代码生成器模板.
This commit is contained in:
@@ -270,12 +270,12 @@ public class CodeGenerator {
|
||||
*/
|
||||
private static TemplateConfig getTemplateConfig() {
|
||||
return new TemplateConfig.Builder()
|
||||
.controller("/templates/orion-server-controller.java.vm")
|
||||
.entity("/templates/orion-server-entity-do.java.vm")
|
||||
.service("/templates/orion-server-service.java.vm")
|
||||
.serviceImpl("/templates/orion-server-service-impl.java.vm")
|
||||
.mapper("/templates/orion-server-mapper.java.vm")
|
||||
.xml("/templates/orion-server-mapper.xml.vm")
|
||||
.controller("/templates/orion-server-module-controller.java.vm")
|
||||
.entity("/templates/orion-server-module-entity-do.java.vm")
|
||||
.service("/templates/orion-server-module-service.java.vm")
|
||||
.serviceImpl("/templates/orion-server-module-service-impl.java.vm")
|
||||
.mapper("/templates/orion-server-module-mapper.java.vm")
|
||||
.xml("/templates/orion-server-module-mapper.xml.vm")
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -288,32 +288,34 @@ public class CodeGenerator {
|
||||
String[][] customFileDefineArr = new String[][]{
|
||||
// -------------------- 后端 - service --------------------
|
||||
// http 文件
|
||||
new String[]{"/templates/orion-server-controller.http.vm", "%sController.http", "controller"},
|
||||
new String[]{"/templates/orion-server-module-controller.http.vm", "%sController.http", "controller"},
|
||||
// vo 文件
|
||||
new String[]{"/templates/orion-server-entity-vo.java.vm", "%sVO.java", "entity.vo"},
|
||||
new String[]{"/templates/orion-server-module-entity-vo.java.vm", "%sVO.java", "entity.vo"},
|
||||
// create request 文件
|
||||
new String[]{"/templates/orion-server-entity-request-create.java.vm", "%sCreateRequest.java", "entity.request.%s"},
|
||||
new String[]{"/templates/orion-server-module-entity-request-create.java.vm", "%sCreateRequest.java", "entity.request.%s"},
|
||||
// update request 文件
|
||||
new String[]{"/templates/orion-server-entity-request-update.java.vm", "%sUpdateRequest.java", "entity.request.%s"},
|
||||
new String[]{"/templates/orion-server-module-entity-request-update.java.vm", "%sUpdateRequest.java", "entity.request.%s"},
|
||||
// query request 文件
|
||||
new String[]{"/templates/orion-server-entity-request-query.java.vm", "%sQueryRequest.java", "entity.request.%s"},
|
||||
new String[]{"/templates/orion-server-module-entity-request-query.java.vm", "%sQueryRequest.java", "entity.request.%s"},
|
||||
// convert 文件
|
||||
new String[]{"/templates/orion-server-convert.java.vm", "%sConvert.java", "convert"},
|
||||
// -------------------- 后端 - api --------------------
|
||||
new String[]{"/templates/orion-server-module-convert.java.vm", "%sConvert.java", "convert"},
|
||||
// junit test 文件
|
||||
|
||||
// -------------------- 后端 - provider --------------------
|
||||
// api 文件
|
||||
new String[]{"/templates/orion-server-api-interface.java.vm", "%sApi.java", "api"},
|
||||
new String[]{"/templates/orion-server-provider-api.java.vm", "%sApi.java", "api"},
|
||||
// api impl 文件
|
||||
new String[]{"/templates/orion-server-api-impl.java.vm", "%sApiImpl.java", "api.impl"},
|
||||
new String[]{"/templates/orion-server-provider-api-impl.java.vm", "%sApiImpl.java", "api.impl"},
|
||||
// dto 文件
|
||||
new String[]{"/templates/orion-server-api-entity-dto.java.vm", "%sDTO.java", "entity.dto.%s"},
|
||||
new String[]{"/templates/orion-server-provider-entity-dto.java.vm", "%sDTO.java", "entity.dto.%s"},
|
||||
// create dto 文件
|
||||
new String[]{"/templates/orion-server-api-entity-dto-create.java.vm", "%sCreateDTO.java", "entity.dto.%s"},
|
||||
new String[]{"/templates/orion-server-provider-entity-dto-create.java.vm", "%sCreateDTO.java", "entity.dto.%s"},
|
||||
// update dto 文件
|
||||
new String[]{"/templates/orion-server-api-entity-dto-update.java.vm", "%sUpdateDTO.java", "entity.dto.%s"},
|
||||
new String[]{"/templates/orion-server-provider-entity-dto-update.java.vm", "%sUpdateDTO.java", "entity.dto.%s"},
|
||||
// query dto 文件
|
||||
new String[]{"/templates/orion-server-api-entity-dto-query.java.vm", "%sQueryDTO.java", "entity.dto.%s"},
|
||||
// convert provider 文件
|
||||
new String[]{"/templates/orion-server-api-convert.java.vm", "%sApiConvert.java", "convert"},
|
||||
new String[]{"/templates/orion-server-provider-entity-dto-query.java.vm", "%sQueryDTO.java", "entity.dto.%s"},
|
||||
// convert 文件
|
||||
new String[]{"/templates/orion-server-provider-convert.java.vm", "%sProviderConvert.java", "convert"},
|
||||
// -------------------- 前端 --------------------
|
||||
// vue api 文件
|
||||
new String[]{"/templates/orion-vue-api.ts.vm", "${feature}.ts", "vue/api/${module}"},
|
||||
|
||||
@@ -34,9 +34,9 @@ public class GenTable {
|
||||
private String bizPackage;
|
||||
|
||||
/**
|
||||
* 是否生成 provider api
|
||||
* 是否生成对外 api
|
||||
*/
|
||||
private boolean genApi;
|
||||
private boolean genProviderApi;
|
||||
|
||||
// -------------------- 前端 --------------------
|
||||
|
||||
@@ -64,11 +64,11 @@ public class GenTable {
|
||||
this(tableName, comment, bizPackage, false);
|
||||
}
|
||||
|
||||
public GenTable(String tableName, String comment, String bizPackage, boolean genApi) {
|
||||
public GenTable(String tableName, String comment, String bizPackage, boolean genProviderApi) {
|
||||
this.tableName = tableName;
|
||||
this.comment = comment;
|
||||
this.bizPackage = bizPackage;
|
||||
this.genApi = genApi;
|
||||
this.genProviderApi = genProviderApi;
|
||||
this.enums = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class GenTable {
|
||||
* @return this
|
||||
*/
|
||||
public GenTable api() {
|
||||
this.genApi = true;
|
||||
this.genProviderApi = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,9 +127,9 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
|
||||
.collect(Collectors.toList());
|
||||
// 获取 table
|
||||
GenTable table = tables.get(tableInfo.getName());
|
||||
// 不生成 api 文件
|
||||
if (!table.isGenApi()) {
|
||||
files.removeIf(file -> this.isServerApiFile(file.getTemplatePath()));
|
||||
// 不生成对外 api 文件
|
||||
if (!table.isGenProviderApi()) {
|
||||
files.removeIf(file -> this.isServerProviderFile(file.getTemplatePath()));
|
||||
}
|
||||
// 不生成 vue 文件
|
||||
if (!table.isGenVue()) {
|
||||
@@ -168,17 +168,17 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 自定义文件的包 (导入用)
|
||||
List<String> customFilePackages = packageConverter.apply(s -> s.contains(".java.vm") && !s.contains("orion-server-api"));
|
||||
objectMap.put("customFilePackages", customFilePackages);
|
||||
// 自定义 module 文件的包 (导入用)
|
||||
List<String> customModuleFilePackages = packageConverter.apply(s -> s.contains(".java.vm") && s.contains("orion-server-module"));
|
||||
objectMap.put("customModuleFilePackages", customModuleFilePackages);
|
||||
|
||||
// 自定义 api entity 文件的包 (导入用)
|
||||
List<String> customApiEntityFilePackages = packageConverter.apply(s -> s.contains(".java.vm") && s.contains("orion-server-api-entity"));
|
||||
objectMap.put("customApiEntityFilePackages", customApiEntityFilePackages);
|
||||
// 自定义 provider entity 文件的包 (导入用)
|
||||
List<String> customProviderEntityFilePackages = packageConverter.apply(s -> s.contains(".java.vm") && s.contains("orion-server-provider-entity"));
|
||||
objectMap.put("customProviderEntityFilePackages", customProviderEntityFilePackages);
|
||||
|
||||
// 自定义 api interface 文件的包 (导入用)
|
||||
List<String> customApiInterfaceFilePackages = packageConverter.apply(s -> s.contains("orion-server-api-interface.java.vm"));
|
||||
objectMap.put("customApiInterfaceFilePackage", customApiInterfaceFilePackages.get(0));
|
||||
// 自定义 provider interface 文件的包 (导入用)
|
||||
List<String> customProviderFilePackages = packageConverter.apply(s -> s.contains(".java.vm") && s.contains("orion-server-provider"));
|
||||
objectMap.put("customProviderFilePackages", customProviderFilePackages);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,11 +217,11 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
|
||||
map.put("create", "创建" + comment);
|
||||
map.put("updateById", "通过 id 更新" + comment);
|
||||
map.put("getById", "通过 id 查询" + comment);
|
||||
map.put("listById", "通过 id 批量查询" + comment);
|
||||
map.put("listByIdList", "通过 id 批量查询" + comment);
|
||||
map.put("listAll", "查询全部" + comment);
|
||||
map.put("queryPage", "分页查询" + comment);
|
||||
map.put("deleteById", "通过 id 删除" + comment);
|
||||
map.put("batchDeleteById", "通过 id 批量删除" + comment);
|
||||
map.put("batchDeleteByIdList", "通过 id 批量删除" + comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,13 +316,13 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为后端 api 文件
|
||||
* 是否为后端 provider 文件
|
||||
*
|
||||
* @param templatePath templatePath
|
||||
* @return 是否为 sql 文件
|
||||
*/
|
||||
private boolean isServerApiFile(String templatePath) {
|
||||
return templatePath.contains("orion-server-api");
|
||||
private boolean isServerProviderFile(String templatePath) {
|
||||
return templatePath.contains("orion-server-provider");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ GET {{baseUrl}}/${package.ModuleName}/${typeHyphen}/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.listById}
|
||||
${httpComment} ${apiComment.listByIdList}
|
||||
GET {{baseUrl}}/${package.ModuleName}/${typeHyphen}/list?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
@@ -63,7 +63,7 @@ DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.batchDeleteById}
|
||||
${httpComment} ${apiComment.batchDeleteByIdList}
|
||||
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete-batch?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.orion.ops.framework.common.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.common.annotation.RestWrapper;
|
||||
import com.orion.ops.framework.common.constant.IgnoreLogMode;
|
||||
import ${package.Service}.*;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#if(${superControllerClassPackage})
|
||||
@@ -70,7 +70,7 @@ public class ${table.controllerName} {
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "${apiComment.listById}")
|
||||
@Operation(summary = "${apiComment.listByIdList}")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
||||
public List<${type}VO> get${type}List(@RequestParam("idList") List<Long> idList) {
|
||||
@@ -102,7 +102,7 @@ public class ${table.controllerName} {
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-batch")
|
||||
@Operation(summary = "${apiComment.batchDeleteById}")
|
||||
@Operation(summary = "${apiComment.batchDeleteByIdList}")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:delete')")
|
||||
public Integer batchDelete${type}(@RequestParam("idList") List<Long> idList) {
|
||||
@@ -3,7 +3,7 @@ package ${currentPackage};
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import ${package.Entity}.*;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import java.util.List;
|
||||
@@ -28,7 +28,7 @@ public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||
default LambdaQueryWrapper<${entity}> queryCondition(${entity} entity) {
|
||||
return this.wrapper()
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, entity.get${field.capitalName}())#if(!$foreach.hasNext);#end
|
||||
.eq(${type}DO::get${field.capitalName}, entity.get${field.capitalName}())#if(!$foreach.hasNext);#end
|
||||
#end
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#if(${baseColumnList})
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
#foreach($field in ${table.commonFields})#if(${foreach.count} == 1) #end${field.columnName}, #end${table.fieldNames}
|
||||
${table.fieldNames}, #foreach($field in ${table.commonFields})${field.columnName}#if($foreach.hasNext), #end#end
|
||||
</sql>
|
||||
|
||||
#end
|
||||
@@ -6,7 +6,7 @@ import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import ${package.Entity}.${entity};
|
||||
@@ -57,7 +57,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
this.check${type}Present(updateRecord);
|
||||
// 更新
|
||||
int effect = ${typeLower}DAO.updateById(updateRecord);
|
||||
log.info("${type}Service-update${type} effect: {}, updateRecord: {}", effect, JSON.toJSONString(updateRecord));
|
||||
log.info("${type}Service-update${type}ById effect: {}, updateRecord: {}", effect, JSON.toJSONString(updateRecord));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -109,14 +109,14 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
@Override
|
||||
public Integer delete${type}ById(Long id) {
|
||||
int effect = ${typeLower}DAO.deleteById(id);
|
||||
log.info("${type}Service-delete${type} id: {}, effect: {}", id, effect);
|
||||
log.info("${type}Service-delete${type}ById id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDelete${type}ByIdList(List<Long> idList) {
|
||||
int effect = ${typeLower}DAO.deleteBatchIds(idList);
|
||||
log.info("${type}Service-batchDelete${type} idList: {}, effect: {}", idList, effect);
|
||||
log.info("${type}Service-batchDelete${type}ByIdList idList: {}, effect: {}", idList, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ${package.Service};
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface ${table.serviceName} {
|
||||
${type}VO get${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.listById}
|
||||
* ${apiComment.listByIdList}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
@@ -73,7 +73,7 @@ public interface ${table.serviceName} {
|
||||
Integer delete${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.batchDeleteById}
|
||||
* ${apiComment.batchDeleteByIdList}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
@@ -5,10 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.utils.collect.Collections;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#foreach($pkg in ${customProviderFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import ${customApiInterfaceFilePackage}.${type}Api;
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
@@ -16,6 +18,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,7 +34,7 @@ import java.util.List;
|
||||
public class ${type}ApiImpl implements ${type}Api {
|
||||
|
||||
@Resource
|
||||
private ${type}Service ${type}Service;
|
||||
private ${type}Service ${typeLower}Service;
|
||||
|
||||
@Resource
|
||||
private ${type}DAO ${typeLower}DAO;
|
||||
@@ -40,19 +44,19 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
log.info("${type}Api.create${type} request: {}", JSON.toJSONString(dto));
|
||||
Valid.valid(dto);
|
||||
// 转换
|
||||
${type}CreateRequest request = ${type}ApiConvert.MAPPER.to(dto);
|
||||
${type}CreateRequest request = ${type}ProviderConvert.MAPPER.to(dto);
|
||||
// 创建
|
||||
return ${type}Service.create${type}(request);
|
||||
return ${typeLower}Service.create${type}(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer update${type}ById(${type}UpdateDTO dto) {
|
||||
log.info("${type}Api.update${type} request: {}", JSON.toJSONString(dto));
|
||||
log.info("${type}Api.update${type}ById request: {}", JSON.toJSONString(dto));
|
||||
Valid.valid(dto);
|
||||
// 转换
|
||||
${type}UpdateRequest request = ${type}ApiConvert.MAPPER.to(dto);
|
||||
${type}UpdateRequest request = ${type}ProviderConvert.MAPPER.to(dto);
|
||||
// 修改
|
||||
return ${type}Service.update${type}(request);
|
||||
return ${typeLower}Service.update${type}ById(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,24 +64,24 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
log.info("${type}Api.get${type}ById id: {}", id);
|
||||
Valid.notNull(id, ErrorMessage.ID_MISSING);
|
||||
// 修改
|
||||
${type}DO record = ${type}DAO.selectById(id);
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
if (record == null) {
|
||||
return null;
|
||||
}
|
||||
// 转换
|
||||
return ${type}ApiConvert.MAPPER.to(record);
|
||||
return ${type}ProviderConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}DTO> get${type}ListById(Collection<Long> idList) {
|
||||
log.info("${type}Api.get${type}ListById idList: {}", idList);
|
||||
public List<${type}DTO> get${type}ByIdList(Collection<Long> idList) {
|
||||
log.info("${type}Api.get${type}ByIdList idList: {}", idList);
|
||||
if (Collections.isEmpty(idList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 查询
|
||||
List<${type}DO> rows = ${type}DAO.selectBatchIds(idList);
|
||||
List<${type}DO> rows = ${typeLower}DAO.selectBatchIds(idList);
|
||||
// 转换
|
||||
return ${type}ApiConvert.MAPPER.toDTO(rows);
|
||||
return ${type}ProviderConvert.MAPPER.toList(rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,12 +89,12 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
log.info("${type}Api.get${type}List dto: {}", JSON.toJSONString(dto));
|
||||
Valid.valid(dto);
|
||||
// 转换条件
|
||||
${type}DO domain = ${type}ApiConvert.MAPPER.to(dto);
|
||||
${type}DO domain = ${type}ProviderConvert.MAPPER.to(dto);
|
||||
// 查询
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${type}DAO.queryCondition(domain);
|
||||
List<${type}DO> rows = ${type}DAO.selectList(wrapper);
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${typeLower}DAO.queryCondition(domain);
|
||||
List<${type}DO> rows = ${typeLower}DAO.selectList(wrapper);
|
||||
// 转换结果
|
||||
return ${type}ApiConvert.MAPPER.toDTO(rows);
|
||||
return ${type}ProviderConvert.MAPPER.toList(rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,15 +102,15 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
log.info("${type}Api.delete${type}ById id: {}", id);
|
||||
Valid.notNull(id, ErrorMessage.ID_MISSING);
|
||||
// 删除
|
||||
return ${type}DAO.deleteById(id);
|
||||
return ${typeLower}DAO.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDelete${type}ById(Collection<Long> idList) {
|
||||
log.info("${type}Api.batchDelete${type}ById idList: {}", idList);
|
||||
public Integer batchDelete${type}ByIdList(Collection<Long> idList) {
|
||||
log.info("${type}Api.batchDelete${type}ByIdList idList: {}", idList);
|
||||
Valid.notEmpty(idList, ErrorMessage.ID_MISSING);
|
||||
// 删除
|
||||
return ${type}DAO.deleteBatchIds(idList);
|
||||
return ${typeLower}DAO.deleteBatchIds(idList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package ${currentPackage};
|
||||
|
||||
#foreach($pkg in ${customApiEntityFilePackages})
|
||||
#foreach($pkg in ${customProviderEntityFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
|
||||
@@ -41,7 +41,7 @@ public interface ${type}Api {
|
||||
${type}DTO get${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.listById}
|
||||
* ${apiComment.listByIdList}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
@@ -65,7 +65,7 @@ public interface ${type}Api {
|
||||
Integer delete${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.batchDeleteById}
|
||||
* ${apiComment.batchDeleteByIdList}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
@@ -3,10 +3,10 @@ package ${currentPackage};
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import ${package.Entity}.*;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
#foreach($pkg in ${customModuleFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#foreach($pkg in ${customApiEntityFilePackages})
|
||||
#foreach($pkg in ${customProviderEntityFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import java.util.List;
|
||||
@@ -19,9 +19,9 @@ import java.util.List;
|
||||
* @since ${date}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${type}ApiConvert {
|
||||
public interface ${type}ProviderConvert {
|
||||
|
||||
${type}ApiConvert MAPPER = Mappers.getMapper(${type}ApiConvert.class);
|
||||
${type}ProviderConvert MAPPER = Mappers.getMapper(${type}ProviderConvert.class);
|
||||
|
||||
${type}DO to(${type}DTO dto);
|
||||
|
||||
@@ -33,7 +33,8 @@ public interface ${type}ApiConvert {
|
||||
|
||||
${type}UpdateRequest to(${type}UpdateDTO domain);
|
||||
|
||||
List<${type}DTO> toDTO(List<${type}DO> list);
|
||||
List<${type}DTO> toList(List<${type}DO> list);
|
||||
|
||||
List<${type}DO> toList1(List<${type}DTO> list);
|
||||
|
||||
List<${type}DO> toDomain(List<${type}DTO> list);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export function get${vue.featureFirstUpper}(id: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.listById
|
||||
* $apiComment.listByIdList
|
||||
*/
|
||||
export function get${vue.featureFirstUpper}List(idList: Array<number>) {
|
||||
return axios.get<${vue.featureFirstUpper}QueryResponse[]>('/${package.ModuleName}/${typeHyphen}/list', {
|
||||
@@ -121,7 +121,7 @@ export function delete${vue.featureFirstUpper}(id: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.batchDeleteById
|
||||
* $apiComment.batchDeleteByIdList
|
||||
*/
|
||||
export function batchDelete${vue.featureFirstUpper}(idList: Array<number>) {
|
||||
return axios.delete('/${package.ModuleName}/${typeHyphen}/delete-batch', {
|
||||
|
||||
Reference in New Issue
Block a user