review:【INFRA 基础设施】代码生成的 review
This commit is contained in:
parent
d14aaae641
commit
0c68962a97
|
@ -60,6 +60,7 @@ public class Demo01ContactController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
// TODO @puhui999:要不要 deleteDemo01ContactList?url 也叫 delete-list
|
||||
@DeleteMapping("/delete-batch")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除示例联系人")
|
||||
|
|
|
@ -13,6 +13,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||
|
||||
@Schema(description = "管理后台 - 示例联系人分页 Request VO")
|
||||
@Data
|
||||
// TODO @puhui999:要不要去掉所有 pojo 里的 @EqualsAndHashCode、@ToString,代码生成里的。因为 lombok.config 已经处理了全局了;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class Demo01ContactPageReqVO extends PageParam {
|
||||
|
|
|
@ -43,16 +43,16 @@ public class CodegenProperties {
|
|||
@NotNull(message = "代码生成的 VO 类型不能为空")
|
||||
private Integer voType;
|
||||
|
||||
/**
|
||||
* 是否生成单元测试
|
||||
*/
|
||||
@NotNull(message = "是否生成单元测试不能为空")
|
||||
private Boolean unitTestEnable;
|
||||
|
||||
/**
|
||||
* 是否生成批量删除接口
|
||||
*/
|
||||
@NotNull(message = "是否生成批量删除接口不能为空")
|
||||
private Boolean deleteBatchEnable;
|
||||
|
||||
/**
|
||||
* 是否生成单元测试
|
||||
*/
|
||||
@NotNull(message = "是否生成单元测试不能为空")
|
||||
private Boolean unitTestEnable;
|
||||
|
||||
}
|
||||
|
|
|
@ -135,6 +135,8 @@ public class Demo03StudentNormalServiceImpl implements Demo03StudentNormalServic
|
|||
List<List<Demo03CourseDO>> diffList = diffList(oldList, list, (oldVal, newVal) -> {
|
||||
boolean same = ObjectUtil.equal(oldVal.getId(), newVal.getId());
|
||||
if (same) {
|
||||
// TODO @puhui999:BaseDO 增加一个 clean 方法,里面把 creator、updator、updateTime、updater 都清空?
|
||||
// TODO @puhui999:然后 DO 模式新增、更新,以及主子表,都 clean 下。避免前端直接传递 creator 之类的字段,直接就被更新了。
|
||||
newVal.setId(oldVal.getId()).setUpdater(null).setUpdateTime(null); // 解决更新情况下:updateTime 不更新
|
||||
}
|
||||
return same;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
package cn.iocoder.yudao.module.infra.service.demo.demo03;
|
|
@ -79,6 +79,7 @@ public class ${table.className}DO extends BaseDO {
|
|||
#end
|
||||
|
||||
## 特殊:主子表专属逻辑(非 ERP 模式)
|
||||
## TODO @puhui999:这里空行看看,会不会多了一个哈
|
||||
#if ( $voType == 20 && $subTables && $subTables.size() > 0 && $table.templateType != 11 )
|
||||
#foreach ($subTable in $subTables)
|
||||
#set ($index = $foreach.count - 1)
|
||||
|
|
|
@ -340,6 +340,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
|||
${subClassNameVars.get($index)}Mapper.deleteById(id);
|
||||
}
|
||||
|
||||
## TODO @puhui999:批量删除的时候,要不直接删除,就不“校验存在”;ps:主子表删除的时候,子表的处理,也要处理下哈;
|
||||
#if ($deleteBatchEnable)
|
||||
@Override
|
||||
public void delete${subSimpleClassName}ByIds(List<${subPrimaryColumn.javaType}> ids) {
|
||||
|
|
|
@ -270,8 +270,8 @@ yudao:
|
|||
db-schemas: ${spring.datasource.dynamic.datasource.master.name}
|
||||
front-type: 20 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类
|
||||
vo-type: 10 # VO 的类型,参见 CodegenVOTypeEnum 枚举类
|
||||
delete-batch-enable: true # 是否生成批量删除接口
|
||||
unit-test-enable: false # 是否生成单元测试
|
||||
delete-batch-enable: false # 是否生成批量删除接口
|
||||
tenant: # 多租户相关配置项
|
||||
enable: true
|
||||
ignore-urls:
|
||||
|
|
Loading…
Reference in New Issue