优化:基础数据后端服务接口增加数据库事务回滚机制

master
Guo XIn 1 year ago
parent 61584709e3
commit 9aeb184fb4
  1. 3
      shandan-basedata/src/main/java/com/keyware/shandan/dynacmicform/core/basic/services/DynamicFormService.java

@ -12,6 +12,7 @@ import com.keyware.shandan.dynacmicform.core.db.parser.TableInfoParser;
import com.keyware.shandan.dynacmicform.core.db.pojo.Table;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -37,6 +38,7 @@ public class DynamicFormService {
* @return boolean
* @throws Exception 异常
*/
@Transactional(rollbackFor = Exception.class)
public boolean saveForm(FormInfoPo form) throws Exception {
FormInfoPo oldForm = formInfoService.getById(form.getId());
Table table = TableInfoParser.parseTable(form);
@ -70,6 +72,7 @@ public class DynamicFormService {
* @param id
* @return
*/
@Transactional(rollbackFor = Exception.class)
public boolean delete(Integer id) {
FormInfoPo form = formInfoService.getById(id);
boolean ok = formInfoService.removeById(id);