refactor: 实体命名规范调整,代码生成同步调整
This commit is contained in:
1 parent
5817826bbd
commit
8eaed3cfb7
165 files changed
+1885
-2038
No files matched your search
@@ -48,11 +48,11 @@ public class SystemCodeGenerator {
|
||||
// 注入配置(设置扩展类的模板路径和包路径)
|
||||
.injectionConfig(consumer -> {
|
||||
List<CustomFile> customFiles = new ArrayList<>();
|
||||
customFiles.add(new CustomFile.Builder().fileName("VO.java").templatePath("/templates/vo.java.vm").packageName("model.vo").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("DTO.java").templatePath("/templates/dto.java.vm").packageName("model.dto").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("BO.java").templatePath("/templates/bo.java.vm").packageName("model.bo").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("Vo.java").templatePath("/templates/vo.java.vm").packageName("model.vo").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("Dto.java").templatePath("/templates/dto.java.vm").packageName("model.dto").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("Bo.java").templatePath("/templates/bo.java.vm").packageName("model.bo").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("PageQuery.java").templatePath("/templates/query.java.vm").packageName("model.query").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("PageVO.java").templatePath("/templates/pageVO.java.vm").packageName("model.vo").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("PageVo.java").templatePath("/templates/pageVo.java.vm").packageName("model.vo").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("Form.java").templatePath("/templates/form.java.vm").packageName("model.form").build());
|
||||
customFiles.add(new CustomFile.Builder().fileName("Converter.java").templatePath("/templates/converter.java.vm").packageName("converter").build());
|
||||
consumer.customFile(customFiles);
|
||||
|
||||
@@ -26,13 +26,13 @@ import java.time.LocalDateTime;
|
||||
#end
|
||||
#end
|
||||
#if(${superEntityClass})
|
||||
public class ${entity}BO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
public class ${entity}Bo extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
#elseif(${activeRecord})
|
||||
public class ${entity}BO extends Model<${entity}> {
|
||||
public class ${entity}Bo extends Model<${entity}> {
|
||||
#elseif(${entitySerialVersionUID})
|
||||
public class ${entity}BO implements Serializable {
|
||||
public class ${entity}Bo implements Serializable {
|
||||
#else
|
||||
public class ${entity}BO {
|
||||
public class ${entity}Bo {
|
||||
#end
|
||||
#if(${entitySerialVersionUID})
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ${package.Parent}.model.form.${entity}Form;
|
||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
import ${package.Parent}.model.vo.${entity}PageVO;
|
||||
import ${package.Parent}.model.vo.${entity}PageVo;
|
||||
import ${package.Parent}.service.${table.serviceName};
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.youlai.common.result.PageResult;
|
||||
@@ -41,8 +41,8 @@ public class ${table.controllerName} {
|
||||
|
||||
@Operation(summary = "$!{table.comment}分页列表")
|
||||
@GetMapping("/page")
|
||||
public PageResult<${entity}PageVO> listPaged${entity}s(${entity}PageQuery queryParams ) {
|
||||
IPage<${entity}PageVO> result = ${firstCharLowerCaseEntity}Service.listPaged${entity}s(queryParams);
|
||||
public PageResult<${entity}PageVo> listPaged${entity}s(${entity}PageQuery queryParams ) {
|
||||
IPage<${entity}PageVo> result = ${firstCharLowerCaseEntity}Service.listPaged${entity}s(queryParams);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import ${package.Parent}.model.dto.${entity}DTO;
|
||||
import ${package.Parent}.model.dto.${entity}Dto;
|
||||
import ${package.Parent}.model.entity.${entity};
|
||||
import ${package.Parent}.model.vo.${entity}PageVO;
|
||||
import ${package.Parent}.model.vo.${entity}PageVo;
|
||||
import ${package.Parent}.model.form.${entity}Form;
|
||||
import ${package.Parent}.model.bo.${entity}BO;
|
||||
import ${package.Parent}.model.bo.${entity}Bo;
|
||||
|
||||
/**
|
||||
* $!{table.comment}转换器
|
||||
@@ -19,9 +19,9 @@ import ${package.Parent}.model.bo.${entity}BO;
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ${entity}Converter{
|
||||
|
||||
${entity}PageVO toPageVo(${entity}BO bo);
|
||||
${entity}PageVo toPageVo(${entity}Bo bo);
|
||||
|
||||
Page<${entity}PageVO> toPageVo(Page<${entity}BO> bo);
|
||||
Page<${entity}PageVo> toPageVo(Page<${entity}Bo> bo);
|
||||
|
||||
${entity}Form toForm(${entity} entity);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.Setter;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* $!{table.comment} DTO
|
||||
* $!{table.comment} Dto
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
@@ -26,13 +26,13 @@ import java.time.LocalDateTime;
|
||||
#end
|
||||
@Schema( description = "$!{table.comment}传输层对象")
|
||||
#if(${superEntityClass})
|
||||
public class ${entity}DTO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
public class ${entity}Dto extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
#elseif(${activeRecord})
|
||||
public class ${entity}DTO extends Model<${entity}> {
|
||||
public class ${entity}Dto extends Model<${entity}> {
|
||||
#elseif(${entitySerialVersionUID})
|
||||
public class ${entity}DTO implements Serializable {
|
||||
public class ${entity}Dto implements Serializable {
|
||||
#else
|
||||
public class ${entity}DTO {
|
||||
public class ${entity}Dto {
|
||||
#end
|
||||
#if(${entitySerialVersionUID})
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import ${superMapperClassPackage};
|
||||
import ${mapperAnnotationClass.name};
|
||||
#end
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import ${package.Parent}.model.bo.${entity}BO;
|
||||
import ${package.Parent}.model.bo.${entity}Bo;
|
||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -30,6 +30,6 @@ public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||
* @param queryParams 查询参数
|
||||
* @return
|
||||
*/
|
||||
Page<${entity}BO> listPaged${entity}s(Page<${entity}BO> page, ${entity}PageQuery queryParams);
|
||||
Page<${entity}Bo> listPaged${entity}s(Page<${entity}Bo> page, ${entity}PageQuery queryParams);
|
||||
|
||||
}
|
||||
@@ -38,7 +38,7 @@
|
||||
#end
|
||||
|
||||
<!-- ${table.comment}分页列表 -->
|
||||
<select id="listPaged${entity}s" resultType="${package.Parent}.model.bo.${entity}BO">
|
||||
<select id="listPaged${entity}s" resultType="${package.Parent}.model.bo.${entity}Bo">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM
|
||||
|
||||
@@ -13,7 +13,7 @@ import lombok.Setter;
|
||||
#end
|
||||
|
||||
/**
|
||||
* $!{table.comment} 分页VO
|
||||
* $!{table.comment} 分页Vo
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
@@ -27,13 +27,13 @@ import lombok.Setter;
|
||||
#end
|
||||
@Schema( description = "$!{table.comment}分页视图对象")
|
||||
#if(${superEntityClass})
|
||||
public class ${entity}PageVO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
public class ${entity}PageVo extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
#elseif(${activeRecord})
|
||||
public class ${entity}PageVO extends Model<${entity}> {
|
||||
public class ${entity}PageVo extends Model<${entity}> {
|
||||
#elseif(${entitySerialVersionUID})
|
||||
public class ${entity}PageVO implements Serializable {
|
||||
public class ${entity}PageVo implements Serializable {
|
||||
#else
|
||||
public class ${entity}PageVO {
|
||||
public class ${entity}PageVo {
|
||||
#end
|
||||
#if(${entitySerialVersionUID})
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import ${package.Entity}.${entity};
|
||||
import ${superServiceClassPackage};
|
||||
import ${package.Parent}.model.form.${entity}Form;
|
||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
import ${package.Parent}.model.vo.${entity}PageVO;
|
||||
import ${package.Parent}.model.vo.${entity}PageVo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
/**
|
||||
* $!{table.comment} 服务类
|
||||
@@ -20,7 +20,7 @@ public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IPage<${entity}PageVO> listPaged${entity}s(${entity}PageQuery queryParams);
|
||||
IPage<${entity}PageVo> listPaged${entity}s(${entity}PageQuery queryParams);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,8 @@ import org.springframework.stereotype.Service;
|
||||
import com.youlai.common.util.DateUtils;
|
||||
import ${package.Parent}.model.form.${entity}Form;
|
||||
import ${package.Parent}.model.query.${entity}PageQuery;
|
||||
import ${package.Parent}.model.bo.${entity}BO;
|
||||
import ${package.Parent}.model.vo.${entity}PageVO;
|
||||
import ${package.Parent}.model.bo.${entity}Bo;
|
||||
import ${package.Parent}.model.vo.${entity}PageVo;
|
||||
import ${package.Parent}.converter.${entity}Converter;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -39,21 +39,21 @@ public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.m
|
||||
* 获取$!{table.comment}分页列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return {@link IPage<${entity}PageVO>} $!{table.comment}分页列表
|
||||
* @return {@link IPage<${entity}PageVo>} $!{table.comment}分页列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<${entity}PageVO> listPaged${entity}s(${entity}PageQuery queryParams) {
|
||||
public IPage<${entity}PageVo> listPaged${entity}s(${entity}PageQuery queryParams) {
|
||||
|
||||
// 参数构建
|
||||
int pageNum = queryParams.getPageNum();
|
||||
int pageSize = queryParams.getPageSize();
|
||||
Page<${entity}BO> page = new Page<>(pageNum, pageSize);
|
||||
Page<${entity}Bo> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
// 格式化为数据库日期格式,避免日期比较使用格式化函数导致索引失效
|
||||
DateUtils.toDatabaseFormat(queryParams, "startTime", "endTime");
|
||||
|
||||
// 查询数据
|
||||
Page<${entity}BO> boPage = this.baseMapper.listPaged${entity}s(page, queryParams);
|
||||
Page<${entity}Bo> boPage = this.baseMapper.listPaged${entity}s(page, queryParams);
|
||||
|
||||
// 实体转换
|
||||
return ${firstCharLowerCaseEntity}Converter.toPageVo(boPage);
|
||||
|
||||
@@ -12,7 +12,7 @@ import lombok.Setter;
|
||||
#end
|
||||
|
||||
/**
|
||||
* $!{table.comment} VO
|
||||
* $!{table.comment} Vo
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
@@ -26,13 +26,13 @@ import lombok.Setter;
|
||||
#end
|
||||
@Schema( description = "$!{table.comment}视图对象")
|
||||
#if(${superEntityClass})
|
||||
public class ${entity}VO extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
public class ${entity}Vo extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
#elseif(${activeRecord})
|
||||
public class ${entity} extends Model<${entity}> {
|
||||
#elseif(${entitySerialVersionUID})
|
||||
public class ${entity}VO implements Serializable {
|
||||
public class ${entity}Vo implements Serializable {
|
||||
#else
|
||||
public class ${entity}VO {
|
||||
public class ${entity}Vo {
|
||||
#end
|
||||
#if(${entitySerialVersionUID})
|
||||
|
||||
|
||||
Reference in new issue
Block a user