wuxw лет назад: 3
Родитель
Сommit
a2bd8dfe1a

+ 23 - 7
java110-bean/src/main/java/com/java110/dto/marketGoods/MarketGoodsDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.marketGoods;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,8 +16,10 @@ import java.util.Date;
 public class MarketGoodsDto extends PageDto implements Serializable {
 
     private String goodsId;
-private String name;
-private String remark;
+    private String name;
+    private String remark;
+
+    private long goodsCount;
 
 
     private Date createTime;
@@ -27,19 +30,24 @@ private String remark;
     public String getGoodsId() {
         return goodsId;
     }
-public void setGoodsId(String goodsId) {
+
+    public void setGoodsId(String goodsId) {
         this.goodsId = goodsId;
     }
-public String getName() {
+
+    public String getName() {
         return name;
     }
-public void setName(String name) {
+
+    public void setName(String name) {
         this.name = name;
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
     }
 
@@ -59,4 +67,12 @@ public void setRemark(String remark) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public long getGoodsCount() {
+        return goodsCount;
+    }
+
+    public void setGoodsCount(long goodsCount) {
+        this.goodsCount = goodsCount;
+    }
 }

+ 62 - 25
java110-bean/src/main/java/com/java110/dto/marketGoodsItem/MarketGoodsItemDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.marketGoodsItem;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,14 +16,17 @@ import java.util.Date;
 public class MarketGoodsItemDto extends PageDto implements Serializable {
 
     private String itemId;
-private String picUrl;
-private String goodsId;
-private String price;
-private String prodName;
-private String shopName;
-private String picLink;
-private String sort;
-private String prodDesc;
+    private String picUrl;
+    private String goodsId;
+    private String[] goodsIds;
+    private String price;
+    private String prodName;
+    private String shopName;
+    private String picLink;
+    private String sort;
+    private String prodDesc;
+
+    private long goodsCount;
 
 
     private Date createTime;
@@ -33,55 +37,72 @@ private String prodDesc;
     public String getItemId() {
         return itemId;
     }
-public void setItemId(String itemId) {
+
+    public void setItemId(String itemId) {
         this.itemId = itemId;
     }
-public String getPicUrl() {
+
+    public String getPicUrl() {
         return picUrl;
     }
-public void setPicUrl(String picUrl) {
+
+    public void setPicUrl(String picUrl) {
         this.picUrl = picUrl;
     }
-public String getGoodsId() {
+
+    public String getGoodsId() {
         return goodsId;
     }
-public void setGoodsId(String goodsId) {
+
+    public void setGoodsId(String goodsId) {
         this.goodsId = goodsId;
     }
-public String getPrice() {
+
+    public String getPrice() {
         return price;
     }
-public void setPrice(String price) {
+
+    public void setPrice(String price) {
         this.price = price;
     }
-public String getProdName() {
+
+    public String getProdName() {
         return prodName;
     }
-public void setProdName(String prodName) {
+
+    public void setProdName(String prodName) {
         this.prodName = prodName;
     }
-public String getShopName() {
+
+    public String getShopName() {
         return shopName;
     }
-public void setShopName(String shopName) {
+
+    public void setShopName(String shopName) {
         this.shopName = shopName;
     }
-public String getPicLink() {
+
+    public String getPicLink() {
         return picLink;
     }
-public void setPicLink(String picLink) {
+
+    public void setPicLink(String picLink) {
         this.picLink = picLink;
     }
-public String getSort() {
+
+    public String getSort() {
         return sort;
     }
-public void setSort(String sort) {
+
+    public void setSort(String sort) {
         this.sort = sort;
     }
-public String getProdDesc() {
+
+    public String getProdDesc() {
         return prodDesc;
     }
-public void setProdDesc(String prodDesc) {
+
+    public void setProdDesc(String prodDesc) {
         this.prodDesc = prodDesc;
     }
 
@@ -101,4 +122,20 @@ public void setProdDesc(String prodDesc) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String[] getGoodsIds() {
+        return goodsIds;
+    }
+
+    public void setGoodsIds(String[] goodsIds) {
+        this.goodsIds = goodsIds;
+    }
+
+    public long getGoodsCount() {
+        return goodsCount;
+    }
+
+    public void setGoodsCount(long goodsCount) {
+        this.goodsCount = goodsCount;
+    }
 }

+ 133 - 113
java110-db/src/main/resources/mapper/common/MarketGoodsItemV1ServiceDaoImplMapper.xml

@@ -5,138 +5,158 @@
 <mapper namespace="marketGoodsItemV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存营销商品信息 add by wuxw 2018-07-03 -->
     <insert id="saveMarketGoodsItemInfo" parameterType="Map">
         insert into market_goods_item(
-item_id,pic_url,goods_id,price,prod_name,shop_name,pic_link,sort,prod_desc
-) values (
-#{itemId},#{picUrl},#{goodsId},#{price},#{prodName},#{shopName},#{picLink},#{sort},#{prodDesc}
-)
+        item_id,pic_url,goods_id,price,prod_name,shop_name,pic_link,sort,prod_desc
+        ) values (
+        #{itemId},#{picUrl},#{goodsId},#{price},#{prodName},#{shopName},#{picLink},#{sort},#{prodDesc}
+        )
     </insert>
 
 
-
     <!-- 查询营销商品信息 add by wuxw 2018-07-03 -->
     <select id="getMarketGoodsItemInfo" parameterType="Map" resultType="Map">
-        select  t.item_id,t.item_id itemId,t.pic_url,t.pic_url picUrl,t.goods_id,t.goods_id goodsId,t.price,t.prod_name,t.prod_name prodName,t.shop_name,t.shop_name shopName,t.pic_link,t.pic_link picLink,t.status_cd,t.status_cd statusCd,t.sort,t.prod_desc,t.prod_desc prodDesc 
-from market_goods_item t 
-where 1 =1 
-<if test="itemId !=null and itemId != ''">
-   and t.item_id= #{itemId}
-</if> 
-<if test="picUrl !=null and picUrl != ''">
-   and t.pic_url= #{picUrl}
-</if> 
-<if test="goodsId !=null and goodsId != ''">
-   and t.goods_id= #{goodsId}
-</if> 
-<if test="price !=null and price != ''">
-   and t.price= #{price}
-</if> 
-<if test="prodName !=null and prodName != ''">
-   and t.prod_name= #{prodName}
-</if> 
-<if test="shopName !=null and shopName != ''">
-   and t.shop_name= #{shopName}
-</if> 
-<if test="picLink !=null and picLink != ''">
-   and t.pic_link= #{picLink}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="sort !=null and sort != ''">
-   and t.sort= #{sort}
-</if> 
-<if test="prodDesc !=null and prodDesc != ''">
-   and t.prod_desc= #{prodDesc}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.item_id,t.item_id itemId,t.pic_url,t.pic_url picUrl,t.goods_id,t.goods_id
+        goodsId,t.price,t.prod_name,t.prod_name prodName,t.shop_name,t.shop_name shopName,t.pic_link,t.pic_link
+        picLink,t.status_cd,t.status_cd statusCd,t.sort,t.prod_desc,t.prod_desc prodDesc
+        from market_goods_item t
+        where 1 =1
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
+        <if test="picUrl !=null and picUrl != ''">
+            and t.pic_url= #{picUrl}
+        </if>
+        <if test="goodsId !=null and goodsId != ''">
+            and t.goods_id= #{goodsId}
+        </if>
+        <if test="price !=null and price != ''">
+            and t.price= #{price}
+        </if>
+        <if test="prodName !=null and prodName != ''">
+            and t.prod_name= #{prodName}
+        </if>
+        <if test="shopName !=null and shopName != ''">
+            and t.shop_name= #{shopName}
+        </if>
+        <if test="picLink !=null and picLink != ''">
+            and t.pic_link= #{picLink}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="sort !=null and sort != ''">
+            and t.sort= #{sort}
+        </if>
+        <if test="prodDesc !=null and prodDesc != ''">
+            and t.prod_desc= #{prodDesc}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改营销商品信息 add by wuxw 2018-07-03 -->
     <update id="updateMarketGoodsItemInfo" parameterType="Map">
-        update  market_goods_item t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="itemId !=null and itemId != ''">
-, t.item_id= #{itemId}
-</if> 
-<if test="picUrl !=null and picUrl != ''">
-, t.pic_url= #{picUrl}
-</if> 
-<if test="price !=null and price != ''">
-, t.price= #{price}
-</if> 
-<if test="prodName !=null and prodName != ''">
-, t.prod_name= #{prodName}
-</if> 
-<if test="shopName !=null and shopName != ''">
-, t.shop_name= #{shopName}
-</if> 
-<if test="picLink !=null and picLink != ''">
-, t.pic_link= #{picLink}
-</if> 
-<if test="sort !=null and sort != ''">
-, t.sort= #{sort}
-</if> 
-<if test="prodDesc !=null and prodDesc != ''">
-, t.prod_desc= #{prodDesc}
-</if> 
- where 1=1 <if test="goodsId !=null and goodsId != ''">
-and t.goods_id= #{goodsId}
-</if> 
+        update market_goods_item t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="itemId !=null and itemId != ''">
+            , t.item_id= #{itemId}
+        </if>
+        <if test="picUrl !=null and picUrl != ''">
+            , t.pic_url= #{picUrl}
+        </if>
+        <if test="price !=null and price != ''">
+            , t.price= #{price}
+        </if>
+        <if test="prodName !=null and prodName != ''">
+            , t.prod_name= #{prodName}
+        </if>
+        <if test="shopName !=null and shopName != ''">
+            , t.shop_name= #{shopName}
+        </if>
+        <if test="picLink !=null and picLink != ''">
+            , t.pic_link= #{picLink}
+        </if>
+        <if test="sort !=null and sort != ''">
+            , t.sort= #{sort}
+        </if>
+        <if test="prodDesc !=null and prodDesc != ''">
+            , t.prod_desc= #{prodDesc}
+        </if>
+        where 1=1
+        <if test="goodsId !=null and goodsId != ''">
+            and t.goods_id= #{goodsId}
+        </if>
 
     </update>
 
     <!-- 查询营销商品数量 add by wuxw 2018-07-03 -->
-     <select id="queryMarketGoodsItemsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from market_goods_item t 
-where 1 =1 
-<if test="itemId !=null and itemId != ''">
-   and t.item_id= #{itemId}
-</if> 
-<if test="picUrl !=null and picUrl != ''">
-   and t.pic_url= #{picUrl}
-</if> 
-<if test="goodsId !=null and goodsId != ''">
-   and t.goods_id= #{goodsId}
-</if> 
-<if test="price !=null and price != ''">
-   and t.price= #{price}
-</if> 
-<if test="prodName !=null and prodName != ''">
-   and t.prod_name= #{prodName}
-</if> 
-<if test="shopName !=null and shopName != ''">
-   and t.shop_name= #{shopName}
-</if> 
-<if test="picLink !=null and picLink != ''">
-   and t.pic_link= #{picLink}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="sort !=null and sort != ''">
-   and t.sort= #{sort}
-</if> 
-<if test="prodDesc !=null and prodDesc != ''">
-   and t.prod_desc= #{prodDesc}
-</if> 
+    <select id="queryMarketGoodsItemsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from market_goods_item t
+        where 1 =1
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
+        <if test="picUrl !=null and picUrl != ''">
+            and t.pic_url= #{picUrl}
+        </if>
+        <if test="goodsId !=null and goodsId != ''">
+            and t.goods_id= #{goodsId}
+        </if>
+        <if test="price !=null and price != ''">
+            and t.price= #{price}
+        </if>
+        <if test="prodName !=null and prodName != ''">
+            and t.prod_name= #{prodName}
+        </if>
+        <if test="shopName !=null and shopName != ''">
+            and t.shop_name= #{shopName}
+        </if>
+        <if test="picLink !=null and picLink != ''">
+            and t.pic_link= #{picLink}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="sort !=null and sort != ''">
+            and t.sort= #{sort}
+        </if>
+        <if test="prodDesc !=null and prodDesc != ''">
+            and t.prod_desc= #{prodDesc}
+        </if>
+
 
+    </select>
 
-     </select>
+    <select id="queryMarketGoodssGroupCount" parameterType="Map" resultType="Map">
+        select t.goods_id goodsId,count(1) goodsCount
+        from market_goods_item t
+        where 1 =1
+        <if test="itemId !=null and itemId != ''">
+            and t.item_id= #{itemId}
+        </if>
+        <if test="picUrl !=null and picUrl != ''">
+            and t.pic_url= #{picUrl}
+        </if>
+        <if test="goodsId !=null and goodsId != ''">
+            and t.goods_id= #{goodsId}
+        </if>
+        <if test="goodsIds !=null ">
+            and t.goods_id in
+            <foreach collection="goodsIds" open="(" close=")"
+                     separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+        group by t.goods_id
+    </select>
 
 </mapper>

+ 3 - 1
java110-db/src/main/resources/mapper/common/MarketGoodsV1ServiceDaoImplMapper.xml

@@ -17,7 +17,7 @@
 
     <!-- 查询营销商品信息 add by wuxw 2018-07-03 -->
     <select id="getMarketGoodsInfo" parameterType="Map" resultType="Map">
-        select t.goods_id,t.goods_id goodsId,t.name,t.status_cd,t.status_cd statusCd,t.remark
+        select t.goods_id,t.goods_id goodsId,t.name,t.status_cd,t.status_cd statusCd,t.remark,t.create_time createTime
         from market_goods t
         where 1 =1
         <if test="goodsId !=null and goodsId != ''">
@@ -80,4 +80,6 @@
 
     </select>
 
+
+
 </mapper>

+ 3 - 0
java110-interface/src/main/java/com/java110/intf/common/IMarketGoodsItemV1InnerServiceSMO.java

@@ -65,4 +65,7 @@ public interface IMarketGoodsItemV1InnerServiceSMO {
      */
     @RequestMapping(value = "/queryMarketGoodsItemsCount", method = RequestMethod.POST)
     int queryMarketGoodsItemsCount(@RequestBody MarketGoodsItemDto marketGoodsItemDto);
+
+    @RequestMapping(value = "/queryMarketGoodssGroupCount", method = RequestMethod.POST)
+    List<MarketGoodsItemDto> queryMarketGoodssGroupCount(@RequestBody MarketGoodsItemDto marketGoodsItemDto);
 }

+ 1 - 0
service-common/src/main/java/com/java110/common/dao/IMarketGoodsItemV1ServiceDao.java

@@ -74,4 +74,5 @@ public interface IMarketGoodsItemV1ServiceDao {
      */
     int queryMarketGoodsItemsCount(Map info);
 
+    List<Map> queryMarketGoodssGroupCount(Map map);
 }

+ 7 - 0
service-common/src/main/java/com/java110/common/dao/impl/MarketGoodsItemV1ServiceDaoImpl.java

@@ -108,5 +108,12 @@ public class MarketGoodsItemV1ServiceDaoImpl extends BaseServiceDao implements I
         return Integer.parseInt(businessMarketGoodsItemInfos.get(0).get("count").toString());
     }
 
+    @Override
+    public List<Map> queryMarketGoodssGroupCount(Map info) {
+        List<Map> businessMarketGoodsItemInfos = sqlSessionTemplate.selectList("marketGoodsItemV1ServiceDaoImpl.queryMarketGoodssGroupCount",info);
+
+        return businessMarketGoodsItemInfos;
+    }
+
 
 }

+ 7 - 0
service-common/src/main/java/com/java110/common/smo/impl/MarketGoodsItemV1InnerServiceSMOImpl.java

@@ -86,4 +86,11 @@ public class MarketGoodsItemV1InnerServiceSMOImpl extends BaseServiceSMO impleme
     public int queryMarketGoodsItemsCount(@RequestBody MarketGoodsItemDto marketGoodsItemDto) {
         return marketGoodsItemV1ServiceDaoImpl.queryMarketGoodsItemsCount(BeanConvertUtil.beanCovertMap(marketGoodsItemDto));    }
 
+    @Override
+    public List<MarketGoodsItemDto> queryMarketGoodssGroupCount(@RequestBody MarketGoodsItemDto marketGoodsItemDto) {
+        List<MarketGoodsItemDto> marketGoodsItems = BeanConvertUtil.covertBeanList(marketGoodsItemV1ServiceDaoImpl.queryMarketGoodssGroupCount(BeanConvertUtil.beanCovertMap(marketGoodsItemDto)), MarketGoodsItemDto.class);
+
+        return marketGoodsItems;
+    }
+
 }

+ 24 - 0
service-common/src/main/java/com/java110/common/smo/impl/MarketGoodsV1InnerServiceSMOImpl.java

@@ -17,6 +17,8 @@ package com.java110.common.smo.impl;
 
 
 import com.java110.common.dao.IMarketGoodsV1ServiceDao;
+import com.java110.dto.marketGoodsItem.MarketGoodsItemDto;
+import com.java110.intf.common.IMarketGoodsItemV1InnerServiceSMO;
 import com.java110.intf.common.IMarketGoodsV1InnerServiceSMO;
 import com.java110.dto.marketGoods.MarketGoodsDto;
 import com.java110.po.marketGoods.MarketGoodsPo;
@@ -45,6 +47,9 @@ public class MarketGoodsV1InnerServiceSMOImpl extends BaseServiceSMO implements
     @Autowired
     private IMarketGoodsV1ServiceDao marketGoodsV1ServiceDaoImpl;
 
+    @Autowired
+    private IMarketGoodsItemV1InnerServiceSMO marketGoodsItemV1InnerServiceSMOImpl;
+
 
     @Override
     public int saveMarketGoods(@RequestBody  MarketGoodsPo marketGoodsPo) {
@@ -78,6 +83,25 @@ public class MarketGoodsV1InnerServiceSMOImpl extends BaseServiceSMO implements
 
         List<MarketGoodsDto> marketGoodss = BeanConvertUtil.covertBeanList(marketGoodsV1ServiceDaoImpl.getMarketGoodsInfo(BeanConvertUtil.beanCovertMap(marketGoodsDto)), MarketGoodsDto.class);
 
+        if(marketGoodss == null || marketGoodss.size()<1 || marketGoodss.size()>20){
+            return marketGoodss;
+        }
+        List<String> goodsIds = new ArrayList<>();
+
+        for(MarketGoodsDto marketGoodsDto1 : marketGoodss){
+            goodsIds.add(marketGoodsDto1.getGoodsId());
+        }
+
+        MarketGoodsItemDto marketGoodsItemDto = new MarketGoodsItemDto();
+        marketGoodsItemDto.setGoodsIds(goodsIds.toArray(new String[goodsIds.size()]));
+        List<MarketGoodsItemDto> marketGoodsItemDtos = marketGoodsItemV1InnerServiceSMOImpl.queryMarketGoodssGroupCount(marketGoodsItemDto);
+
+        for(MarketGoodsDto marketGoodsDto1 : marketGoodss){
+            for(MarketGoodsItemDto marketGoodsItemDto1:marketGoodsItemDtos){
+                marketGoodsDto1.setGoodsCount(marketGoodsItemDto1.getGoodsCount());
+            }
+        }
+
         return marketGoodss;
     }