|
@@ -0,0 +1,57 @@
|
|
|
|
+package cn.com.ctop.okr.service.impl;
|
|
|
|
+
|
|
|
|
+import cn.com.ctop.okr.entity.KrAlignInfo;
|
|
|
|
+import cn.com.ctop.okr.mapper.KrAlignInfoMapper;
|
|
|
|
+import cn.com.ctop.okr.service.IKrAlignInfoService;
|
|
|
|
+import cn.com.ctop.okr.utils.ResultMapUtils;
|
|
|
|
+import cn.com.ctop.okr.utils.StatusCode;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class KrAlignInfoServiceImpl extends ServiceImpl<KrAlignInfoMapper, KrAlignInfo> implements IKrAlignInfoService {
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> addAlign(Long originId, Long alignId) {
|
|
|
|
+ Map<String,Object>result = new HashMap<>();
|
|
|
|
+ QueryWrapper<KrAlignInfo>queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("origin_kr",originId);
|
|
|
|
+ queryWrapper.eq("align_kr",alignId);
|
|
|
|
+ queryWrapper.last("limit 1");
|
|
|
|
+ KrAlignInfo alignInfo = this.getOne(queryWrapper);
|
|
|
|
+ if(null!=alignInfo){
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ alignInfo = new KrAlignInfo();
|
|
|
|
+ alignInfo.setAlignKr(alignId);
|
|
|
|
+ alignInfo.setOriginKr(originId);
|
|
|
|
+ alignInfo.setStatus(1);
|
|
|
|
+ alignInfo.setCreateTime(new Date());
|
|
|
|
+ alignInfo.setUpdateTime(new Date());
|
|
|
|
+ this.saveOrUpdate(alignInfo);
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> deleteAlign(Long originId, Long alignId) {
|
|
|
|
+ Map<String,Object>result = new HashMap<>();
|
|
|
|
+ QueryWrapper<KrAlignInfo>queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("origin_kr",originId);
|
|
|
|
+ queryWrapper.eq("align_kr",alignId);
|
|
|
|
+ queryWrapper.last("limit 1");
|
|
|
|
+ KrAlignInfo alignInfo = this.getOne(queryWrapper);
|
|
|
|
+ if(null==alignInfo){
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ this.removeById(alignInfo.getId());
|
|
|
|
+ ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+}
|