v0.0.1-final^2^2
luotaiqian 2026-07-17 16:10:17 +08:00
parent 2b034872ad
commit 320388dd0d
5 changed files with 47 additions and 1 deletions

View File

@ -13,6 +13,8 @@ import org.qinan.safetyeval.domain.query.PageResult;
import org.qinan.safetyeval.domain.service.OrgEquipmentDomainService; import org.qinan.safetyeval.domain.service.OrgEquipmentDomainService;
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter; import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter; 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.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,6 +31,10 @@ public class OrgEquipmentExecutor implements OrgEquipmentApi {
@Autowired(required = false) @Autowired(required = false)
private OrgEquipmentDomainService orgEquipmentDomainService; private OrgEquipmentDomainService orgEquipmentDomainService;
@Lazy
@Autowired(required = false)
private OrgBusinessScopeDeviceRefQueryService orgBusinessScopeDeviceRefQueryService;
@Override @Override
public SingleResponse<OrgEquipmentCO> add(OrgEquipmentAddCmd cmd) { public SingleResponse<OrgEquipmentCO> add(OrgEquipmentAddCmd cmd) {
OrgEquipmentEntity entity = new OrgEquipmentEntity(); OrgEquipmentEntity entity = new OrgEquipmentEntity();
@ -56,7 +62,14 @@ public class OrgEquipmentExecutor implements OrgEquipmentApi {
@Override @Override
public SingleResponse<OrgEquipmentCO> get(Long id) { public SingleResponse<OrgEquipmentCO> get(Long id) {
OrgEquipmentEntity entity = orgEquipmentDomainService.get(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 @Override

View File

@ -21,6 +21,14 @@ public interface OrgBusinessScopeDeviceRefQueryService {
*/ */
OrgBusinessScopeDeviceRefDO getById(Long id); OrgBusinessScopeDeviceRefDO getById(Long id);
/**
*
*
* @param deviceTypeCode
* @return
*/
OrgBusinessScopeDeviceRefDO getByDeviceTypeCode(String deviceTypeCode);
/** /**
* *
* *

View File

@ -32,6 +32,11 @@ public class OrgBusinessScopeDeviceRefQueryServiceImpl implements OrgBusinessSco
return orgBusinessScopeDeviceRefRepository.getById(id); return orgBusinessScopeDeviceRefRepository.getById(id);
} }
@Override
public OrgBusinessScopeDeviceRefDO getByDeviceTypeCode(String deviceTypeCode) {
return orgBusinessScopeDeviceRefRepository.getByDeviceTypeCode(deviceTypeCode);
}
@Override @Override
public PageResponse<OrgBusinessScopeDeviceRefCo> listOrgBusinessScopeDeviceRefPage(OrgBusinessScopeDeviceRefPageQry orgBusinessScopeDeviceRefPageQry) { public PageResponse<OrgBusinessScopeDeviceRefCo> listOrgBusinessScopeDeviceRefPage(OrgBusinessScopeDeviceRefPageQry orgBusinessScopeDeviceRefPageQry) {
IPage<OrgBusinessScopeDeviceRefDO> orgBusinessScopeDeviceRefDoPage = orgBusinessScopeDeviceRefRepository.listOrgBusinessScopeDeviceRefPage(PageHelper.queryToPage(orgBusinessScopeDeviceRefPageQry), orgBusinessScopeDeviceRefPageQry); IPage<OrgBusinessScopeDeviceRefDO> orgBusinessScopeDeviceRefDoPage = orgBusinessScopeDeviceRefRepository.listOrgBusinessScopeDeviceRefPage(PageHelper.queryToPage(orgBusinessScopeDeviceRefPageQry), orgBusinessScopeDeviceRefPageQry);

View File

@ -20,6 +20,14 @@ public interface OrgBusinessScopeDeviceRefRepository extends BaseRepository<OrgB
*/ */
OrgBusinessScopeDeviceRefDO getById(Long id); OrgBusinessScopeDeviceRefDO getById(Long id);
/**
*
*
* @param deviceTypeCode
* @return
*/
OrgBusinessScopeDeviceRefDO getByDeviceTypeCode(String deviceTypeCode);
/** /**
* *
* *

View File

@ -7,6 +7,7 @@ import com.jjb.saas.framework.enums.enums.BooleanEnum;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl; import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.qinan.safetyeval.client.ref.request.OrgBusinessScopeDeviceRefPageQry; 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.domainobject.OrgBusinessScopeDeviceRefDO;
import org.qinan.safetyeval.infrastructure.persistence.mapper.OrgBusinessScopeDeviceRefMapper; import org.qinan.safetyeval.infrastructure.persistence.mapper.OrgBusinessScopeDeviceRefMapper;
import org.qinan.safetyeval.infrastructure.persistence.repository.OrgBusinessScopeDeviceRefRepository; 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(); 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 @Override
public IPage<OrgBusinessScopeDeviceRefDO> listOrgBusinessScopeDeviceRefPage(IPage iPage, OrgBusinessScopeDeviceRefPageQry orgBusinessScopeDeviceRefPageQry) { public IPage<OrgBusinessScopeDeviceRefDO> listOrgBusinessScopeDeviceRefPage(IPage iPage, OrgBusinessScopeDeviceRefPageQry orgBusinessScopeDeviceRefPageQry) {
QueryWrapper<OrgBusinessScopeDeviceRefDO> orgBusinessScopeDeviceRefDoQueryWrapper = new QueryWrapper<>(); QueryWrapper<OrgBusinessScopeDeviceRefDO> orgBusinessScopeDeviceRefDoQueryWrapper = new QueryWrapper<>();