use of com.itrus.portal.db.ServiceHallExample in project portal by ixinportal.
the class ServiceProviderController method delete.
// 删除服务商
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
@ResponseBody
public String delete(@PathVariable("id") Long id) {
ServiceProvider serviceProvider = ServiceProviderService.selectByPrimaryKey(id);
if (null == serviceProvider) {
return "未找到要删除的服务商";
} else {
try {
ServiceProviderService.deleteByPrimaryKey(id);
List<ServiceHall> serviceHalls = serviceHallService.getServiceHalls(id);
if (null != serviceHalls && !serviceHalls.isEmpty()) {
List<Long> list = new ArrayList<>();
for (ServiceHall serviceHall : serviceHalls) {
list.add(serviceHall.getId());
}
ServiceHallExample example = new ServiceHallExample();
ServiceHallExample.Criteria criteria = example.or();
criteria.andServiceProviderIn(list);
serviceHallService.deleteByExample(example);
}
} catch (Exception e) {
return "要删除的服务商:" + serviceProvider.getName() + "存在关联,无法删除";
}
}
return null;
}
use of com.itrus.portal.db.ServiceHallExample in project portal by ixinportal.
the class ServiceHallServiceImpl method getServiceHalls.
/**
* 根据服务商ID,获取服务商的网点信息,根据优先级排序
* @param id
* @return
* @throws Exception
*/
public List<ServiceHall> getServiceHalls(Long id) throws Exception {
List<ServiceHall> serviceHalls = new ArrayList<>();
ServiceHallExample example = new ServiceHallExample();
ServiceHallExample.Criteria criteria = example.or();
criteria.andServiceProviderEqualTo(id);
example.setOrderByClause("priority ASC");
serviceHalls = selectByExample(example);
return serviceHalls;
}
Aggregations