|
|
@ -1,5 +1,8 @@
|
|
|
|
package org.dromara.mes.service.impl;
|
|
|
|
package org.dromara.mes.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
@ -7,7 +10,6 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.dromara.mes.domain.bo.BaseDeviceCategoryBo;
|
|
|
|
import org.dromara.mes.domain.bo.BaseDeviceCategoryBo;
|
|
|
@ -116,6 +118,33 @@ public class BaseDeviceCategoryServiceImpl implements IBaseDeviceCategoryService
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void validEntityBeforeSave(BaseDeviceCategory entity){
|
|
|
|
private void validEntityBeforeSave(BaseDeviceCategory entity){
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//编号校验
|
|
|
|
|
|
|
|
if (StringUtils.isNotNull(entity.getDeviceCategoryCode())){
|
|
|
|
|
|
|
|
BaseDeviceCategoryBo query = new BaseDeviceCategoryBo();
|
|
|
|
|
|
|
|
query.setDeviceCategoryCode(entity.getDeviceCategoryCode());
|
|
|
|
|
|
|
|
MPJLambdaWrapper<BaseDeviceCategory> lqw = buildQueryWrapper(query);
|
|
|
|
|
|
|
|
BaseDeviceCategory detail = baseMapper.selectOne(lqw);
|
|
|
|
|
|
|
|
if ( !ObjectUtils.isEmpty(detail)
|
|
|
|
|
|
|
|
&& !detail.getDeviceCategoryId().equals(entity.getDeviceCategoryId())){
|
|
|
|
|
|
|
|
throw new ServiceException("编号已存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//名称校验
|
|
|
|
|
|
|
|
if (StringUtils.isNotNull(entity.getDeviceCategoryName())){
|
|
|
|
|
|
|
|
BaseDeviceCategoryBo query = new BaseDeviceCategoryBo();
|
|
|
|
|
|
|
|
query.setDeviceCategoryName(entity.getDeviceCategoryName());
|
|
|
|
|
|
|
|
MPJLambdaWrapper<BaseDeviceCategory> lqw = JoinWrappers.lambda(BaseDeviceCategory.class)
|
|
|
|
|
|
|
|
.selectAll(BaseDeviceCategory.class)
|
|
|
|
|
|
|
|
.eq(StringUtils.isNotBlank(query.getDeviceCategoryName()),BaseDeviceCategory::getDeviceCategoryName, query.getDeviceCategoryName());
|
|
|
|
|
|
|
|
BaseDeviceCategory detail = baseMapper.selectOne(lqw);
|
|
|
|
|
|
|
|
if ( !ObjectUtils.isEmpty(detail)
|
|
|
|
|
|
|
|
&& !detail.getDeviceCategoryId().equals(entity.getDeviceCategoryId())){
|
|
|
|
|
|
|
|
throw new ServiceException("名称已存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|