package com.steerinfo.dil.service.impl; import com.steerinfo.dil.mapper.RmsPersonnelMapper; import com.steerinfo.dil.model.RmsPersonnel; import com.steerinfo.dil.service.IRmsPersonnelService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * RmsPersonnel服务实现: * @author generator * @version 1.0-SNAPSHORT 2021-10-22 06:01 * 类描述 * 修订历史: * 日期:2021-10-22 * 作者:generator * 参考: * 描述:RmsPersonnel服务实现 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @Service(value = "rmsPersonnelService") public class RmsPersonnelServiceImpl implements IRmsPersonnelService { @Autowired private RmsPersonnelMapper rmsPersonnelMapper; /** * 操作人员信息 * @param mapVal * @return */ @Override public int operationPersonnel(Map mapVal) { // 得到金蝶人员管理主键id Integer EASPersonnelIdValue = (Integer) mapVal.get("EASPersonnelId"); BigDecimal EASPersonnelId = new BigDecimal(EASPersonnelIdValue); // 得到人员工号 String personnelJobNumber = (String) mapVal.get("personnelJobNumber"); // 得到人员姓名 String personnelName = (String) mapVal.get("personnelName"); // 得到数据状态 Integer dataStatus = (Integer) mapVal.get("dataStatus"); RmsPersonnel rmsPersonnel = new RmsPersonnel(); rmsPersonnel.setEasPersonnelId(EASPersonnelId); rmsPersonnel.setPersonnelJobNumber(personnelJobNumber); rmsPersonnel.setPersonnelName(personnelName); BigDecimal deleted = new BigDecimal(0); Map map = new HashMap<>(); map.put("easPersonnelId",EASPersonnelId); map.put("deleted",deleted); int result = 0; List rmsPersonnels = rmsPersonnelMapper.selectByParameters(map); // 新增 if (rmsPersonnels.size() == 0) { BigDecimal personnelId = rmsPersonnelMapper.getPersonnelId(); rmsPersonnel.setPersonnelId(personnelId); rmsPersonnel.setDeleted(deleted); result = rmsPersonnelMapper.insertSelective(rmsPersonnel); } // 修改 if (rmsPersonnels.size() != 0 && dataStatus == 1) { RmsPersonnel rmsPersonnel1 = rmsPersonnels.get(0); rmsPersonnel.setPersonnelId(rmsPersonnel1.getPersonnelId()); result = rmsPersonnelMapper.updateByPrimaryKeySelective(rmsPersonnel); } // 逻辑删除 if (rmsPersonnels.size() != 0 && dataStatus == 2) { RmsPersonnel rmsPersonnel1 = rmsPersonnels.get(0); rmsPersonnel.setPersonnelId(rmsPersonnel1.getPersonnelId()); rmsPersonnel.setDeleted(new BigDecimal(1)); result = rmsPersonnelMapper.updateByPrimaryKeySelective(rmsPersonnel); } return result; } /** * 展示人员信息列表 * @param mapVal * @return */ @Override public List> getPersonnelList(Map mapVal) { return rmsPersonnelMapper.getPersonnelList(mapVal); } }