| New file |
| | |
| | | package com.zy.asrs.entity.param; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 库存明细查询参数 |
| | | */ |
| | | @Data |
| | | public class OpenLocDetlQueryParam { |
| | | |
| | | private static final String RANGE_TIME_LINK = " - "; |
| | | |
| | | @ApiModelProperty(value = "当前页码", example = "1") |
| | | private Integer curr = 1; |
| | | |
| | | @ApiModelProperty(value = "每页数量", example = "10") |
| | | private Integer limit = 10; |
| | | |
| | | @ApiModelProperty(value = "排序字段") |
| | | private String orderByField; |
| | | |
| | | @ApiModelProperty(value = "排序类型", example = "asc") |
| | | private String orderByType; |
| | | |
| | | @ApiModelProperty(value = "通用查询条件") |
| | | private String condition; |
| | | |
| | | @ApiModelProperty(value = "库位号") |
| | | private String locNo; |
| | | |
| | | @ApiModelProperty(value = "托盘号") |
| | | private String zpallet; |
| | | |
| | | @ApiModelProperty(value = "物料编码") |
| | | private String matnr; |
| | | |
| | | @ApiModelProperty(value = "规格") |
| | | private String specs; |
| | | |
| | | @ApiModelProperty(value = "冻结状态") |
| | | private String frozen; |
| | | |
| | | /** |
| | | * 将查询参数转换为 EntityWrapper 查询条件 |
| | | * @param wrapper EntityWrapper 对象 |
| | | */ |
| | | public void convertToWrapper(EntityWrapper<LocDetl> wrapper) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | String val = String.valueOf(locNo); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge("loc_no", DateUtils.convert(dates[0])); |
| | | wrapper.le("loc_no", DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.eq("loc_no", locNo); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(zpallet)) { |
| | | String val = String.valueOf(zpallet); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge("zpallet", DateUtils.convert(dates[0])); |
| | | wrapper.le("zpallet", DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like("zpallet", zpallet); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(matnr)) { |
| | | String val = String.valueOf(matnr); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge("matnr", DateUtils.convert(dates[0])); |
| | | wrapper.le("matnr", DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like("matnr", matnr); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(specs)) { |
| | | String val = String.valueOf(specs); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge("specs", DateUtils.convert(dates[0])); |
| | | wrapper.le("specs", DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like("specs", specs); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(frozen)) { |
| | | String val = String.valueOf(frozen); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge("frozen", DateUtils.convert(dates[0])); |
| | | wrapper.le("frozen", DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like("frozen", frozen); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为查询条件 Map(用于 excludeTrash 和 allLike) |
| | | * @return Map 对象 |
| | | */ |
| | | public Map<String, Object> toQueryMap() { |
| | | Map<String, Object> paramMap = new HashMap<>(); |
| | | if (!Cools.isEmpty(locNo)) { |
| | | paramMap.put("locNo", locNo); |
| | | } |
| | | if (!Cools.isEmpty(zpallet)) { |
| | | paramMap.put("zpallet", zpallet); |
| | | } |
| | | if (!Cools.isEmpty(matnr)) { |
| | | paramMap.put("matnr", matnr); |
| | | } |
| | | if (!Cools.isEmpty(specs)) { |
| | | paramMap.put("specs", specs); |
| | | } |
| | | if (!Cools.isEmpty(frozen)) { |
| | | paramMap.put("frozen", frozen); |
| | | } |
| | | return paramMap; |
| | | } |
| | | |
| | | } |
| | | |