Преглед на файлове

Merge branch 'zx_saas_goods' of http://git.dayaedu.com/yonge/mec into zx_saas_goods

刘俊驰 преди 1 година
родител
ревизия
d22be7485f

+ 19 - 2
mec-application/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -13,16 +13,25 @@ import com.ym.mec.biz.service.GoodsCategoryService;
 import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.dto.BrandDto;
+import com.ym.mec.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 @RequestMapping("${app-config.url.web:}/goods")
 @Api(tags = "商品(教材、辅件)服务")
@@ -112,7 +121,15 @@ public class GoodsController extends BaseController {
         }else if(StringUtils.isEmpty(employee.getOrganIdList())){
             return failed("用户所在分部异常");
         }
-        return succeed(goodsService.queryPage(queryInfo));
+        PageInfo<Goods> page = goodsService.queryPage(queryInfo);
+        List<Goods> rows = page.getRows();
+        if (!rows.isEmpty()) {
+            Map<String, String> brandIdNameMap = goodsService.queryGoodsBrandList().stream().collect(Collectors.toMap(next -> next.getId().toString(), BrandDto::getName));
+            for (Goods row : rows) {
+                row.setBrandName(brandIdNameMap.getOrDefault(row.getBrand(), row.getBrand()));
+            }
+        }
+        return succeed(page);
     }
 
     @ApiOperation(value = "通过科目编号、商品分类 查询商品(教材、辅件)列表")

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java

@@ -189,6 +189,8 @@ public class Goods {
 
 	private String childOrganCostPrice;
 
+	private String brandName;
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/GoodsQueryInfo.java

@@ -52,6 +52,9 @@ public class GoodsQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "此参数为1则不按分部查询")
     private Integer noOrganSearch;
 
+    @ApiModelProperty(value = "品牌ID")
+    private String brandId;
+
     private Integer subjectId;
 
     public Integer getNoOrganSearch() {
@@ -173,4 +176,12 @@ public class GoodsQueryInfo extends QueryInfo {
 	public void setFreeFeeShowOrganId(String freeFeeShowOrganId) {
 		this.freeFeeShowOrganId = freeFeeShowOrganId;
 	}
+
+    public String getBrandId() {
+        return brandId;
+    }
+
+    public void setBrandId(String brandId) {
+        this.brandId = brandId;
+    }
 }

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -363,6 +363,9 @@
             <if test="replacementShowOrganId!=null and replacementShowOrganId!=''">
                 AND INTE_ARRAY(#{replacementShowOrganId},g.replacement_show_organ_id_)
             </if>
+            <if test="brandId != null and brandId != ''">
+                AND g.brand_ = #{brandId}
+            </if>
             <if test="noOrganSearch == null">
                 <if test="organId != null and organId != ''">
                     AND INTE_ARRAY (#{organId},CONCAT_WS(',',