返回id的新增方法

This commit is contained in:
wenc000 2020-04-27 09:40:34 +08:00
parent 3e47f1acc3
commit 6cacb602b8
2 changed files with 44 additions and 1 deletions

View File

@ -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}
*

View File

@ -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<String, Object> 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