ParkingLotGroupRelDaoImpl.java
3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.zteits.park.dao.impl;
import com.zteits.clouds.api.dto.park.param.parkgroup.ParkGroupParkDTO;
import com.zteits.clouds.api.dto.park.param.parkgroup.SaveGroupRelReq;
import com.zteits.park.dao.ParkingLotGroupRelDao;
import com.zteits.park.domain.ParkingLotGroup;
import com.zteits.park.domain.ParkingLotGroupExample;
import com.zteits.park.domain.ParkingLotGroupRel;
import com.zteits.park.domain.ParkingLotGroupRelExample;
import com.zteits.park.mapper.ParkingLotGroupMapper;
import com.zteits.park.mapper.ParkingLotGroupRelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
/**
* Copyright: Copyright (c) 2017 zteits
*
* @ClassName: ParkingLotGroupRelDaoImpl.java
* @Description:
* @version: v1.0.0
* @author: wangfs
* @date: 2021-04-20 14:53
* Modification History:
* Date Author Version Description
* ---------------------------------------------------------*
* 2021-04-20 wangfs v1.0.0 创建
*/
@Component
public class ParkingLotGroupRelDaoImpl implements ParkingLotGroupRelDao {
@Autowired
private ParkingLotGroupRelMapper parkingLotGroupRelMapper;
@Autowired
private ParkingLotGroupMapper parkingLotGroupMapper;
@Override
public List<ParkingLotGroupRel> queryParkingLotGroupRelByGroupCodeId(String plGroupNo) {
ParkingLotGroupRelExample example = new ParkingLotGroupRelExample();
example.createCriteria().andPlGroupNoEqualTo(plGroupNo).andDataStatusEqualTo(1);
return parkingLotGroupRelMapper.selectByExample(example);
}
@Override
public Boolean saveGroupRelReq(SaveGroupRelReq req) {
int insertCount =0;
ParkingLotGroupRelExample example = new ParkingLotGroupRelExample();
example.createCriteria().andPlGroupNoEqualTo(req.getPlGroupNo());
parkingLotGroupRelMapper.deleteByExample(example);
if(!CollectionUtils.isEmpty(req.getParkGroupParkList())){
for(ParkGroupParkDTO parkGroupParkDTO :req.getParkGroupParkList()){
ParkingLotGroupRel record = new ParkingLotGroupRel();
record.setPlGroupNo(req.getPlGroupNo());
record.setPlNo(parkGroupParkDTO.getPlNo());
record.setPlName(parkGroupParkDTO.getPlName());
record.setDataStatus(1);
record.setCreateEmpid("sys");
record.setCreateDate(new Date());
insertCount = parkingLotGroupRelMapper.insert(record);
}
ParkingLotGroup record = new ParkingLotGroup();
record.setParkNum(req.getParkGroupParkList().size());
ParkingLotGroupExample exampleTwo = new ParkingLotGroupExample();
exampleTwo.createCriteria().andPlGroupNoEqualTo(req.getPlGroupNo());
parkingLotGroupMapper.updateByExampleSelective(record,exampleTwo);
}
return insertCount >0;
}
}