CarsServiceImpl.java
2.42 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
package com.bsth.service.schedule.impl;
import com.bsth.entity.Cars;
import com.bsth.service.schedule.CarsService;
import com.bsth.service.schedule.ScheduleException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Created by xu on 16/12/8.
*/
@Service(value = "carsServiceImpl_sc")
public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements CarsService {
@Override
@Transactional
public void validate_nbbh(Cars cars) throws ScheduleException {
// 查询条件
Map<String, Object> param = new HashMap<>();
if (cars.getId() != null) {
param.put("id_ne", cars.getId());
}
param.put("insideCode_eq", cars.getInsideCode());
if (!CollectionUtils.isEmpty(list(param))) {
throw new ScheduleException("车辆内部编号/自编号重复");
}
}
@Override
@Transactional
public void validate_clbh(Cars cars) throws ScheduleException {
// 查询条件
Map<String, Object> param = new HashMap<>();
if (cars.getId() != null) {
param.put("id_ne", cars.getId());
}
param.put("carCode_eq", cars.getCarCode());
if (!CollectionUtils.isEmpty(list(param))) {
throw new ScheduleException("车辆编号重复");
}
}
@Override
@Transactional
public void validate_cph(Cars cars) throws ScheduleException {
// 查询条件
Map<String, Object> param = new HashMap<>();
if (cars.getId() != null) {
param.put("id_ne", cars.getId());
}
param.put("carPlate_eq", cars.getCarPlate());
if (!CollectionUtils.isEmpty(list(param))) {
throw new ScheduleException("车牌号重复");
}
}
@Override
@Transactional
public void validate_sbbh(Cars cars) throws ScheduleException {
// 查询条件
Map<String, Object> param = new HashMap<>();
if (cars.getId() != null) {
param.put("id_ne", cars.getId());
}
param.put("equipmentCode_eq", cars.getEquipmentCode());
if (!CollectionUtils.isEmpty(list(param))) {
throw new ScheduleException("设备编号重复");
}
}
}