Commit f7110f27 by 高晓磊

删除场站时,判断是否有场站用户,如果有的话不允许删除

parent 76615073
......@@ -5,10 +5,13 @@ import com.beecode.bap.attachment.common.Page;
import com.beecode.bcp.type.KClass;
import com.beecode.bcp.type.KObject;
import com.beecode.bcp.type.json.JSONObjectUtils;
import com.beecode.inz.basis.service.WarehouseUserService;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.inz.common.service.ContractService;
import com.beecode.nlib.utils.StringUtils;
import com.xyst.dinas.biz.constant.StationConstant;
import com.xyst.dinas.biz.service.StationService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,6 +32,12 @@ public class StationController {
@Autowired
private StationService stationService;
@Autowired
private WarehouseUserService warehouseUserService;
@Autowired
private ContractService contractService;
@RequestMapping(value = "list/page", method = RequestMethod.GET)
public ResponseObj getListPage(
......@@ -131,6 +140,12 @@ public class StationController {
if(id == null){
return ResponseObj.error(400,"'id' must be not null!");
}
//查询是否有未删除的场站人员
List<KObject> allByStationId = warehouseUserService.getAllByStationId(id);
if(CollectionUtils.isNotEmpty(allByStationId)){
return ResponseObj.error(500,"有关联的场站人员,不许删除");
}
//查询是否有根据合同关联的场站
stationService.deleteById(id);
return ResponseObj.success("删除成功");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment