feat(smartfactory): 作为工厂主管查询搬运工时支持多工厂查询
- 在 HandlingGroupAmountSpecificationsTotalNumDTO 和 HandlingGroupAmountSpecificationsPageReqVO 中添加 factoryIds 字段 - 修改 HandlingGroupAmountSpecificationsServiceImpl 中的方法以支持多工厂查询 - 更新 HandlingGroupAmountSpecificationsMapper.xml 中的 SQL 语句以支持多工厂查询
This commit is contained in:
parent
a4fba15a4a
commit
bb49e919cb
@ -6,6 +6,7 @@ import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ -23,4 +24,6 @@ public class HandlingGroupAmountSpecificationsTotalNumDTO {
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
@Schema(description = "工厂ids")
|
||||
private List<Long> factoryIds;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ -47,4 +48,7 @@ public class HandlingGroupAmountSpecificationsPageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "工厂ids", example = "23178")
|
||||
private List<Long> factoryIds;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.smartfactory.service.handlinggroupamountspecifications;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.handlinggroup.vo.HandlingGroupListVO;
|
||||
@ -64,11 +65,10 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
|
||||
public PageResult<HandlingGroupAmountSpecificationsDO> getHandlingGroupAmountSpecificationsPage(HandlingGroupAmountSpecificationsPageReqVO pageReqVO) {
|
||||
// 判断当前登录人是否属于工厂主管
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(getLoginUserId()).getCheckedData();
|
||||
DeptRespDTO deptRespDTO = deptApi.getDept(userRespDTO.getDeptId()).getCheckedData();
|
||||
if (deptRespDTO.getFactoryId() != null) {
|
||||
pageReqVO.setFactoryId(deptRespDTO.getFactoryId());
|
||||
List<DeptRespDTO> deptRespDTOS = deptApi.getDeptByLeaderId(userRespDTO.getDeptId()).getCheckedData();
|
||||
if (CollUtil.isNotEmpty(deptRespDTOS)) {
|
||||
pageReqVO.setFactoryIds(deptRespDTOS.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
IPage<HandlingGroupAmountSpecificationsDO> pageResult = handlingGroupAmountSpecificationsMapper.getHandlingGroupAmountSpecificationsPage(MyBatisUtils.buildPage(pageReqVO), pageReqVO);
|
||||
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
||||
}
|
||||
@ -160,6 +160,12 @@ public class HandlingGroupAmountSpecificationsServiceImpl implements HandlingGro
|
||||
|
||||
@Override
|
||||
public HandlingGroupAmountSpecificationsTotalNumVO getTotalNum(HandlingGroupAmountSpecificationsTotalNumDTO dto) {
|
||||
// 判断当前登录人是否属于工厂主管
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(getLoginUserId()).getCheckedData();
|
||||
List<DeptRespDTO> deptRespDTOS = deptApi.getDeptByLeaderId(userRespDTO.getDeptId()).getCheckedData();
|
||||
if (CollUtil.isNotEmpty(deptRespDTOS)) {
|
||||
dto.setFactoryIds(deptRespDTOS.stream().map(DeptRespDTO::getFactoryId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
return handlingGroupAmountSpecificationsMapper.getTotalNum(dto);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,12 @@
|
||||
<if test="vo.factoryId != null">
|
||||
AND a.factory_id = #{vo.factoryId}
|
||||
</if>
|
||||
<if test="vo.factoryIds != null and vo.factoryIds.size() > 0">
|
||||
and a.factory_id in
|
||||
<foreach collection="vo.factoryIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="vo.porterName != null and vo.porterName != ''">
|
||||
and g.nick_name like concat('%', #{vo.porterName}, '%')
|
||||
</if>
|
||||
@ -108,6 +114,12 @@
|
||||
<if test="dto.factoryId != null">
|
||||
and a.factory_id = #{dto.factoryId}
|
||||
</if>
|
||||
<if test="dto.factoryIds != null and dto.factoryIds.size() > 0">
|
||||
and a.factory_id in
|
||||
<foreach collection="dto.factoryIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.handlingSpecificationsId != null">
|
||||
and a.handling_specifications_id = #{dto.handlingSpecificationsId}
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user