|
@@ -1,11 +1,20 @@
|
|
|
package com.hssx.pcbms.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.hssx.pcbms.entity.PersonScore;
|
|
|
+import com.hssx.pcbms.entity.Score;
|
|
|
+import com.hssx.pcbms.entity.ScoreSetting;
|
|
|
import com.hssx.pcbms.mapper.PersonScoreMapper;
|
|
|
+import com.hssx.pcbms.mapper.ScoreMapper;
|
|
|
+import com.hssx.pcbms.mapper.ScoreSettingMapper;
|
|
|
import com.hssx.pcbms.service.PersonScoreService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.hssx.pcbms.util.HttpRespMsg;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 服务实现类
|
|
@@ -16,5 +25,33 @@ import org.springframework.stereotype.Service;
|
|
|
*/
|
|
|
@Service
|
|
|
public class PersonScoreServiceImpl extends ServiceImpl<PersonScoreMapper, PersonScore> implements PersonScoreService {
|
|
|
+ @Resource
|
|
|
+ private PersonScoreMapper personScoreMapper;
|
|
|
+ @Resource
|
|
|
+ private ScoreSettingMapper scoreSettingMapper;
|
|
|
+ @Resource
|
|
|
+ private ScoreMapper scoreMapper;
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg addOrUpdate(PersonScore personScore) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ if (personScore.getId() == null) {
|
|
|
+ //添加操作
|
|
|
+ personScoreMapper.insert(personScore);
|
|
|
+ }else{
|
|
|
+ Integer personScoreInit = 0;
|
|
|
+ personScoreMapper.updateById(personScore);
|
|
|
+ Score score = new Score();
|
|
|
+ score.setScoreId(personScore.getScoreId());
|
|
|
+ score.setPersonalScore(personScoreInit+personScore.getCan()+personScore.getDiligence()+personScore.getVirtue()+personScore.getPerformance());
|
|
|
+ scoreMapper.update(score,new QueryWrapper<Score>().eq("score_id",personScore.getScoreId()));
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg fiveList() {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ msg.data = scoreSettingMapper.selectList(new QueryWrapper<>());
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|