diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/IService.ftl b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/IService.ftl index 926d7ff..c9a536c 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/IService.ftl +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/IService.ftl @@ -41,6 +41,25 @@ public interface I${firstUpperTableName}Service { */ SuccessResult save${firstUpperTableName}ByToken(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception; + /** + * 新增${tableExplain} + * + * @param ${firstLowerTableName}VO + * @return ${firstLowerTableName}Id + * @throws Exception + */ + String save${firstUpperTableName}ReturnId(${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception; + + /** + * 新增${tableExplain}(APP) + * + * @param token + * @param ${firstLowerTableName}VO + * @return ${firstLowerTableName}Id + * @throws Exception + */ + String save${firstUpperTableName}ByTokenReturnId(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception; + /** * 删除${tableExplain} * diff --git a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/ServiceImpl.ftl b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/ServiceImpl.ftl index d19ca4b..73bb3b4 100644 --- a/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/ServiceImpl.ftl +++ b/cloud-common-plugin-dynamic/src/main/resources/templates/codetemplate/default/service/ServiceImpl.ftl @@ -46,6 +46,16 @@ public class ${firstUpperTableName}ServiceImpl extends BaseService implements I$ return new SuccessResult(); } + @Override + public String save${firstUpperTableName}(${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception { + return save${firstUpperTableName}InfoReturnId(null, ${firstLowerTableName}VO); + } + + @Override + public String save${firstUpperTableName}ByToken(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception { + return save${firstUpperTableName}InfoReturnId(token, ${firstLowerTableName}VO); + } + /** * 新增${tableExplain} * @@ -54,14 +64,28 @@ public class ${firstUpperTableName}ServiceImpl extends BaseService implements I$ * @throws Exception */ private void save${firstUpperTableName}Info(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception { + save${firstUpperTableName}InfoReturnId(token, ${firstUpperTableName}VO ${firstLowerTableName}VO); + } + + /** + * 新增${tableExplain} + * + * @param token + * @param ${firstLowerTableName}VO + * @return ${firstLowerTableName}Id + * @throws Exception + */ + private String save${firstUpperTableName}InfoReturnId(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception { + String ${firstLowerTableName}Id = UUIDUtil.getUUID(); Map params = HashMapUtil.beanToMap(${firstLowerTableName}VO); - params.put("${firstLowerTableName}Id", UUIDUtil.getUUID()); + params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id); if (token != null) { setSaveInfo(token, params); } else { setSaveInfo(params); } ${firstLowerTableName}Dao.save${firstUpperTableName}(params); + return ${firstLowerTableName}Id; } @Override