Authored by gemingdan

update skn加分

... ... @@ -44,7 +44,7 @@ public class ScoreSknRuleMqListener extends AbstractMqListener {
if (scoreSknRule == null || scoreSknRule.getId() == null || scoreSknRule.getSkn() == null) {
return;
}
int result = scoreSknRuleService.insert(scoreSknRule);
int result = scoreSknRuleService.insertOrUpdate(scoreSknRule);
if (result > 0) {
scoreSknRuleLogicService.updateZkScoreSkn();
}
... ...
... ... @@ -20,12 +20,16 @@ public class ScoreSknRuleService {
return scoreSknRuleMapper.deleteByPrimaryKey(id);
}
public int insert(ScoreSknRule record){
if (scoreSknRuleMapper.selectBySkn(record.getSkn()) != null) {
return 1;
}
public int insertOrUpdate(ScoreSknRule record){
ScoreSknRule scoreSknRule = scoreSknRuleMapper.selectBySkn(record.getSkn());
if (scoreSknRule == null) {
return scoreSknRuleMapper.insert(record);
}
scoreSknRule.setUpdateTime(record.getUpdateTime());
scoreSknRuleMapper.updateByPrimaryKey(scoreSknRule);
return 0;
}
public ScoreSknRule selectById(Integer id){
return scoreSknRuleMapper.selectByPrimaryKey(id);
... ...