diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceLibraryEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceLibraryEntity.java index a096afa..71054f0 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceLibraryEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/entity/OperMaintenanceLibraryEntity.java @@ -8,6 +8,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import org.springblade.core.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; import org.springblade.core.tenant.mp.TenantEntity; import org.springframework.format.annotation.DateTimeFormat; @@ -31,11 +33,13 @@ public class OperMaintenanceLibraryEntity extends TenantEntity { * 库编码 */ @ApiModelProperty(value = "库编码,后台自动生成") + @QueryField(condition = SqlCondition.LIKE) private String libraryCode; /** * 设备编码 */ @ApiModelProperty(value = "设备编码,多个按,分隔") + @QueryField(condition = SqlCondition.EQUAL) private String emCode; @ApiModelProperty(value = "维护模式 01=人员 02=值班") @@ -54,12 +58,14 @@ public class OperMaintenanceLibraryEntity extends TenantEntity { * 维护类型 01=定期试验 02=定期保养 03=定期操作 04=其他 */ @ApiModelProperty(value = "维护类型 01=定期试验 02=定期保养 03=定期操作 04=其他") + @QueryField(condition = SqlCondition.EQUAL) private String typeCode; /** * 流程key */ @ApiModelProperty(value = "流程key") + @QueryField(condition = SqlCondition.EQUAL) private String procDefId; /** * 周期(单位:小时) @@ -102,6 +108,7 @@ public class OperMaintenanceLibraryEntity extends TenantEntity { * 执行人员,多个人员之间用英文逗号分隔 */ @ApiModelProperty(value = "执行人员,多个人员之间用英文逗号分隔,并且字符串首尾都必须有一个英文逗号") + @QueryField(condition = SqlCondition.LIKE) private String disposers; @ApiModelProperty(value = "生成计划时间,仅在后台业务使用") @@ -121,4 +128,8 @@ public class OperMaintenanceLibraryEntity extends TenantEntity { @JsonSerialize(nullsUsing = NullSerializer.class) private Long messageTemplateId; + @ApiModelProperty("创建机构") + @QueryField(condition = SqlCondition.LIKE) + private Long createDept; + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceLibraryService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceLibraryService.java index f274145..b50070b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceLibraryService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceLibraryService.java @@ -1,6 +1,8 @@ package com.hnac.hzims.operational.maintenance.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.common.support.constants.Order; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceLibraryDTO; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceLibraryEntity; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceLibraryVO; @@ -8,6 +10,8 @@ import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import java.util.HashMap; + /** * 服务类 * @@ -28,4 +32,12 @@ public interface IOperMaintenanceLibraryService extends BaseService getQueryWrapper(OperMaintenanceLibraryEntity req) { + HashMap sort = new HashMap() {{ + put("create_time", Order.DESC); + }}; + LambdaQueryWrapper queryWrapper = com.hnac.hzims.common.support.utils.Condition.getQueryWrapper(req,OperMaintenanceLibraryEntity.class,sort); + return queryWrapper; + } + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceLibraryServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceLibraryServiceImpl.java index 0751fc1..d7ec498 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceLibraryServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceLibraryServiceImpl.java @@ -3,6 +3,7 @@ package com.hnac.hzims.operational.maintenance.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.hnac.hzims.common.support.constants.Order; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceLibraryDTO; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceLibraryEntity; import com.hnac.hzims.operational.maintenance.mapper.OperMaintenanceLibraryMapper; @@ -27,6 +28,7 @@ import org.springframework.stereotype.Service; import java.time.YearMonth; import java.util.Arrays; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -61,25 +63,7 @@ public class OperMaintenanceLibraryServiceImpl extends BaseServiceImpl> list(OperMaintenanceLibraryDTO req, Query query) { - Wrapper queryWrapper = new LambdaQueryWrapper() {{ - orderByDesc(OperMaintenanceLibraryEntity::getCreateTime); - if (StringUtils.isNotBlank(req.getLibraryCode())) { - like(OperMaintenanceLibraryEntity::getLibraryCode, req.getLibraryCode()); - } - if (StringUtils.isNotBlank(req.getEmCode())) { - like(OperMaintenanceLibraryEntity::getEmCode, req.getEmCode()); - } - if (StringUtils.isNotBlank(req.getTypeCode())) { - eq(OperMaintenanceLibraryEntity::getTypeCode, req.getTypeCode()); - } - if (StringUtils.isNotBlank(req.getProcDefId())) { - eq(OperMaintenanceLibraryEntity::getProcDefId, req.getProcDefId()); - } - if (StringUtils.isNotBlank(req.getDisposers())) { - like(OperMaintenanceLibraryEntity::getDisposers, "," + req.getDisposers() + ","); - } - }}; - IPage pages = super.page(Condition.getPage(query), queryWrapper); + IPage pages = super.page(Condition.getPage(query), this.getQueryWrapper(BeanUtil.copy(req, OperMaintenanceLibraryEntity.class))); pages.setRecords(OperMaintenanceLibraryWrapper.build().listVO(pages.getRecords())); return R.data(pages); }