|
@@ -130,6 +130,15 @@ public class TdBuildingTypeController extends BaseController {
|
130
|
130
|
public ResponseBean tdBuildingTypeAdd(@RequestBody TdBuildingType tdBuildingType, HttpServletRequest request){
|
131
|
131
|
ResponseBean responseBean = new ResponseBean();
|
132
|
132
|
try {
|
|
133
|
+ QueryWrapper<TdBuildingType> queryWrapper = new QueryWrapper<>();
|
|
134
|
+ queryWrapper.eq("building_type_name", tdBuildingType.getBuildingTypeName());
|
|
135
|
+ queryWrapper.eq("status", 1);
|
|
136
|
+ queryWrapper.eq("org_id", getOrgId(request));
|
|
137
|
+ Integer count = iTdBuildingTypeService.count(queryWrapper);
|
|
138
|
+ if (count != null && count > 0) {
|
|
139
|
+ responseBean.addError("已存在此类型");
|
|
140
|
+ return responseBean;
|
|
141
|
+ }
|
133
|
142
|
tdBuildingType.setOrgId(getOrgId(request));
|
134
|
143
|
if (iTdBuildingTypeService.save(tdBuildingType)){
|
135
|
144
|
responseBean.addSuccess(tdBuildingType);
|
|
@@ -186,6 +195,16 @@ public class TdBuildingTypeController extends BaseController {
|
186
|
195
|
ResponseBean responseBean = new ResponseBean();
|
187
|
196
|
try {
|
188
|
197
|
|
|
198
|
+ QueryWrapper<TdBuildingType> queryWrapper = new QueryWrapper<>();
|
|
199
|
+ queryWrapper.eq("building_type_name", tdBuildingType.getBuildingTypeName());
|
|
200
|
+ queryWrapper.eq("status", 1);
|
|
201
|
+ queryWrapper.eq("org_id", getOrgId(request));
|
|
202
|
+ TdBuildingType buildingType = iTdBuildingTypeService.getOne(queryWrapper);
|
|
203
|
+ if (buildingType != null && buildingType.getBuildingTypeId().intValue() != id.intValue()) {
|
|
204
|
+ responseBean.addError("已存在此类型");
|
|
205
|
+ return responseBean;
|
|
206
|
+ }
|
|
207
|
+
|
189
|
208
|
// 如果是删除,状态为 -1
|
190
|
209
|
if ( null != tdBuildingType.getStatus() && -1 == tdBuildingType.getStatus().intValue()) {
|
191
|
210
|
List<TaBuilding> taBuildings = taBuildingMapper.selectBuildingByBuildingTypeId(tdBuildingType.getBuildingTypeId());
|