zhangnaisong
2024-07-06 06842b9c367083c3bf77b8b54a1e1a32b68a2e5e
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdTankWallLockServiceImpl.java
@@ -6,11 +6,15 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Map;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.sy.mapper.ArdTankWallLockMapper;
import com.ruoyi.sy.domain.ArdTankWallLock;
import com.ruoyi.sy.service.IArdTankWallLockService;
import javax.annotation.Resource;
/**
 * 电子围栏电磁锁Service业务层处理
@@ -20,7 +24,7 @@
 */
@Service
public class ArdTankWallLockServiceImpl implements IArdTankWallLockService {
    @Autowired
    @Resource
    private ArdTankWallLockMapper ardTankWallLockMapper;
    /**
@@ -89,4 +93,33 @@
    public int deleteArdTankWallLockByProcessType(String processType) {
        return ardTankWallLockMapper.deleteArdTankWallLockByProcessType(processType);
    }
    @Override
    public int insertWallLock(Map<String, Object> para) {
        String id = (String) para.get("id");//锁主键
        List<Map<String,String>> tankWallLockList = (List<Map<String, String>>) para.get("tankWallLockList");
        //List<ArdTankWallLock> tankWallLocks = new ArrayList();
        int result = 0;
        for(Map<String,String> map : tankWallLockList){
            ArdTankWallLock ardTankWallLock = new ArdTankWallLock();
            ardTankWallLock.setWallId(map.get("wallId"));
            ardTankWallLock.setLockId(id);
            List<ArdTankWallLock> ardTankWallLockList = ardTankWallLockMapper.selectArdTankWallLockList(ardTankWallLock);
            if(ardTankWallLockList.size() != 0){
                ardTankWallLock.setProcessType(map.get("processType"));
                result = result + ardTankWallLockMapper.updateArdTankWallLockByWallIdAndLockId(ardTankWallLock);
            }else{
                ardTankWallLock.setProcessType(map.get("processType"));
                ardTankWallLock.setId(IdUtils.simpleUUID());
                result = result + ardTankWallLockMapper.insertArdTankWallLock(ardTankWallLock);
            }
        }
        return result;
    }
    @Override
    public int deleteArdTankWallLockByLockId(String id) {
        int result = ardTankWallLockMapper.deleteArdTankWallLockByLockId(id);
        return result;
    }
}