|
@@ -8,7 +8,6 @@ import org.dromara.commodityManagement.domain.bo.DiBuBo;
|
|
|
import org.dromara.commodityManagement.domain.vo.DiBuVo;
|
|
|
import org.dromara.commodityManagement.mapper.DiBuMapper;
|
|
|
import org.dromara.commodityManagement.service.DiBuService;
|
|
|
-import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
@@ -49,7 +48,6 @@ public class DiBuServiceImpl implements DiBuService {
|
|
|
@Override
|
|
|
public int insertDiBu(DiBuBo diBuBo) {
|
|
|
DiBu diBu = MapstructUtils.convert(diBuBo, DiBu.class);
|
|
|
- validEntityBeforeSave(diBu);
|
|
|
return diBuMapper.insert(diBu);
|
|
|
}
|
|
|
|
|
@@ -61,7 +59,6 @@ public class DiBuServiceImpl implements DiBuService {
|
|
|
@Override
|
|
|
public int updateDiBu(DiBuBo diBuBo) {
|
|
|
DiBu diBu = MapstructUtils.convert(diBuBo, DiBu.class);
|
|
|
- validEntityBeforeSave(diBu);
|
|
|
QueryWrapper<DiBu> qw = new QueryWrapper<>();
|
|
|
qw.eq("id", diBu.getId());
|
|
|
return diBuMapper.update(diBu,qw);
|
|
@@ -90,24 +87,4 @@ public class DiBuServiceImpl implements DiBuService {
|
|
|
public List<DiBu> selectDiBuList() {
|
|
|
return diBuMapper.selectList();
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存前校验数据
|
|
|
- * @param entity 底布对象
|
|
|
- */
|
|
|
- private void validEntityBeforeSave(DiBu entity) {
|
|
|
- if (!StringUtils.isNotEmpty(entity.getName())) {
|
|
|
- throw new ServiceException("名称不能为空!");
|
|
|
- } else if (!StringUtils.isNoneBlank(entity.getColor())) {
|
|
|
- throw new ServiceException("颜色不能为空!");
|
|
|
- } else if (!StringUtils.isNoneBlank(entity.getMenfu())) {
|
|
|
- throw new ServiceException("门幅不能为空!");
|
|
|
- } else if (!StringUtils.isNoneBlank(entity.getWeight())) {
|
|
|
- throw new ServiceException("克重不能为空!");
|
|
|
- } else if (!StringUtils.isNoneBlank(entity.getPrice())) {
|
|
|
- throw new ServiceException("价格不能为空!");
|
|
|
- } else if (!StringUtils.isNoneBlank(entity.getUnit())) {
|
|
|
- throw new ServiceException("单位不能为空!");
|
|
|
- }
|
|
|
- }
|
|
|
}
|