添加 api 代码生成模板.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package ${currentPackage};
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import ${package.Entity}.*;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
#foreach($pkg in ${customApiEntityFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 对外服务对象转换器
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${type}ApiConvert {
|
||||
|
||||
${type}ApiConvert MAPPER = Mappers.getMapper(${type}ApiConvert.class);
|
||||
|
||||
${type}DO to(${type}DTO dto);
|
||||
|
||||
${type}DTO to(${type}DO domain);
|
||||
|
||||
${type}DO to(${type}QueryDTO domain);
|
||||
|
||||
${type}CreateRequest to(${type}CreateDTO domain);
|
||||
|
||||
${type}UpdateRequest to(${type}UpdateDTO domain);
|
||||
|
||||
List<${type}DTO> toDTO(List<${type}DO> list);
|
||||
|
||||
List<${type}DO> toDomain(List<${type}DTO> list);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package ${currentPackage};
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 创建请求业务对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "${type}CreateDTO", description = "$!{table.comment} 创建请求业务对象")
|
||||
public class ${type}CreateDTO implements Serializable {
|
||||
|
||||
#foreach($field in ${table.fields})
|
||||
#if("$!field.propertyName" != "id")
|
||||
#if("$field.propertyType" == "String")
|
||||
@NotBlank
|
||||
@Size(max = $field.metaInfo.length)
|
||||
#else
|
||||
@NotNull
|
||||
#end
|
||||
#if("$!field.comment" != "")
|
||||
@Schema(description = "${field.comment}")
|
||||
#end
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package ${currentPackage};
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 查询请求业务对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "${type}QueryDTO", description = "$!{table.comment} 查询请求业务对象")
|
||||
public class ${type}QueryDTO implements Serializable {
|
||||
#foreach($field in ${table.fields})
|
||||
|
||||
#if("$field.propertyType" == "String")
|
||||
@Size(max = $field.metaInfo.length)
|
||||
#end
|
||||
#if("$!field.comment" != "")
|
||||
@Schema(description = "${field.comment}")
|
||||
#end
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package ${currentPackage};
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 更新请求业务对象
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "${type}UpdateDTO", description = "$!{table.comment} 更新请求业务对象")
|
||||
public class ${type}UpdateDTO implements Serializable {
|
||||
#foreach($field in ${table.fields})
|
||||
|
||||
#if("$field.propertyType" == "String")
|
||||
@NotBlank
|
||||
@Size(max = $field.metaInfo.length)
|
||||
#else
|
||||
@NotNull
|
||||
#end
|
||||
#if("$!field.comment" != "")
|
||||
@Schema(description = "${field.comment}")
|
||||
#end
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package ${package.ServiceImpl};
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import ${customApiInterfaceFilePackage}.${type}Api;
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 对外服务实现类
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ${type}ApiImpl implements ${type}Api {
|
||||
|
||||
@Resource
|
||||
private ${type}Service ${type}Service;
|
||||
|
||||
@Resource
|
||||
private ${type}DAO ${typeLower}DAO;
|
||||
|
||||
@Override
|
||||
public Long create${type}(${type}CreateDTO dto) {
|
||||
log.info("${type}Api.create${type} request: {}", JSON.toJSONString(dto));
|
||||
Valid.valid(dto);
|
||||
// 转换
|
||||
${type}CreateRequest request = ${type}ApiConvert.MAPPER.to(dto);
|
||||
// 创建
|
||||
return ${type}Service.create${type}(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer update${type}ById(${type}UpdateDTO dto) {
|
||||
log.info("${type}Api.update${type} request: {}", JSON.toJSONString(dto));
|
||||
Valid.valid(dto);
|
||||
// 转换
|
||||
${type}UpdateRequest request = ${type}ApiConvert.MAPPER.to(dto);
|
||||
// 修改
|
||||
return ${type}Service.update${type}(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ${type}DTO get${type}ById(Long id) {
|
||||
log.info("${type}Api.get${type}ById id: {}", id);
|
||||
Valid.notNull(id, ErrorMessage.ID_MISSING);
|
||||
// 修改
|
||||
${type}DO record = ${type}DAO.selectById(id);
|
||||
if (record == null) {
|
||||
return null;
|
||||
}
|
||||
// 转换
|
||||
return ${type}ApiConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}DTO> get${type}ListById(Collection<Long> idList) {
|
||||
log.info("${type}Api.get${type}ListById idList: {}", idList);
|
||||
if (Collections.isEmpty(idList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 查询
|
||||
List<${type}DO> rows = ${type}DAO.selectBatchIds(idList);
|
||||
// 转换
|
||||
return ${type}ApiConvert.MAPPER.toDTO(rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}DTO> get${type}List(${type}QueryDTO dto) {
|
||||
log.info("${type}Api.get${type}List dto: {}", JSON.toJSONString(dto));
|
||||
Valid.valid(dto);
|
||||
// 转换条件
|
||||
${type}DO domain = ${type}ApiConvert.MAPPER.to(dto);
|
||||
// 查询
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${type}DAO.queryCondition(domain);
|
||||
List<${type}DO> rows = ${type}DAO.selectList(wrapper);
|
||||
// 转换结果
|
||||
return ${type}ApiConvert.MAPPER.toDTO(rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer delete${type}ById(Long id) {
|
||||
log.info("${type}Api.delete${type}ById id: {}", id);
|
||||
Valid.notNull(id, ErrorMessage.ID_MISSING);
|
||||
// 删除
|
||||
return ${type}DAO.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDelete${type}ById(Collection<Long> idList) {
|
||||
log.info("${type}Api.batchDelete${type}ById idList: {}", idList);
|
||||
Valid.notEmpty(idList, ErrorMessage.ID_MISSING);
|
||||
// 删除
|
||||
return ${type}DAO.deleteBatchIds(idList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package ${currentPackage};
|
||||
|
||||
#foreach($pkg in ${customApiEntityFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 对外服务类
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @since ${date}
|
||||
*/
|
||||
public interface ${type}Api {
|
||||
|
||||
/**
|
||||
* ${apiComment.create}
|
||||
*
|
||||
* @param dto dto
|
||||
* @return id
|
||||
*/
|
||||
Long create${type}(${type}CreateDTO dto);
|
||||
|
||||
/**
|
||||
* ${apiComment.updateById}
|
||||
*
|
||||
* @param dto dto
|
||||
* @return effect
|
||||
*/
|
||||
Integer update${type}ById(${type}UpdateDTO dto);
|
||||
|
||||
/**
|
||||
* ${apiComment.getById}
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
${type}DTO get${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.listById}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
*/
|
||||
List<${type}DTO> get${type}ByIdList(Collection<Long> idList);
|
||||
|
||||
/**
|
||||
* ${apiComment.listAll}
|
||||
*
|
||||
* @param dto dto
|
||||
* @return rows
|
||||
*/
|
||||
List<${type}DTO> get${type}List(${type}QueryDTO dto);
|
||||
|
||||
/**
|
||||
* ${apiComment.deleteById}
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer delete${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.batchDeleteById}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDelete${type}ByIdList(Collection<Long> idList);
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ Authorization: {{token}}
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.update}
|
||||
${httpComment} ${apiComment.updateById}
|
||||
PUT {{baseUrl}}/${package.ModuleName}/${typeHyphen}/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
@@ -24,17 +24,29 @@ Authorization: {{token}}
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.get}
|
||||
${httpComment} ${apiComment.getById}
|
||||
GET {{baseUrl}}/${package.ModuleName}/${typeHyphen}/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.list}
|
||||
${httpComment} ${apiComment.listById}
|
||||
GET {{baseUrl}}/${package.ModuleName}/${typeHyphen}/list?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.query}
|
||||
${httpComment} ${apiComment.listAll}
|
||||
POST {{baseUrl}}/${package.ModuleName}/${typeHyphen}/list-all
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
#foreach($field in ${table.fields})
|
||||
"${field.propertyName}": ""#if($foreach.hasNext),#end
|
||||
#end
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.queryPage}
|
||||
POST {{baseUrl}}/${package.ModuleName}/${typeHyphen}/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
@@ -46,12 +58,12 @@ Authorization: {{token}}
|
||||
}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.delete}
|
||||
${httpComment} ${apiComment.deleteById}
|
||||
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
${httpComment} ${apiComment.batchDelete}
|
||||
${httpComment} ${apiComment.batchDeleteById}
|
||||
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/delete-batch?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
@@ -53,52 +53,60 @@ public class ${table.controllerName} {
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "${apiComment.update}")
|
||||
@Operation(summary = "${apiComment.updateById}")
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:update')")
|
||||
public Integer update${type}(@Validated @RequestBody ${type}UpdateRequest request) {
|
||||
return ${typeLower}Service.update${type}(request);
|
||||
return ${typeLower}Service.update${type}ById(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "${apiComment.get}")
|
||||
@Operation(summary = "${apiComment.getById}")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
||||
public ${type}VO get${type}(@RequestParam("id") Long id) {
|
||||
return ${typeLower}Service.get${type}(id);
|
||||
return ${typeLower}Service.get${type}ById(id);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "${apiComment.list}")
|
||||
@Operation(summary = "${apiComment.listById}")
|
||||
@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) {
|
||||
return ${typeLower}Service.get${type}List(idList);
|
||||
return ${typeLower}Service.get${type}ByIdList(idList);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/list-all")
|
||||
@Operation(summary = "${apiComment.listAll}")
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
||||
public List<${type}VO> get${type}ListAll(@Validated @RequestBody ${type}QueryRequest request) {
|
||||
return ${typeLower}Service.get${type}List(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "${apiComment.query}")
|
||||
@Operation(summary = "${apiComment.queryPage}")
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
|
||||
public DataGrid<${type}VO> get${type}Page(@Validated @RequestBody ${type}QueryRequest request) {
|
||||
return ${typeLower}Service.get${type}Page(request);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "${apiComment.delete}")
|
||||
@Operation(summary = "${apiComment.deleteById}")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:delete')")
|
||||
public Integer delete${type}(@RequestParam("id") Long id) {
|
||||
return ${typeLower}Service.delete${type}(id);
|
||||
return ${typeLower}Service.delete${type}ById(id);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-batch")
|
||||
@Operation(summary = "${apiComment.batchDelete}")
|
||||
@Operation(summary = "${apiComment.batchDeleteById}")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:delete')")
|
||||
public Integer batchDelete${type}(@RequestParam("idList") List<Long> idList) {
|
||||
return ${typeLower}Service.batchDelete${type}(idList);
|
||||
return ${typeLower}Service.batchDelete${type}ByIdList(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package ${currentPackage};
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import ${package.Entity}.*;
|
||||
#foreach($pkg in ${customFilePackages})
|
||||
import ${pkg}.*;
|
||||
#end
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* $!{table.comment} 暴露服务转换器
|
||||
*
|
||||
* @author ${author}
|
||||
* @version ${since}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${type}ProviderConvert {
|
||||
|
||||
${type}ProviderConvert MAPPER = Mappers.getMapper(${type}ProviderConvert.class);
|
||||
|
||||
${type}DO to(${type}DTO dto);
|
||||
|
||||
${type}DTO to(${type}DO domain);
|
||||
|
||||
List<${type}DO> toDO(List<${type}DTO> list);
|
||||
|
||||
List<${type}DTO> toDTO(List<${type}DO> list);
|
||||
|
||||
}
|
||||
@@ -20,12 +20,12 @@ import ${mapperAnnotationClass.name};
|
||||
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||
|
||||
/**
|
||||
* 获取全部条件
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 全部条件
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<${entity}> condition(${entity} 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
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer update${type}(${type}UpdateRequest request) {
|
||||
public Integer update${type}ById(${type}UpdateRequest request) {
|
||||
// 查询
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
@@ -62,7 +62,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ${type}VO get${type}(Long id) {
|
||||
public ${type}VO get${type}ById(Long id) {
|
||||
// 查询
|
||||
${type}DO record = ${typeLower}DAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
@@ -71,7 +71,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${type}VO> get${type}List(List<Long> idList) {
|
||||
public List<${type}VO> get${type}ByIdList(List<Long> idList) {
|
||||
// 查询
|
||||
List<${type}DO> records = ${typeLower}DAO.selectBatchIds(idList);
|
||||
if (records.isEmpty()) {
|
||||
@@ -82,13 +82,23 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
public List<${type}VO> get${type}List(${type}QueryRequest request) {
|
||||
// 转换
|
||||
${type}DO record = ${type}Convert.MAPPER.to(request);
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${typeLower}DAO.wrapper()
|
||||
#foreach($field in ${table.fields})
|
||||
.eq(${type}DO::get${field.capitalName}, request.get${field.capitalName}())
|
||||
#end
|
||||
.orderByDesc(${type}DO::getId);
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${typeLower}DAO.queryCondition(record);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
.list(${type}Convert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
|
||||
// 转换
|
||||
${type}DO record = ${type}Convert.MAPPER.to(request);
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = ${typeLower}DAO.queryCondition(record);
|
||||
// 查询
|
||||
return ${typeLower}DAO.of()
|
||||
.wrapper(wrapper)
|
||||
@@ -97,16 +107,16 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer delete${type}(Long id) {
|
||||
public Integer delete${type}ById(Long id) {
|
||||
int effect = ${typeLower}DAO.deleteById(id);
|
||||
log.info("${type}Service-delete${type} id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDelete${type}(List<Long> idList) {
|
||||
public Integer batchDelete${type}ByIdList(List<Long> idList) {
|
||||
int effect = ${typeLower}DAO.deleteBatchIds(idList);
|
||||
log.info("${type}Service-batchDelete${type} idList: {}, effect: {}", JSON.toJSONString(idList), effect);
|
||||
log.info("${type}Service-batchDelete${type} idList: {}, effect: {}", idList, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,31 +25,39 @@ public interface ${table.serviceName} {
|
||||
Long create${type}(${type}CreateRequest request);
|
||||
|
||||
/**
|
||||
* ${apiComment.update}
|
||||
* ${apiComment.updateById}
|
||||
*
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer update${type}(${type}UpdateRequest request);
|
||||
Integer update${type}ById(${type}UpdateRequest request);
|
||||
|
||||
/**
|
||||
* ${apiComment.get}
|
||||
* ${apiComment.getById}
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
${type}VO get${type}(Long id);
|
||||
${type}VO get${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.list}
|
||||
* ${apiComment.listById}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return rows
|
||||
*/
|
||||
List<${type}VO> get${type}List(List<Long> idList);
|
||||
List<${type}VO> get${type}ByIdList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* ${apiComment.query}
|
||||
* ${apiComment.listAll}
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
List<${type}VO> get${type}List(${type}QueryRequest request);
|
||||
|
||||
/**
|
||||
* ${apiComment.queryPage}
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
@@ -57,19 +65,19 @@ public interface ${table.serviceName} {
|
||||
DataGrid<${type}VO> get${type}Page(${type}QueryRequest request);
|
||||
|
||||
/**
|
||||
* ${apiComment.delete}
|
||||
* ${apiComment.deleteById}
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer delete${type}(Long id);
|
||||
Integer delete${type}ById(Long id);
|
||||
|
||||
/**
|
||||
* ${apiComment.batchDelete}
|
||||
* ${apiComment.batchDeleteById}
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDelete${type}(List<Long> idList);
|
||||
Integer batchDelete${type}ByIdList(List<Long> idList);
|
||||
|
||||
}
|
||||
|
||||
@@ -74,21 +74,21 @@ export function create${vue.featureFirstUpper}(request: ${vue.featureFirstUpper}
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.update
|
||||
* $apiComment.updateById
|
||||
*/
|
||||
export function update${vue.featureFirstUpper}(request: ${vue.featureFirstUpper}UpdateRequest) {
|
||||
return axios.put('/${package.ModuleName}/${typeHyphen}/update', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.get
|
||||
* $apiComment.getById
|
||||
*/
|
||||
export function get${vue.featureFirstUpper}(id: number) {
|
||||
return axios.get<${vue.featureFirstUpper}QueryResponse>('/${package.ModuleName}/${typeHyphen}/get', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.list
|
||||
* $apiComment.listById
|
||||
*/
|
||||
export function get${vue.featureFirstUpper}List(idList: Array<number>) {
|
||||
return axios.get<${vue.featureFirstUpper}QueryResponse[]>('/${package.ModuleName}/${typeHyphen}/list', {
|
||||
@@ -100,21 +100,28 @@ export function get${vue.featureFirstUpper}List(idList: Array<number>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.query
|
||||
* $apiComment.listAll
|
||||
*/
|
||||
export function get${vue.featureFirstUpper}ListAll(request: ${vue.featureFirstUpper}QueryRequest) {
|
||||
return axios.post<Array<${vue.featureFirstUpper}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/list-all', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.queryPage
|
||||
*/
|
||||
export function get${vue.featureFirstUpper}Page(request: ${vue.featureFirstUpper}QueryRequest) {
|
||||
return axios.post<DataGrid<${vue.featureFirstUpper}QueryResponse>>('/${package.ModuleName}/${typeHyphen}/query', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.delete
|
||||
* $apiComment.deleteById
|
||||
*/
|
||||
export function delete${vue.featureFirstUpper}(id: number) {
|
||||
return axios.delete('/${package.ModuleName}/${typeHyphen}/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* $apiComment.batchDelete
|
||||
* $apiComment.batchDeleteById
|
||||
*/
|
||||
export function batchDelete${vue.featureFirstUpper}(idList: Array<number>) {
|
||||
return axios.delete('/${package.ModuleName}/${typeHyphen}/delete-batch', {
|
||||
|
||||
Reference in New Issue
Block a user