【同步】BOOT 和 CLOUD 的功能
This commit is contained in:
@@ -65,10 +65,13 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
#end
|
||||
// 插入
|
||||
#if ($voType == 10)
|
||||
## TODO @puhui999:insert 也要加下 clean。万一前端乱传递,哈哈哈。这个就是 do 模式的缺点;(只在 do 模式下);看看主子表,是不是也可能存在,insert 的时候;
|
||||
${table.className}DO ${classNameVar} = BeanUtils.toBean(createReqVO, ${table.className}DO.class);
|
||||
#end
|
||||
${classNameVar}Mapper.insert(${classNameVar});
|
||||
#else
|
||||
${saveReqVOVar}.clean() // 清理掉创建、更新时间等相关属性值
|
||||
${classNameVar}Mapper.insert(${saveReqVOVar});
|
||||
#end
|
||||
|
||||
## 特殊:主子表专属逻辑(非 ERP 模式)
|
||||
#if ( $subTables && $subTables.size() > 0 && $table.templateType != 11 )
|
||||
|
||||
@@ -112,6 +115,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
${table.className}DO updateObj = BeanUtils.toBean(updateReqVO, ${table.className}DO.class);
|
||||
${classNameVar}Mapper.updateById(updateObj);
|
||||
#else
|
||||
${updateReqVOVar}.clean() // 清理掉创建、更新时间等相关属性值
|
||||
${classNameVar}Mapper.updateById(${updateReqVOVar});
|
||||
#end
|
||||
## 特殊:主子表专属逻辑(非 ERP 模式)
|
||||
@@ -171,8 +175,6 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
#end
|
||||
public void delete${simpleClassName}ListByIds(List<${primaryColumn.javaType}> ids) {
|
||||
// 校验存在
|
||||
validate${simpleClassName}Exists(ids);
|
||||
// 删除
|
||||
${classNameVar}Mapper.deleteByIds(ids);
|
||||
## 特殊:主子表专属逻辑
|
||||
@@ -189,12 +191,6 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
#end
|
||||
}
|
||||
|
||||
private void validate${simpleClassName}Exists(List<${primaryColumn.javaType}> ids) {
|
||||
List<${table.className}DO> list = ${classNameVar}Mapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
||||
private void validate${simpleClassName}Exists(${primaryColumn.javaType} id) {
|
||||
@@ -320,6 +316,7 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
}
|
||||
// 插入
|
||||
#end
|
||||
${subClassNameVar}.clean() // 清理掉创建、更新时间等相关属性值
|
||||
${subClassNameVars.get($index)}Mapper.insert(${subClassNameVar});
|
||||
return ${subClassNameVar}.getId();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user