init
parent
2b034872ad
commit
320388dd0d
|
|
@ -13,6 +13,8 @@ import org.qinan.safetyeval.domain.query.PageResult;
|
|||
import org.qinan.safetyeval.domain.service.OrgEquipmentDomainService;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.domainobject.OrgBusinessScopeDeviceRefDO;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.queryservice.OrgBusinessScopeDeviceRefQueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -29,6 +31,10 @@ public class OrgEquipmentExecutor implements OrgEquipmentApi {
|
|||
@Autowired(required = false)
|
||||
private OrgEquipmentDomainService orgEquipmentDomainService;
|
||||
|
||||
@Lazy
|
||||
@Autowired(required = false)
|
||||
private OrgBusinessScopeDeviceRefQueryService orgBusinessScopeDeviceRefQueryService;
|
||||
|
||||
@Override
|
||||
public SingleResponse<OrgEquipmentCO> add(OrgEquipmentAddCmd cmd) {
|
||||
OrgEquipmentEntity entity = new OrgEquipmentEntity();
|
||||
|
|
@ -56,7 +62,14 @@ public class OrgEquipmentExecutor implements OrgEquipmentApi {
|
|||
@Override
|
||||
public SingleResponse<OrgEquipmentCO> get(Long id) {
|
||||
OrgEquipmentEntity entity = orgEquipmentDomainService.get(id);
|
||||
return SingleResponse.success(toCO(entity));
|
||||
OrgEquipmentCO co = toCO(entity);
|
||||
if (co != null && co.getDeviceTypeCode() != null) {
|
||||
OrgBusinessScopeDeviceRefDO refDO = orgBusinessScopeDeviceRefQueryService.getByDeviceTypeCode(co.getDeviceTypeCode());
|
||||
if (refDO != null) {
|
||||
co.setDeviceTypeName(refDO.getDeviceTypeName());
|
||||
}
|
||||
}
|
||||
return SingleResponse.success(co);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@ public interface OrgBusinessScopeDeviceRefQueryService {
|
|||
*/
|
||||
OrgBusinessScopeDeviceRefDO getById(Long id);
|
||||
|
||||
/**
|
||||
* 根据设备类型编码查找
|
||||
*
|
||||
* @param deviceTypeCode 设备类型编码
|
||||
* @return
|
||||
*/
|
||||
OrgBusinessScopeDeviceRefDO getByDeviceTypeCode(String deviceTypeCode);
|
||||
|
||||
/**
|
||||
* 分页查询安全评价机构业务范围与设备参照
|
||||
*
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ public class OrgBusinessScopeDeviceRefQueryServiceImpl implements OrgBusinessSco
|
|||
return orgBusinessScopeDeviceRefRepository.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgBusinessScopeDeviceRefDO getByDeviceTypeCode(String deviceTypeCode) {
|
||||
return orgBusinessScopeDeviceRefRepository.getByDeviceTypeCode(deviceTypeCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<OrgBusinessScopeDeviceRefCo> listOrgBusinessScopeDeviceRefPage(OrgBusinessScopeDeviceRefPageQry orgBusinessScopeDeviceRefPageQry) {
|
||||
IPage<OrgBusinessScopeDeviceRefDO> orgBusinessScopeDeviceRefDoPage = orgBusinessScopeDeviceRefRepository.listOrgBusinessScopeDeviceRefPage(PageHelper.queryToPage(orgBusinessScopeDeviceRefPageQry), orgBusinessScopeDeviceRefPageQry);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@ public interface OrgBusinessScopeDeviceRefRepository extends BaseRepository<OrgB
|
|||
*/
|
||||
OrgBusinessScopeDeviceRefDO getById(Long id);
|
||||
|
||||
/**
|
||||
* 根据设备类型编码查找
|
||||
*
|
||||
* @param deviceTypeCode 设备类型编码
|
||||
* @return
|
||||
*/
|
||||
OrgBusinessScopeDeviceRefDO getByDeviceTypeCode(String deviceTypeCode);
|
||||
|
||||
/**
|
||||
* 分页查找安全评价机构业务范围与设备参照对象
|
||||
*
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.jjb.saas.framework.enums.enums.BooleanEnum;
|
|||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.qinan.safetyeval.client.ref.request.OrgBusinessScopeDeviceRefPageQry;
|
||||
import org.qinan.safetyeval.domain.constant.BooleanQAEnum;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.domainobject.OrgBusinessScopeDeviceRefDO;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.mapper.OrgBusinessScopeDeviceRefMapper;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.repository.OrgBusinessScopeDeviceRefRepository;
|
||||
|
|
@ -31,6 +32,17 @@ public class OrgBusinessScopeDeviceRefRepositoryImpl extends BaseRepositoryImpl<
|
|||
return super.lambdaQuery().eq(OrgBusinessScopeDeviceRefDO::getId, id).eq(OrgBusinessScopeDeviceRefDO::getDeleteEnum, BooleanEnum.FALSE.getValue()).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgBusinessScopeDeviceRefDO getByDeviceTypeCode(String deviceTypeCode) {
|
||||
return super.lambdaQuery()
|
||||
.select(OrgBusinessScopeDeviceRefDO::getDeviceTypeCode, OrgBusinessScopeDeviceRefDO::getId
|
||||
, OrgBusinessScopeDeviceRefDO::getIndustryCode,OrgBusinessScopeDeviceRefDO::getDeviceTypeName)
|
||||
.eq(OrgBusinessScopeDeviceRefDO::getDeviceTypeCode, deviceTypeCode)
|
||||
.eq(OrgBusinessScopeDeviceRefDO::getDeleteEnum, BooleanQAEnum.FALSE.getValue())
|
||||
.last("LIMIT 1")
|
||||
.one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<OrgBusinessScopeDeviceRefDO> listOrgBusinessScopeDeviceRefPage(IPage iPage, OrgBusinessScopeDeviceRefPageQry orgBusinessScopeDeviceRefPageQry) {
|
||||
QueryWrapper<OrgBusinessScopeDeviceRefDO> orgBusinessScopeDeviceRefDoQueryWrapper = new QueryWrapper<>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue