fix: 重复指令问题

This commit is contained in:
2024-07-31 17:15:30 +08:00
parent fe63ba4c61
commit 04e9fdcbcf

View File

@@ -21,6 +21,7 @@ import org.nl.system.service.coderule.dao.mapper.SysCodeRuleMapper;
import org.nl.system.service.coderule.utils.CodeRuleTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@@ -57,7 +58,8 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
}
@Override
public synchronized String codeDemo(Map form) {
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public String codeDemo(Map form) {
String code = (String) form.get("code");
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();
// 如果flag = 1就执行更新数据库的操作