浏览代码

修改查询颜色功能

liujiankang 7 年之前
父节点
当前提交
ac584233b6

+ 22 - 3
iamberry-common-core/src/main/java/com/iamberry/wechat/core/entity/cart/CartDto.java

@@ -1,7 +1,10 @@
 package com.iamberry.wechat.core.entity.cart;
 
+import com.iamberry.wechat.core.entity.product.SalesUserGift;
+
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 
@@ -42,7 +45,9 @@ public class CartDto implements Serializable{
 	private String productRemark; //商品备注
 	
 	private String productColor;			//产品颜色		不再用代码表示,直接使用汉字- 1:红色	2:橙色	3:黄色	4:绿色 5:青色	6:蓝色	7:紫色	8:白色
-	
+
+	private Integer colorId;//产品颜色id
+	private List<SalesUserGift> salesUserGiftList; //赠品集合
 
 	
 	public Integer getProductType() {
@@ -157,6 +162,20 @@ public class CartDto implements Serializable{
 	public void setProductIntroduceImg(String productIntroduceImg) {
 		this.productIntroduceImg = productIntroduceImg;
 	}
-	
-	
+
+	public List<SalesUserGift> getSalesUserGiftList() {
+		return salesUserGiftList;
+	}
+
+	public void setSalesUserGiftList(List<SalesUserGift> salesUserGiftList) {
+		this.salesUserGiftList = salesUserGiftList;
+	}
+
+	public Integer getColorId() {
+		return colorId;
+	}
+
+	public void setColorId(Integer colorId) {
+		this.colorId = colorId;
+	}
 }

+ 9 - 0
iamberry-common-core/src/main/java/com/iamberry/wechat/core/entity/product/SalesUserGift.java

@@ -17,6 +17,7 @@ public class SalesUserGift implements java.io.Serializable {
     private Integer userGiftCount;      //赠送产品数量
     private Integer userStatus;         //状态    1:使用,2:停用
     private Date userCreateTime;        //创建时间
+    private String productName;        //产品名称
 
     public Integer getUserId() {
         return userId;
@@ -81,4 +82,12 @@ public class SalesUserGift implements java.io.Serializable {
     public void setUserCreateTime(Date userCreateTime) {
         this.userCreateTime = userCreateTime;
     }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
 }

+ 38 - 3
iamberry-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/cartMapper.xml

@@ -7,12 +7,45 @@ PUBLIC
 	namespace:必须与对应的接口全类名一致
  -->
 <mapper namespace="com.iamberry.wechat.service.mapper.CartMapper">
+	<resultMap id="cartMap" type="CartDto">
+		<id column="cart_id" property="cartId"/>
+		<result column="CART_PRODUCT_ID" property="cartProductId"/>
+		<result column="CART_NUM" property="cartNum"/>
+		<result column="PRODUCT_NAME" property="productName"/>
+		<result column="color_discount" property="productPrice"/>
+		<result column="PRODUCT_STATUS" property="productStatus"/>
+		<result column="color_name" property="productColor"/>
+		<result column="color_product_pic" property="productIntroduceImg"/>
+		<result column="PRODUCT_REMARK" property="productRemark"/>
+		<result column="color_id" property="colorId"/>
+		<collection property="salesUserGiftList" column="color_id" ofType="SalesUserGift" select="listGift"/>
+	</resultMap>
+
+	<select id="listGift" resultType="salesUserGiftList" parameterType="Integer">
+		SELECT
+			ug.user_id userId,
+			ug.user_product_id userProductId,
+			ug.user_color_id userColorId,
+			ug.user_gift_id userGiftId,
+			ug.user_gift_color userGiftColor,
+			ug.user_gift_count userGiftCount,
+			ug.user_status userStatus,
+			ug.user_status userCreateTime,
+			pi.product_name productName
+		FROM
+			tb_iamberry_sales_user_gift ug
+		LEFT JOIN tb_iamberry_product_color pc on pc.color_id = 1
+		LEFT JOIN tb_iamberry_product_info pi on pi.product_id = pc.color_product_id
+		WHERE
+			ug.user_color_id = 1
+	</select>
+
 	<!-- 查询用户购物车所有信息 -->
-	<select id="selectCartByOpenId" parameterType="String" resultType="CartDto">
+	<select id="selectCartByOpenId" parameterType="String" resultMap="cartMap">
 		SELECT 
 			C.CART_ID cartId, C.CART_PRODUCT_ID cartProductId, C.CART_NUM cartNum,P.PRODUCT_NAME productName,
 			pc.color_discount productPrice, P.PRODUCT_STATUS productStatus, pc.color_name productColor,
-			pc.color_product_pic productIntroduceImg, PRODUCT_REMARK productRemark
+			pc.color_product_pic productIntroduceImg, PRODUCT_REMARK productRemark,pc.color_id colorId
 		FROM 
 			TB_IAMBERRY_SHOP_CART C
 			LEFT JOIN TB_IAMBERRY_PRODUCT_INFO P ON C.CART_PRODUCT_ID = P.PRODUCT_ID
@@ -21,7 +54,9 @@ PUBLIC
 			C.CART_OPENID = #{openId} 
 		ORDER BY C.CART_ID DESC 
 	</select>
-	
+
+
+
 	<select id="getCartNumByCartOpenId" parameterType="String" resultType="Integer">
 		SELECT 
 			COUNT(C.CART_ID) 

+ 2 - 2
iamberry-wechat-web/src/main/resources/iamberry-wechat-service-mybatis.xml

@@ -133,7 +133,7 @@
 		<typeAlias type="com.iamberry.wechat.core.entity.wx.ZTreeBean" alias="ZTreeBean"/>
 		<typeAlias type="com.iamberry.wechat.core.entity.drp.ApplyPlaceLogs" alias="ApplyPlaceLogs"/>
 		<typeAlias type="com.iamberry.wechat.core.entity.wx.WechatShare" alias="WechatShare"/>
-	
+
 		<!-- 【门店关注统计报表类】 -->
 		<typeAlias type="com.iamberry.wechat.core.entity.statictics.AttentionInfo" alias="AttentionInfo"/>
 		<typeAlias type="com.iamberry.wechat.core.entity.statictics.MarketInfo" alias="MarketInfo"/>
@@ -147,7 +147,7 @@
 		<typeAlias type="com.iamberry.wechat.core.entity.product.ProductType" alias="ProductType"/>
 		<!-- 【统计总信息类】 -->
 		<typeAlias type="com.iamberry.wechat.core.entity.statictics.StatisticsInfo" alias="StatisticsInfo"/>
-		
+
 		<!-- 定期任务 -->
 		<typeAlias type="com.iamberry.wechat.core.entity.task.WechatTask" alias="WechatTask"/>
 		<typeAlias type="com.iamberry.wechat.core.entity.task.WechatTaskLogs" alias="WechatTaskLogs"/>