1 /** 2 * 采购价盘管理列表查询 3 * @param pCusArr 供应商编码编码 4 * @param pPro 物料编码 5 * @param pDid 经销商编号 6 * @return 7 */ 8 List<BaseMatnrUnitDto> getBaseMatnrUnitDto(@Param("pCusArr") String[] pCusArr, @Param("pPro") String pPro, @Param("pDid") String pDid); 9 10 11 12 <select id="getBaseMatnrUnitDto" resultType="com.shinho.dc3.master.dto.BaseMatnrUnitDto" parameterType="map"> 13 SELECT B1.ROW_ID, -- 供应商编码 14 B1.supplier_name, -- 供应商名称 15 A1.MATNR, -- 商品编码 16 A1.MAKTX, -- 商品描述 17 C1.INSDT, -- 最后交易时间 18 A1.UNIT_ID, -- 单位编码 19 A1.UNIT_NAME, -- 单位名称 20 A1.DID, -- 经销商编码 21 CASE 22 WHEN A1.TYPE = 'B' THEN 23 A1.Fixed_Price 24 ELSE 25 A1.Fixed_Price * A1.Umrez 26 END RETAIL_PRICE, -- 价盘价格 27 NVL(C1.Price,0)Price, -- 最新价格 28 NVL(C1.IS_LOCK, 0) IS_LOCK, -- 是否锁定 29 CASE 30 WHEN C1.IS_LOCK = 1 THEN '是' 31 ELSE '否' END IS_LOCK_B, 32 C1.REMARK 33 FROM (SELECT DISTINCT A.MATNR, 34 A.MAKTX, 35 A1.UNIT_ID, 36 A1.UNIT_NAME, 37 A.DID, 38 A.RETAIL_PRICE, 39 A.SALE_PRICE, 40 A1.TYPE, 41 A.Fixed_Price, 42 A.Umrez 43 FROM base_matnr A 44 JOIN `base_matnr_unit` A1 45 ON A.MATNR = A1.MATNR 46 AND A.DID = A1.DID 47 JOIN base_supplier_matnr a2 ON 48 A.matnr=a2.matnr AND A.did=a2.did AND a2.supplier_id IN 49 <foreach collection="pCusArr" item="listItem" index="index" open="(" close=")" separator="," > 50 #{listItem} 51 </foreach> 52 WHERE A.DID = #{pDid} 53 -- if pPro不为空 54 <if test="pPro != null" > 55 AND A1.MATNR = #{pPro} 56 </if> 57 ) A1 58 LEFT JOIN base_supplier B1 on B1.DID = A1.DID 59 <if test="pCusArr!=null"> 60 and B1.ROW_ID IN 61 <foreach collection="pCusArr" item="listItem" index="index" open="(" close=")" separator="," > 62 #{listItem} 63 </foreach> 64 </if> 65 LEFT JOIN po_price_list C1 66 ON C1.DID = A1.DID 67 AND C1.UNIT_ID = A1.UNIT_ID 68 AND C1.MATNR = A1.MATNR 69 AND C1.supplier_id = B1.ROW_ID 70 ORDER BY A1.MAKTX, B1.ROW_ID 71 </select> 72 73 74 75 /** 76 *采购价盘管理列表查询 77 * @param pCus 78 * @param pPro 79 * @param pDid 80 * @return 81 */ 82 public List<BaseMatnrUnitDto> getBaseMatnrUnitDto(String pCus,String pPro,String pDid){ 83 String[] pCusArr = null; 84 if(!StringUtils.isEmpty(pCus)){ 85 pCusArr = pCus.split(","); 86 } 87 return baseMatnrUnitMapper.getBaseMatnrUnitDto(pCusArr,pPro,pDid); 88 } 89 90 91 92 /** 93 * 采购价盘管理列表查询 94 * @param pCus 供应商编码编码 95 * @param pPro 物料编码 96 * @param pDid 经销商编号 97 * @param pageSearch 分页 98 * @return 99 */ 100 @GetMapping(value = "/getBaseMatnrUnitDto") 101 @ApiOperation(value = "采购价盘管理列表查询", notes = "采购价盘管理列表查询") 102 public JsonResult<PageInfo<BaseMatnrUnitDto>> getBaseMatnrUnitDto(@ApiParam(name = "pCus", value = "经销商编号", required = true) @RequestParam String pCus, 103 @ApiParam(name = "pPro", value = "物料编号") @RequestParam String pPro, 104 @ApiParam(name = "pDid", value = "经销商编号") @RequestParam(required = false) String pDid, PageSearch pageSearch){ 105 UserInfo userInfo=this.getUserInfo(); 106 if(userInfo!=null && org.springframework.util.StringUtils.isEmpty(userInfo.getDid())){ 107 pDid = userInfo.getDid(); 108 } 109 logger.info("采购价盘管理列表查询接口请求参数:pCus:{},pPro:{},pDid:{}", pCus,pPro,pDid); 110 //当前页,页面大小 111 if(pageSearch !=null) { 112 PageHelper.startPage(pageSearch.getPageIndex(), pageSearch.getPageSize()); 113 } 114 List<BaseMatnrUnitDto> list=baseMatnrUnitService.getBaseMatnrUnitDto(pCus,pPro,pDid); 115 PageInfo<BaseMatnrUnitDto> pageInfo = new PageInfo<>(list); 116 //封装返回结果 117 JsonResult<PageInfo<BaseMatnrUnitDto>> result = new JsonResult<>(); 118 result.setData(pageInfo); 119 return result; 120 }