Browse Source

fix: 重复指令问题

master
lishuai 4 months ago
parent
commit
04e9fdcbcf
  1. 4
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/coderule/impl/SysCodeRuleServiceImpl.java

4
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/coderule/impl/SysCodeRuleServiceImpl.java

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

Loading…
Cancel
Save