| | |
| | | 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"); |
| | | if(tankWallLockList.size() == 0){//数组为空,做删除操作 |
| | | List<ArdTankWallLock> ardTankWallLockList = ardTankWallLockMapper.selectArdTankWallLockByLockId(id);//查询之前挂接的电子围栏 |
| | | if(ardTankWallLockList.size() == 0){//若没有挂接,不做操作 |
| | | return 1; |
| | | } |
| | | int result = ardTankWallLockMapper.deleteArdTankWallLockByLockId(id); |
| | | return result; |
| | | } |
| | | //List<ArdTankWallLock> tankWallLocks = new ArrayList(); |
| | | List<String> idList = new ArrayList();//存放新增和修改的中间表主键 |
| | | int result = 0; |
| | | for(Map<String,String> map : tankWallLockList){ |
| | | ArdTankWallLock ardTankWallLock = new ArdTankWallLock(); |
| | |
| | | if(ardTankWallLockList.size() != 0){ |
| | | ardTankWallLock.setProcessType(map.get("processType")); |
| | | result = result + ardTankWallLockMapper.updateArdTankWallLockByWallIdAndLockId(ardTankWallLock); |
| | | for(ArdTankWallLock ardTankWallLockOld : ardTankWallLockList){//需要修改的主键 |
| | | idList.add(ardTankWallLockOld.getId()); |
| | | } |
| | | }else{ |
| | | ardTankWallLock.setProcessType(map.get("processType")); |
| | | ardTankWallLock.setId(IdUtils.simpleUUID()); |
| | | result = result + ardTankWallLockMapper.insertArdTankWallLock(ardTankWallLock); |
| | | idList.add(ardTankWallLock.getId());//新增的主键 |
| | | } |
| | | } |
| | | if(!idList.isEmpty()){//判断是否有需要删除的数据主键 |
| | | result = result + ardTankWallLockMapper.deleteArdTankWallLockByLockIdAndOtherIds(id,idList); |
| | | } |
| | | return result; |
| | | } |
| | | |