|
|
@ -1,9 +1,12 @@ |
|
|
|
package com.win.module.wms.service.enterprise; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseCreateReqVO; |
|
|
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseExportReqVO; |
|
|
|
import com.win.module.wms.controller.enterprise.vo.EnterprisePageReqVO; |
|
|
|
import com.win.module.wms.controller.enterprise.vo.EnterpriseUpdateReqVO; |
|
|
|
import com.win.module.wms.dal.dataobject.bom.BomDO; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
@ -35,6 +38,8 @@ public class EnterpriseServiceImpl implements EnterpriseService { |
|
|
|
public Long createEnterprise(EnterpriseCreateReqVO createReqVO) { |
|
|
|
// 插入
|
|
|
|
EnterpriseDO enterprise = EnterpriseConvert.INSTANCE.convert(createReqVO); |
|
|
|
EnterpriseDO enterpriseDO = existEnterprise(enterprise.getCode()); |
|
|
|
existEnterprise(enterpriseDO); |
|
|
|
enterpriseMapper.insert(enterprise); |
|
|
|
// 返回
|
|
|
|
return enterprise.getId(); |
|
|
@ -57,6 +62,21 @@ public class EnterpriseServiceImpl implements EnterpriseService { |
|
|
|
enterpriseMapper.deleteById(id); |
|
|
|
} |
|
|
|
|
|
|
|
public void existEnterprise(EnterpriseDO enterpriseDO){ |
|
|
|
if(enterpriseDO!=null){ |
|
|
|
throw exception(ENTERPRISE_EXISTS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public EnterpriseDO existEnterprise(String code){ |
|
|
|
QueryWrapper<EnterpriseDO> queryWrapper = new QueryWrapper(); |
|
|
|
queryWrapper.eq("code",code); |
|
|
|
EnterpriseDO enterpriseDO = enterpriseMapper.selectOne(queryWrapper); |
|
|
|
return enterpriseDO; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void validateEnterpriseExists(Long id) { |
|
|
|
if (enterpriseMapper.selectById(id) == null) { |
|
|
|
throw exception(ENTERPRISE_NOT_EXISTS); |
|
|
@ -83,4 +103,9 @@ public class EnterpriseServiceImpl implements EnterpriseService { |
|
|
|
return enterpriseMapper.selectList(exportReqVO); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageResult<EnterpriseDO> getEnterpriseSenior(CustomConditions conditions){ |
|
|
|
return enterpriseMapper.selectSenior(conditions); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|