erp分页查询优化

This commit is contained in:
liss
2025-10-11 11:27:27 +08:00
parent 47f445e2bb
commit 7fd3d4404c
12 changed files with 95 additions and 35 deletions

View File

@@ -7,6 +7,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* ERP Api 实现类
@@ -25,4 +26,9 @@ public class ErpExternalApiImpl implements ErpExternalApi {
public HashMap<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
return erpConfig.pushDataToErp(reqDTO);
}
@Override
public HashMap<String, Object> queryDataToErp(String funcnr, Map<String, Object> req) {
return erpConfig.fetchDataFromERP(funcnr, req);
}
}

View File

@@ -16,10 +16,10 @@ public class ErpFactoryPageReqVO extends PageParam {
private String number;
@Schema(description = "公司编号")
private String companyNumber;
private String erpCompanyNumber;
@Schema(description = "公司名称")
private String companyName;
private String erpCompanyName;
@Schema(description = "类型")
private String type;

View File

@@ -23,7 +23,10 @@ public class ErpFactoryRespVO {
private String number;
@Schema(description = "公司编号")
private String companyNumber;
private String erpCompanyNumber;
@Schema(description = "公司编号")
private String erpCompanyName;
@Schema(description = "类型")
private String type;

View File

@@ -20,10 +20,7 @@ public class ErpFactorySaveReqVO {
private String number;
@Schema(description = "公司编号")
private String companyNumber;
@Schema(description = "公司编号")
private String companyName;
private String erpCompanyNumber;
@Schema(description = "类型")
private String type;

View File

@@ -2,6 +2,7 @@ package com.zt.plat.module.erp.controller.admin.erp.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@@ -18,6 +19,9 @@ public class ErpWarehouseRespVO {
@ExcelProperty("工厂编码;将查询参数存入")
private String factoryNumber;
@Schema(description = "工厂名称")
private String factoryName;
@Schema(description = "库位描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("库位描述")
private String name;

View File

@@ -41,13 +41,13 @@ public class ErpFactoryDO extends BusinessBaseDO {
* 公司编号
*/
@TableField("CPN_ID")
private String companyNumber;
private String erpCompanyNumber;
/**
* 公司名称
*/
@TableField(exist = false)
private String companyName;
private String erpCompanyName;
/**
* 类型

View File

@@ -220,7 +220,7 @@ public class ErpFactoryServiceImpl implements ErpFactoryService {
ErpFactoryDO DO = new ErpFactoryDO();
DO.setName(dataJson.getString("NAME1"));
DO.setNumber(number);
DO.setCompanyNumber(dataJson.getString("BUKRS"));
DO.setErpCompanyNumber(dataJson.getString("BUKRS"));
DO.setType("ERP");
if (numbers.get(number)!=null) {
// 更新

View File

@@ -5,10 +5,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -16,7 +14,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.*;
import java.util.stream.Collectors;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.erp.enums.ErrorCodeConstants.*;
@@ -25,7 +22,6 @@ import static dm.jdbc.util.DriverUtil.log;
@Configuration
public class ErpConfig {
@Value("${erp.address}")
private String erpAddress;

View File

@@ -10,23 +10,31 @@
-->
<select id="getPageByReq" resultType="com.zt.plat.module.erp.dal.dataobject.erp.ErpFactoryDO">
select f.*, c.NAME as companyName
from sply_erp_fact f left join sply_erp_company c on f.CPN_ID = c.NUM;
select f.id,
f.name as name,
f.NUM as number,
f.CPN_ID as erpCompanyNumber,
f.TP as type,
f.REL_NAME as relName,
f.REL_NUM as relnumber,
f.IS_ENB as isEnable,
c.NAME as erpCompanyName
from sply_erp_fact f left join sply_erp_cpn c on f.CPN_ID = c.NUM
where f.DELETED = 0
<if test="reqVO.name != null">
and f.NAME like concat('%', #{reqVO.name}, '%')
<if test="name != null">
and f.NAME like concat('%', #{name}, '%')
</if>
<if test="reqVO.number != null">
and f.NUM like concat('%', #{reqVO.number}, '%')
<if test="number != null">
and f.NUM like concat('%', #{number}, '%')
</if>
<if test="reqVO.companyNumber != null">
and f.CPN_ID = like concat('%', #{reqVO.companyNumber}, '%')
<if test="erpCompanyNumber != null">
and f.CPN_ID = like concat('%', #{erpCompanyNumber}, '%')
</if>
<if test="reqVO.companyName != null">
and c.NAME like concat('%', #{reqVO.companyName}, '%')
<if test="erpCompanyName != null">
and c.NAME like concat('%', #{erpCompanyName}, '%')
</if>
<if test="reqVO.type != null">
and f.TP like concat('%', #{reqVO.type}, '%')
<if test="type != null">
and f.TP like concat('%', #{type}, '%')
</if>
</select>

View File

@@ -14,23 +14,31 @@
</select>
<select id="getPageByReq" resultType="com.zt.plat.module.erp.dal.dataobject.erp.ErpWarehouseDO">
select f.*, c.NAME as f
select f.id,
f.name as name,
f.NUM as number,
f.TP as type,
f.REL_NAME as relName,
f.REL_NUM as relnumber,
f.IS_ENB as isEnable,
f.FACT_NUM as factoryNumber,
c.NAME as factoryName
from sply_erp_wrh f left join sply_erp_fact c on f.FACT_NUM = c.NUM;
where f.DELETED = 0
<if test="reqVO.name != null">
and f.NAME like concat('%', #{reqVO.name}, '%')
<if test="name != null">
and f.NAME like concat('%', #{name}, '%')
</if>
<if test="reqVO.number != null">
and f.NUM like concat('%', #{reqVO.number}, '%')
<if test="number != null">
and f.NUM like concat('%', #{number}, '%')
</if>
<if test="reqVO.factoryNumber != null">
<if test="factoryNumber != null">
and f.FACT_NUM = like concat('%', #{factoryNumber}, '%')
</if>
<if test="reqVO.factoryName != null">
<if test="factoryName != null">
and c.NAME like concat('%', #{factoryName}, '%')
</if>
<if test="reqVO.type != null">
and f.TP like concat('%', #{reqVO.type}, '%')
<if test="type != null">
and f.TP like concat('%', #{type}, '%')
</if>
</select>
</mapper>