public void save(FiDeliverycost entity) { if (entity.getId() == null) { if (entity.getFlightMainNo() != null) { List<FiDeliverycost> list = find( "from FiDeliverycost fi where fi.flightMainNo=? and fi.customerId=? ", entity.getFlightMainNo(), entity.getCustomerId()); if (list.size() > 0) { throw new ServiceException("此黄单号已录入,不能重复录入"); } } else { throw new ServiceException("录入的黄单号不能为空"); } } fiDeliverycostDao.save(entity); }