ytf пре 2 година
родитељ
комит
eccbb5ec2f

+ 54 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/example/LiveGoodsExample.java

@@ -0,0 +1,54 @@
1
+package com.slodon.b2b2c.live.example;
2
+
3
+import com.slodon.b2b2c.core.response.PagerInfo;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Data;
6
+
7
+import java.io.Serializable;
8
+
9
+@Data
10
+public class LiveGoodsExample implements Serializable {
11
+    @ApiModelProperty(value = "填入mediaID 图片 mediaID 的获取,https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html",required = true)
12
+    private String coverImgUrl;
13
+    @ApiModelProperty(value = "商品名称,最长14个汉字,1个汉字相当于2个字符",required = true)
14
+    private String name;
15
+    @ApiModelProperty(value = "价格类型,1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)",required = true)
16
+    private Integer priceType;
17
+    @ApiModelProperty(value = "数字,最多保留两位小数,单位元",required = true)
18
+    private String price;
19
+    @ApiModelProperty("数字,最多保留两位小数,单位元")
20
+    private String price2;
21
+    @ApiModelProperty(value = "商品详情页的小程序路径,路径参数存在 url 的,该参数的值需要进行 encode 处理再填入",required = true)
22
+    private String url;
23
+    @ApiModelProperty("当商品为第三方小程序的商品则填写为对应第三方小程序的appid,自身小程序商品则为")
24
+    private String thirdPartyAppid;
25
+    @ApiModelProperty("商户ID")
26
+    private String vendorId;
27
+    @ApiModelProperty("本地goods表商品ID")
28
+    private String localGoodsId;
29
+    @ApiModelProperty("商品间状态。0:未审核,1:审核中,2:审核通过,3审核失败")
30
+    private Integer auditStatus;
31
+
32
+    //==========================微信接口需要装换的参数==============================
33
+    @ApiModelProperty("商品ID")
34
+    private Integer goodsId;
35
+    @ApiModelProperty("审核单ID")
36
+    private Integer auditId;
37
+
38
+
39
+    //=====================mybatis需要字段============================
40
+    /**
41
+     * 排序条件,条件之间用逗号隔开,如果不传则按照goodsId倒序排列
42
+     */
43
+    private String orderBy;
44
+
45
+    /**
46
+     * 分组条件
47
+     */
48
+    private String groupBy;
49
+
50
+    /**
51
+     * 分页信息
52
+     */
53
+    private PagerInfo pager;
54
+}

+ 38 - 0
b2b2c/b2b2c-entity/src/main/java/com/slodon/b2b2c/live/pojo/LiveGoods.java

@@ -0,0 +1,38 @@
1
+package com.slodon.b2b2c.live.pojo;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Data;
5
+
6
+import java.io.Serializable;
7
+
8
+@Data
9
+public class LiveGoods implements Serializable {
10
+    @ApiModelProperty(value = "填入mediaID 图片 mediaID 的获取,https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html",required = true)
11
+    private String coverImgUrl;
12
+    @ApiModelProperty(value = "商品名称,最长14个汉字,1个汉字相当于2个字符",required = true)
13
+    private String name;
14
+    @ApiModelProperty(value = "价格类型,1:一口价(只需要传入price,price2不传) 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传) 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)",required = true)
15
+    private Integer priceType = 1;
16
+    @ApiModelProperty(value = "数字,最多保留两位小数,单位元",required = true)
17
+    private String price;
18
+    @ApiModelProperty("数字,最多保留两位小数,单位元")
19
+    private String price2;
20
+    @ApiModelProperty(value = "商品详情页的小程序路径,路径参数存在 url 的,该参数的值需要进行 encode 处理再填入",required = true)
21
+    private String url;
22
+    @ApiModelProperty("当商品为第三方小程序的商品则填写为对应第三方小程序的appid,自身小程序商品则为")
23
+    private String thirdPartyAppid;
24
+    @ApiModelProperty("商户ID")
25
+    private String vendorId;
26
+    @ApiModelProperty("本地goods表商品ID")
27
+    private String localGoodsId;
28
+    @ApiModelProperty("商品间状态。0:未审核,1:审核中,2:审核通过,3审核失败")
29
+    private Integer auditStatus;
30
+    @ApiModelProperty("商品间状态名称。0:未审核,1:审核中,2:审核通过,3审核失败")
31
+    private String auditStatusName;
32
+
33
+    //==========================微信接口需要装换的参数==============================
34
+    @ApiModelProperty("商品ID")
35
+    private Integer goodsId;
36
+    @ApiModelProperty("审核单ID")
37
+    private Integer auditId;
38
+}

+ 16 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/dao/write/live/LiveGoodsWriteMapper.java

@@ -0,0 +1,16 @@
1
+package com.slodon.b2b2c.dao.write.live;
2
+
3
+import com.slodon.b2b2c.core.database.BaseWriteMapper;
4
+import com.slodon.b2b2c.live.example.LiveGoodsExample;
5
+import com.slodon.b2b2c.live.pojo.LiveGoods;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+public interface LiveGoodsWriteMapper extends BaseWriteMapper<LiveGoods, LiveGoodsExample> {
11
+    List<Integer> getLivesGoodsIds();
12
+
13
+    void updateLivesGoodsType(@Param("liveGoodsList") List<LiveGoods> liveGoodsList);
14
+
15
+    List<LiveGoods> getListRelation(@Param("name")String name, @Param("roomId")Integer roomId);
16
+}

+ 61 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/model/live/LiveGoodsModel.java

@@ -0,0 +1,61 @@
1
+package com.slodon.b2b2c.model.live;
2
+
3
+import com.slodon.b2b2c.core.response.PagerInfo;
4
+import com.slodon.b2b2c.dao.write.live.LiveGoodsWriteMapper;
5
+import com.slodon.b2b2c.live.dto.LiveGoodsInfoDto;
6
+import com.slodon.b2b2c.live.example.LiveBroadcastExample;
7
+import com.slodon.b2b2c.live.example.LiveGoodsExample;
8
+import com.slodon.b2b2c.live.pojo.LiveBroadcast;
9
+import com.slodon.b2b2c.live.pojo.LiveGoods;
10
+import lombok.extern.slf4j.Slf4j;
11
+import org.apache.commons.beanutils.PropertyUtils;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.stereotype.Component;
14
+
15
+import java.util.List;
16
+
17
+@Component
18
+@Slf4j
19
+public class LiveGoodsModel {
20
+
21
+    @Autowired
22
+    private LiveGoodsWriteMapper liveGoodsWriteMapper;
23
+
24
+    public void addGoodsCreate(LiveGoodsInfoDto liveGoodsInfoDto) {
25
+
26
+        LiveGoods liveGoods = new LiveGoods();
27
+        try {
28
+            PropertyUtils.copyProperties(liveGoods,liveGoodsInfoDto);
29
+        } catch (Exception e) {
30
+            e.printStackTrace();
31
+        }
32
+        liveGoodsWriteMapper.insert(liveGoods);
33
+    }
34
+
35
+    public List<LiveGoods> getLivesList(LiveGoodsExample example, PagerInfo pager) {
36
+        List<LiveGoods> goodsList;
37
+        if (pager != null) {
38
+            pager.setRowsCount(liveGoodsWriteMapper.countByExample(example));
39
+            goodsList = liveGoodsWriteMapper.listPageByExample(example, pager.getStart(), pager.getPageSize());
40
+        } else {
41
+            goodsList = liveGoodsWriteMapper.listByExample(example);
42
+        }
43
+        return goodsList;
44
+    }
45
+
46
+    public void wxDelLiveGood(Integer goodsId) {
47
+        liveGoodsWriteMapper.deleteByPrimaryKey(goodsId);
48
+    }
49
+
50
+    public List<Integer> getLivesGoodsIds() {
51
+        return liveGoodsWriteMapper.getLivesGoodsIds();
52
+    }
53
+
54
+    public void updateLivesGoodsType(List<LiveGoods> liveGoodsList) {
55
+        liveGoodsWriteMapper.updateLivesGoodsType(liveGoodsList);
56
+    }
57
+
58
+    public List<LiveGoods> getListRelation(String name, Integer roomId) {
59
+        return liveGoodsWriteMapper.getListRelation(name,roomId);
60
+    }
61
+}

+ 48 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/model/live/LiveJobModel.java

@@ -0,0 +1,48 @@
1
+package com.slodon.b2b2c.model.live;
2
+
3
+import com.slodon.b2b2c.core.response.PagerInfo;
4
+import com.slodon.b2b2c.dao.write.live.LiveBroadWriteMapper;
5
+import com.slodon.b2b2c.live.dto.LiveBroadcastDto;
6
+import com.slodon.b2b2c.live.example.LiveBroadcastExample;
7
+import com.slodon.b2b2c.live.pojo.LiveBroadcast;
8
+import com.slodon.b2b2c.live.vo.LivesVO;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.apache.commons.beanutils.PropertyUtils;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.stereotype.Component;
13
+
14
+import java.util.List;
15
+
16
+@Component
17
+@Slf4j
18
+public class LiveJobModel {
19
+
20
+    @Autowired
21
+    private LiveBroadWriteMapper liveBroadWriteMapper;
22
+
23
+    /**
24
+     * 查找需要更新状态的直播间起始位置  起始房间,0表示从第1个房间开始拉取
25
+     * @return
26
+     * @param roomId
27
+     */
28
+    public Integer getLivesNum(Integer roomId) {
29
+        return liveBroadWriteMapper.getLivesNum(roomId);
30
+    }
31
+
32
+
33
+    public void updateLivesType(List<LivesVO> livesVOS) {
34
+        liveBroadWriteMapper.updateLivesType(livesVOS);
35
+    }
36
+
37
+    /**
38
+     * 获取总数
39
+     * @return
40
+     */
41
+    public Integer getLiveCount() {
42
+        return liveBroadWriteMapper.countByExample(new LiveBroadcastExample());
43
+    }
44
+
45
+    public Integer getLiveRoomId() {
46
+        return liveBroadWriteMapper.getLiveRoomId();
47
+    }
48
+}

+ 53 - 0
b2b2c/b2b2c-web/src/main/java/com/slodon/b2b2c/util/ThumbnailsUtils.java

@@ -0,0 +1,53 @@
1
+package com.slodon.b2b2c.util;
2
+import net.coobird.thumbnailator.Thumbnails;
3
+import org.slf4j.Logger;
4
+import org.slf4j.LoggerFactory;
5
+import javax.imageio.ImageIO;
6
+import java.awt.image.BufferedImage;
7
+import java.io.ByteArrayInputStream;
8
+import java.io.ByteArrayOutputStream;
9
+import java.io.IOException;
10
+public class ThumbnailsUtils{
11
+    private static final Logger logger = LoggerFactory.getLogger(ThumbnailsUtils.class);
12
+    /**
13
+     * 通过BufferedImage图片流调整图片大小
14
+     */
15
+    public static BufferedImage resizeImageOne(BufferedImage originalImage, int targetWidth, int targetHeight) throws Exception {
16
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
17
+        Thumbnails.of(originalImage)
18
+                .size(targetWidth, targetHeight)
19
+                .outputFormat("JPEG")
20
+                .keepAspectRatio(false)
21
+                .outputQuality(1)
22
+                .toOutputStream(outputStream);
23
+        byte[] data = outputStream.toByteArray();
24
+        ByteArrayInputStream inputStream = new ByteArrayInputStream(data);
25
+        return ImageIO.read(inputStream);
26
+    }
27
+
28
+    /**
29
+     * BufferedImage图片流转byte[]数组
30
+     */
31
+    public static byte[] imageToBytes(BufferedImage bImage) {
32
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
33
+        try {
34
+            ImageIO.write(bImage, "jpg", out);
35
+        } catch (IOException e) {
36
+            logger.error("错误信息: ", e);
37
+        }
38
+        return out.toByteArray();
39
+    }
40
+    /**
41
+     * byte[]数组转BufferedImage图片流
42
+     */
43
+    private static BufferedImage bytesToBufferedImage(byte[] ImageByte) {
44
+        ByteArrayInputStream in = new ByteArrayInputStream(ImageByte);
45
+        BufferedImage image = null;
46
+        try {
47
+            image = ImageIO.read(in);
48
+        } catch (IOException e) {
49
+            logger.error("错误信息: ", e);
50
+        }
51
+        return image;
52
+    }
53
+}

+ 354 - 0
b2b2c/b2b2c-web/src/main/resources/mapper/read/Live/LiveGoodsReadMapper.xml

@@ -0,0 +1,354 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.slodon.b2b2c.dao.write.live.LiveGoodsWriteMapper">
4
+  <resultMap id="resultMap" type="com.slodon.b2b2c.live.pojo.LiveGoods">
5
+    <id column="goodsId" property="goodsId" />
6
+    <result column="coverImgUrl" property="coverImgUrl" />
7
+    <result column="name" property="name" />
8
+    <result column="priceType" property="priceType" />
9
+    <result column="price" property="price" />
10
+    <result column="price2" property="price2" />
11
+    <result column="url" property="url" />
12
+    <result column="thirdPartyAppid" property="thirdPartyAppid" />
13
+    <result column="vendorId" property="vendorId" />
14
+    <result column="localGoodsId" property="localGoodsId" />
15
+    <result column="auditStatus" property="auditStatus" />
16
+    <result column="auditId" property="auditId" />
17
+  </resultMap>
18
+
19
+  <!--除主键外的所有字段,用于插入操作-->
20
+  <sql id="columns">
21
+    <trim suffixOverrides=",">
22
+      <if test="goodsId != null">
23
+        goodsId,
24
+      </if>
25
+      <if test="vendorId != null">
26
+        vendorId,
27
+      </if>
28
+      <if test="name != null">
29
+        name,
30
+      </if>
31
+      <if test="coverImgUrl != null">
32
+        coverImgUrl,
33
+      </if>
34
+      <if test="priceType != null">
35
+        priceType,
36
+      </if>
37
+      <if test="price != null">
38
+        price,
39
+      </if>
40
+      <if test="price2 != null">
41
+        price2,
42
+      </if>
43
+      <if test="url != null">
44
+        url,
45
+      </if>
46
+      <if test="thirdPartyAppid != null">
47
+        thirdPartyAppid,
48
+      </if>
49
+      <if test="localGoodsId != null">
50
+        localGoodsId,
51
+      </if>
52
+      <if test="auditStatus != null">
53
+        auditStatus,
54
+      </if>
55
+      <if test="auditId != null">
56
+        auditId,
57
+      </if>
58
+    </trim>
59
+  </sql>
60
+  <!--按照主键值进行操作-->
61
+  <sql id="pkWhere">
62
+    WHERE goodsId = #{primaryKey}
63
+  </sql>
64
+  <!--操作条件-->
65
+  <sql id="whereCondition">
66
+    <if test="example != null">
67
+      <trim prefix="WHERE" prefixOverrides="AND|OR">
68
+        <if test="example.coverImgUrl != null">
69
+          AND coverImgUrl = #{example.coverImgUrl}
70
+        </if>
71
+        <if test="example.vendorId != null">
72
+          AND vendorId = #{example.vendorId}
73
+        </if>
74
+        <if test="example.name != null">
75
+          AND name like concat('%',#{example.name},'%')
76
+        </if>
77
+        <if test="example.priceType != null">
78
+          AND priceType = #{example.priceType}
79
+        </if>
80
+        <if test="example.price != null">
81
+          AND price = #{example.price}
82
+        </if>
83
+        <if test="example.price2 != null">
84
+          AND price2 = #{example.price2}
85
+        </if>
86
+        <if test="example.url != null">
87
+          AND url = #{example.url}
88
+        </if>
89
+        <if test="example.thirdPartyAppid != null">
90
+          AND thirdPartyAppid = #{example.thirdPartyAppid}
91
+        </if>
92
+        <if test="example.localGoodsId != null">
93
+          AND localGoodsId = #{example.localGoodsId}
94
+        </if>
95
+        <if test="example.auditStatus != null">
96
+          AND auditStatus = #{example.auditStatus}
97
+        </if>
98
+        <if test="example.goodsId != null">
99
+          AND goodsId = #{example.goodsId}
100
+        </if>
101
+        <if test="example.auditId != null">
102
+          AND auditId = #{example.auditId}
103
+        </if>
104
+
105
+      </trim>
106
+    </if>
107
+  </sql>
108
+  <!--排序条件-->
109
+  <sql id="orderBy">
110
+    ORDER BY goodsId DESC
111
+  </sql>
112
+  <sql id="orderByOther">
113
+    order by #{example.orderBy}
114
+  </sql>
115
+  <!--分组条件-->
116
+  <sql id="groupBy">
117
+    group by #{example.groupBy}
118
+  </sql>
119
+  <!--分页条件-->
120
+  <sql id="limit">
121
+    <if test="size != null and size &gt; 0">
122
+      limit #{startRow},#{size}
123
+    </if>
124
+  </sql>
125
+  <!--查询符合条件的记录数-->
126
+  <select id="countByExample" parameterType="com.slodon.b2b2c.live.example.LiveGoodsExample" resultType="java.lang.Integer">
127
+    SELECT
128
+      COUNT(*)
129
+    FROM live_goods
130
+    <include refid="whereCondition" />
131
+  </select>
132
+  <!--根据主键查询记录-->
133
+  <select id="getByPrimaryKey" resultMap="resultMap">
134
+    SELECT
135
+      *
136
+    FROM live_goods
137
+    <include refid="pkWhere" />
138
+  </select>
139
+  <!--查询符合条件的记录(所有字段)-->
140
+  <select id="listByExample" resultMap="resultMap">
141
+    SELECT
142
+      *
143
+    FROM live_goods
144
+    <include refid="whereCondition" />
145
+    <if test="example.groupBy != null">
146
+      <include refid="groupBy" />
147
+    </if>
148
+    <choose>
149
+      <when test="example.orderBy != null">
150
+        <include refid="orderByOther" />
151
+      </when>
152
+      <otherwise>
153
+        <include refid="orderBy" />
154
+      </otherwise>
155
+    </choose>
156
+  </select>
157
+  <!--分页查询符合条件的记录(所有字段)-->
158
+  <select id="listPageByExample" resultMap="resultMap">
159
+    SELECT
160
+      *
161
+    FROM live_goods
162
+    <include refid="whereCondition" />
163
+    <if test="example.groupBy != null">
164
+      <include refid="groupBy" />
165
+    </if>
166
+    <choose>
167
+      <when test="example.orderBy != null">
168
+        <include refid="orderByOther" />
169
+      </when>
170
+      <otherwise>
171
+        <include refid="orderBy" />
172
+      </otherwise>
173
+    </choose>
174
+    <include refid="limit" />
175
+  </select>
176
+  <!--查询符合条件的记录(指定字段)-->
177
+  <select id="listFieldsByExample" resultMap="resultMap">
178
+    SELECT
179
+      #{fields}
180
+    FROM live_goods
181
+    <include refid="whereCondition" />
182
+    <if test="example.groupBy != null">
183
+      <include refid="groupBy" />
184
+    </if>
185
+    <choose>
186
+      <when test="example.orderBy != null">
187
+        <include refid="orderByOther" />
188
+      </when>
189
+      <otherwise>
190
+        <include refid="orderBy" />
191
+      </otherwise>
192
+    </choose>
193
+  </select>
194
+  <!--分页查询符合条件的记录(指定字段)-->
195
+  <select id="listFieldsPageByExample" resultMap="resultMap">
196
+    SELECT
197
+      #{fields}
198
+    FROM live_goods
199
+    <include refid="whereCondition" />
200
+    <if test="example.groupBy != null">
201
+      <include refid="groupBy" />
202
+    </if>
203
+    <choose>
204
+      <when test="example.orderBy != null">
205
+        <include refid="orderByOther" />
206
+      </when>
207
+      <otherwise>
208
+        <include refid="orderBy" />
209
+      </otherwise>
210
+    </choose>
211
+    <include refid="limit" />
212
+  </select>
213
+  <!--根据条件删除记录,可多条删除-->
214
+  <delete id="deleteByExample">
215
+    DELETE FROM live_goods
216
+    <include refid="whereCondition" />
217
+  </delete>
218
+  <!--根据主键删除记录-->
219
+  <delete id="deleteByPrimaryKey">
220
+    DELETE FROM live_goods
221
+    <include refid="pkWhere" />
222
+  </delete>
223
+  <!--插入一条记录-->
224
+  <insert id="insert" keyColumn="roomId" keyProperty="roomId" parameterType="com.slodon.b2b2c.live.pojo.LiveGoods" useGeneratedKeys="true">
225
+    INSERT INTO live_goods(
226
+    <include refid="columns" />
227
+    )
228
+    VALUES(
229
+    <trim suffixOverrides=",">
230
+      <if test="goodsId != null">
231
+        #{goodsId},
232
+      </if>
233
+      <if test="vendorId != null">
234
+        #{vendorId},
235
+      </if>
236
+      <if test="name != null">
237
+        #{name},
238
+      </if>
239
+      <if test="coverImgUrl != null">
240
+        #{coverImgUrl},
241
+      </if>
242
+      <if test="priceType != null">
243
+        #{priceType},
244
+      </if>
245
+      <if test="price != null">
246
+        #{price},
247
+      </if>
248
+      <if test="price2 != null">
249
+        #{price2},
250
+      </if>
251
+      <if test="url != null">
252
+        #{url},
253
+      </if>
254
+      <if test="thirdPartyAppid != null">
255
+        #{thirdPartyAppid},
256
+      </if>
257
+      <if test="localGoodsId != null">
258
+        #{localGoodsId},
259
+      </if>
260
+      <if test="auditStatus != null">
261
+        #{auditStatus},
262
+      </if>
263
+      <if test="auditId != null">
264
+        #{auditId},
265
+      </if>
266
+
267
+    </trim>
268
+    )
269
+  </insert>
270
+  <!--按条件更新记录中不为空的字段-->
271
+  <update id="updateByExampleSelective">
272
+    UPDATE live_goods
273
+    <trim prefix="SET" suffixOverrides=",">
274
+      <if test="record.goodsId != null">
275
+        AND goodsId = #{record.goodsId},
276
+      </if>
277
+      <if test="record.vendorId != null">
278
+        AND vendorId = #{record.vendorId},
279
+      </if>
280
+      <if test="record.name != null">
281
+        AND name = #{record.name},
282
+      </if>
283
+      <if test="record.coverImgUrl != null">
284
+        AND coverImgUrl = #{record.coverImgUrl},
285
+      </if>
286
+      <if test="record.priceType != null">
287
+        AND priceType = #{record.priceType},
288
+      </if>
289
+      <if test="record.price != null">
290
+        AND price = #{record.price},
291
+      </if>
292
+      <if test="record.price2 != null">
293
+        AND price2 = #{record.price2},
294
+      </if>
295
+      <if test="record.url != null">
296
+        AND url = #{record.url},
297
+      </if>
298
+      <if test="record.thirdPartyAppid != null">
299
+        AND thirdPartyAppid = #{record.thirdPartyAppid},
300
+      </if>
301
+      <if test="record.localGoodsId != null">
302
+        AND localGoodsId = #{record.localGoodsId},
303
+      </if>
304
+      <if test="record.auditStatus != null">
305
+        AND auditStatus = #{record.auditStatus},
306
+      </if>
307
+      <if test="record.auditId != null">
308
+        AND auditId = #{record.auditId},
309
+      </if>
310
+
311
+    </trim>
312
+    <include refid="whereCondition" />
313
+  </update>
314
+  <!--按照主键更新记录中不为空的字段-->
315
+  <update id="updateByPrimaryKeySelective">
316
+    UPDATE live_goods
317
+    <trim prefix="SET" suffixOverrides=",">
318
+      <if test="vendorId != null">
319
+        AND vendorId = #{vendorId},
320
+      </if>
321
+      <if test="name != null">
322
+        AND name = #{name},
323
+      </if>
324
+      <if test="coverImgUrl != null">
325
+        AND coverImgUrl = #{coverImgUrl},
326
+      </if>
327
+      <if test="priceType != null">
328
+        AND priceType = #{priceType},
329
+      </if>
330
+      <if test="price != null">
331
+        AND price = #{price},
332
+      </if>
333
+      <if test="price2 != null">
334
+        AND price2 = #{price2},
335
+      </if>
336
+      <if test="url != null">
337
+        AND url = #{url},
338
+      </if>
339
+      <if test="thirdPartyAppid != null">
340
+        AND thirdPartyAppid = #{thirdPartyAppid},
341
+      </if>
342
+      <if test="localGoodsId != null">
343
+        AND localGoodsId = #{localGoodsId},
344
+      </if>
345
+      <if test="auditStatus != null">
346
+        AND auditStatus = #{auditStatus},
347
+      </if>
348
+      <if test="auditId != null">
349
+        AND auditId = #{auditId},
350
+      </if>
351
+    </trim>
352
+    WHERE goodsId = #{goodsId}
353
+  </update>
354
+</mapper>

+ 372 - 0
b2b2c/b2b2c-web/src/main/resources/mapper/write/Live/LiveGoodsWriteMapper.xml

@@ -0,0 +1,372 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.slodon.b2b2c.dao.write.live.LiveGoodsWriteMapper">
4
+  <resultMap id="resultMap" type="com.slodon.b2b2c.live.pojo.LiveGoods">
5
+    <id column="goodsId" property="goodsId" />
6
+    <result column="coverImgUrl" property="coverImgUrl" />
7
+    <result column="name" property="name" />
8
+    <result column="priceType" property="priceType" />
9
+    <result column="price" property="price" />
10
+    <result column="price2" property="price2" />
11
+    <result column="url" property="url" />
12
+    <result column="thirdPartyAppid" property="thirdPartyAppid" />
13
+    <result column="vendorId" property="vendorId" />
14
+    <result column="localGoodsId" property="localGoodsId" />
15
+    <result column="auditStatus" property="auditStatus" />
16
+    <result column="auditId" property="auditId" />
17
+  </resultMap>
18
+
19
+  <!--除主键外的所有字段,用于插入操作-->
20
+  <sql id="columns">
21
+    <trim suffixOverrides=",">
22
+      <if test="goodsId != null">
23
+        goodsId,
24
+      </if>
25
+      <if test="vendorId != null">
26
+        vendorId,
27
+      </if>
28
+      <if test="name != null">
29
+        name,
30
+      </if>
31
+      <if test="coverImgUrl != null">
32
+        coverImgUrl,
33
+      </if>
34
+      <if test="priceType != null">
35
+        priceType,
36
+      </if>
37
+      <if test="price != null">
38
+        price,
39
+      </if>
40
+      <if test="price2 != null">
41
+        price2,
42
+      </if>
43
+      <if test="url != null">
44
+        url,
45
+      </if>
46
+      <if test="thirdPartyAppid != null">
47
+        thirdPartyAppid,
48
+      </if>
49
+      <if test="localGoodsId != null">
50
+        localGoodsId,
51
+      </if>
52
+      <if test="auditStatus != null">
53
+        auditStatus,
54
+      </if>
55
+      <if test="auditId != null">
56
+        auditId,
57
+      </if>
58
+    </trim>
59
+  </sql>
60
+  <!--按照主键值进行操作-->
61
+  <sql id="pkWhere">
62
+    WHERE goodsId = #{primaryKey}
63
+  </sql>
64
+  <!--操作条件-->
65
+  <sql id="whereCondition">
66
+    <if test="example != null">
67
+      <trim prefix="WHERE" prefixOverrides="AND|OR">
68
+        <if test="example.coverImgUrl != null">
69
+          AND coverImgUrl = #{example.coverImgUrl}
70
+        </if>
71
+        <if test="example.vendorId != null">
72
+          AND vendorId = #{example.vendorId}
73
+        </if>
74
+        <if test="example.name != null">
75
+          AND name like concat('%',#{example.name},'%')
76
+        </if>
77
+        <if test="example.priceType != null">
78
+          AND priceType = #{example.priceType}
79
+        </if>
80
+        <if test="example.price != null">
81
+          AND price = #{example.price}
82
+        </if>
83
+        <if test="example.price2 != null">
84
+          AND price2 = #{example.price2}
85
+        </if>
86
+        <if test="example.url != null">
87
+          AND url = #{example.url}
88
+        </if>
89
+        <if test="example.thirdPartyAppid != null">
90
+          AND thirdPartyAppid = #{example.thirdPartyAppid}
91
+        </if>
92
+        <if test="example.localGoodsId != null">
93
+          AND localGoodsId = #{example.localGoodsId}
94
+        </if>
95
+        <if test="example.auditStatus != null">
96
+          AND auditStatus = #{example.auditStatus}
97
+        </if>
98
+        <if test="example.goodsId != null">
99
+          AND goodsId = #{example.goodsId}
100
+        </if>
101
+        <if test="example.auditId != null">
102
+          AND auditId = #{example.auditId}
103
+        </if>
104
+
105
+      </trim>
106
+    </if>
107
+  </sql>
108
+  <!--排序条件-->
109
+  <sql id="orderBy">
110
+    ORDER BY goodsId DESC
111
+  </sql>
112
+  <sql id="orderByOther">
113
+    order by #{example.orderBy}
114
+  </sql>
115
+  <!--分组条件-->
116
+  <sql id="groupBy">
117
+    group by #{example.groupBy}
118
+  </sql>
119
+  <!--分页条件-->
120
+  <sql id="limit">
121
+    <if test="size != null and size &gt; 0">
122
+      limit #{startRow},#{size}
123
+    </if>
124
+  </sql>
125
+  <!--查询符合条件的记录数-->
126
+  <select id="countByExample" parameterType="com.slodon.b2b2c.live.example.LiveGoodsExample" resultType="java.lang.Integer">
127
+    SELECT
128
+    COUNT(*)
129
+    FROM live_goods
130
+    <include refid="whereCondition" />
131
+  </select>
132
+  <!--根据主键查询记录-->
133
+  <select id="getByPrimaryKey" resultMap="resultMap">
134
+    SELECT
135
+    *
136
+    FROM live_goods
137
+    <include refid="pkWhere" />
138
+  </select>
139
+  <!--查询符合条件的记录(所有字段)-->
140
+  <select id="listByExample" resultMap="resultMap">
141
+    SELECT
142
+    *
143
+    FROM live_goods
144
+    <include refid="whereCondition" />
145
+    <if test="example.groupBy != null">
146
+      <include refid="groupBy" />
147
+    </if>
148
+    <choose>
149
+      <when test="example.orderBy != null">
150
+        <include refid="orderByOther" />
151
+      </when>
152
+      <otherwise>
153
+        <include refid="orderBy" />
154
+      </otherwise>
155
+    </choose>
156
+  </select>
157
+  <!--分页查询符合条件的记录(所有字段)-->
158
+  <select id="listPageByExample" resultMap="resultMap">
159
+    SELECT
160
+    *
161
+    FROM live_goods
162
+    <include refid="whereCondition" />
163
+    <if test="example.groupBy != null">
164
+      <include refid="groupBy" />
165
+    </if>
166
+    <choose>
167
+      <when test="example.orderBy != null">
168
+        <include refid="orderByOther" />
169
+      </when>
170
+      <otherwise>
171
+        <include refid="orderBy" />
172
+      </otherwise>
173
+    </choose>
174
+    <include refid="limit" />
175
+  </select>
176
+  <!--查询符合条件的记录(指定字段)-->
177
+  <select id="listFieldsByExample" resultMap="resultMap">
178
+    SELECT
179
+    #{fields}
180
+    FROM live_goods
181
+    <include refid="whereCondition" />
182
+    <if test="example.groupBy != null">
183
+      <include refid="groupBy" />
184
+    </if>
185
+    <choose>
186
+      <when test="example.orderBy != null">
187
+        <include refid="orderByOther" />
188
+      </when>
189
+      <otherwise>
190
+        <include refid="orderBy" />
191
+      </otherwise>
192
+    </choose>
193
+  </select>
194
+  <!--分页查询符合条件的记录(指定字段)-->
195
+  <select id="listFieldsPageByExample" resultMap="resultMap">
196
+    SELECT
197
+    #{fields}
198
+    FROM live_goods
199
+    <include refid="whereCondition" />
200
+    <if test="example.groupBy != null">
201
+      <include refid="groupBy" />
202
+    </if>
203
+    <choose>
204
+      <when test="example.orderBy != null">
205
+        <include refid="orderByOther" />
206
+      </when>
207
+      <otherwise>
208
+        <include refid="orderBy" />
209
+      </otherwise>
210
+    </choose>
211
+    <include refid="limit" />
212
+  </select>
213
+    <select id="getLivesGoodsIds" resultType="java.lang.Integer">
214
+        select goodsId from live_goods where auditStatus = 1
215
+    </select>
216
+  <select id="getListRelation" resultMap="resultMap">
217
+        select lg.* from live_goods_relation rel
218
+        left join live_goods lg on rel.goodsId = lg.goodsId
219
+        where rel.roomId = #{roomId}
220
+        <if test="name != null">
221
+          AND lg.name = #{name}
222
+        </if>
223
+  </select>
224
+  <!--根据条件删除记录,可多条删除-->
225
+  <delete id="deleteByExample">
226
+    DELETE FROM live_goods
227
+    <include refid="whereCondition" />
228
+  </delete>
229
+  <!--根据主键删除记录-->
230
+  <delete id="deleteByPrimaryKey">
231
+    DELETE FROM live_goods
232
+    <include refid="pkWhere" />
233
+  </delete>
234
+  <!--插入一条记录-->
235
+  <insert id="insert" keyColumn="roomId" keyProperty="roomId" parameterType="com.slodon.b2b2c.live.pojo.LiveGoods" useGeneratedKeys="true">
236
+    INSERT INTO live_goods(
237
+    <include refid="columns" />
238
+    )
239
+    VALUES(
240
+    <trim suffixOverrides=",">
241
+      <if test="goodsId != null">
242
+        #{goodsId},
243
+      </if>
244
+      <if test="vendorId != null">
245
+        #{vendorId},
246
+      </if>
247
+      <if test="name != null">
248
+        #{name},
249
+      </if>
250
+      <if test="coverImgUrl != null">
251
+        #{coverImgUrl},
252
+      </if>
253
+      <if test="priceType != null">
254
+        #{priceType},
255
+      </if>
256
+      <if test="price != null">
257
+        #{price},
258
+      </if>
259
+      <if test="price2 != null">
260
+        #{price2},
261
+      </if>
262
+      <if test="url != null">
263
+        #{url},
264
+      </if>
265
+      <if test="thirdPartyAppid != null">
266
+        #{thirdPartyAppid},
267
+      </if>
268
+      <if test="localGoodsId != null">
269
+        #{localGoodsId},
270
+      </if>
271
+      <if test="auditStatus != null">
272
+        #{auditStatus},
273
+      </if>
274
+      <if test="auditId != null">
275
+        #{auditId},
276
+      </if>
277
+
278
+    </trim>
279
+    )
280
+  </insert>
281
+  <!--按条件更新记录中不为空的字段-->
282
+  <update id="updateByExampleSelective">
283
+    UPDATE live_goods
284
+    <trim prefix="SET" suffixOverrides=",">
285
+      <if test="record.goodsId != null">
286
+        AND goodsId = #{record.goodsId},
287
+      </if>
288
+      <if test="record.vendorId != null">
289
+        AND vendorId = #{record.vendorId},
290
+      </if>
291
+      <if test="record.name != null">
292
+        AND name = #{record.name},
293
+      </if>
294
+      <if test="record.coverImgUrl != null">
295
+        AND coverImgUrl = #{record.coverImgUrl},
296
+      </if>
297
+      <if test="record.priceType != null">
298
+        AND priceType = #{record.priceType},
299
+      </if>
300
+      <if test="record.price != null">
301
+        AND price = #{record.price},
302
+      </if>
303
+      <if test="record.price2 != null">
304
+        AND price2 = #{record.price2},
305
+      </if>
306
+      <if test="record.url != null">
307
+        AND url = #{record.url},
308
+      </if>
309
+      <if test="record.thirdPartyAppid != null">
310
+        AND thirdPartyAppid = #{record.thirdPartyAppid},
311
+      </if>
312
+      <if test="record.localGoodsId != null">
313
+        AND localGoodsId = #{record.localGoodsId},
314
+      </if>
315
+      <if test="record.auditStatus != null">
316
+        AND auditStatus = #{record.auditStatus},
317
+      </if>
318
+      <if test="record.auditId != null">
319
+        AND auditId = #{record.auditId},
320
+      </if>
321
+
322
+    </trim>
323
+    <include refid="whereCondition" />
324
+  </update>
325
+  <!--按照主键更新记录中不为空的字段-->
326
+  <update id="updateByPrimaryKeySelective">
327
+    UPDATE live_goods
328
+    <trim prefix="SET" suffixOverrides=",">
329
+      <if test="vendorId != null">
330
+        AND vendorId = #{vendorId},
331
+      </if>
332
+      <if test="name != null">
333
+        AND name = #{name},
334
+      </if>
335
+      <if test="coverImgUrl != null">
336
+        AND coverImgUrl = #{coverImgUrl},
337
+      </if>
338
+      <if test="priceType != null">
339
+        AND priceType = #{priceType},
340
+      </if>
341
+      <if test="price != null">
342
+        AND price = #{price},
343
+      </if>
344
+      <if test="price2 != null">
345
+        AND price2 = #{price2},
346
+      </if>
347
+      <if test="url != null">
348
+        AND url = #{url},
349
+      </if>
350
+      <if test="thirdPartyAppid != null">
351
+        AND thirdPartyAppid = #{thirdPartyAppid},
352
+      </if>
353
+      <if test="localGoodsId != null">
354
+        AND localGoodsId = #{localGoodsId},
355
+      </if>
356
+      <if test="auditStatus != null">
357
+        AND auditStatus = #{auditStatus},
358
+      </if>
359
+      <if test="auditId != null">
360
+        AND auditId = #{auditId},
361
+      </if>
362
+    </trim>
363
+    WHERE goodsId = #{goodsId}
364
+  </update>
365
+  <update id="updateLivesGoodsType">
366
+    <foreach collection="liveGoodsList" item="item" index="index">
367
+      update live_goods set
368
+      auditStatus=#{item.auditStatus}
369
+      where goodsId = #{item.goodsId};
370
+    </foreach>
371
+  </update>
372
+</mapper>

+ 2 - 0
b2b2c/sql/因客户要求修改的数据.sql

@@ -0,0 +1,2 @@
1
+-- 商品迁移
2
+update goods set store_id = '360003',store_name='华阳单位集采' where id in (15,44,47,48,49,50,51,53);

+ 30 - 1
b2b2c/sql/项目修改语句.sql

@@ -77,4 +77,33 @@ update store_grade set price = '0.01';
77 77
 
78 78
 -- 直播不显示
79 79
 -- update sys_system_resource set state = 0 where front_path like '%/bussset_live%'
80
-delete from sys_system_resource where front_path like '%/bussset_live%'
80
+delete from sys_system_resource where front_path like '%/bussset_live%'
81
+
82
+-- 支付宝支付关闭
83
+update sys_setting set value = 0 where name = 'alipay_is_enable_h5';
84
+update sys_setting set value = 0 where name = 'alipay_is_enable_pc';
85
+
86
+-- 平台端短信消息模板 msg_member_tpl(会员)msg_store_tpl(商户)
87
+update msg_member_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的售后单有新的变化,退款编号:{$afsSn}。"}' where tpl_code = 'after_sale_reminder';
88
+update msg_member_tpl set sms_content = '{"templateId":"978409","templateContent":"您关注的商品:{1},马上就要开始了,请进场准备好,谢谢。"}' where tpl_code = 'appointment_reminder';
89
+update msg_member_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的账户于{$changeTime}发生了资金变动,描述:{$description},当前可用金额:{$availableBalance}元,冻结金额:{$frozenBalance}元。"}' where tpl_code = 'balance_change_reminder';
90
+update msg_member_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您有一张优惠券将于{$expireTime}过期。"}' where tpl_code = 'coupon_expired_reminder';
91
+update msg_member_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的订单:{$orderSn},已于{$deliveryTime}发货完成。"}' where tpl_code = 'goods_delivery_reminder';
92
+update msg_member_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的账户于{$changeTime}发生了积分变动,描述:{$description},当前可用积分:{$availableIntegral}。"}' where tpl_code = 'integral_change_reminder';
93
+update msg_member_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的订单:{$orderSn},已于{$paymentTime}付款成功。"}' where tpl_code = 'payment_success_reminder';
94
+
95
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您有新的结算单等待确认,开始时间:{$startTime},结束时间:{$endTime},结算单号:{$billSn}。"}' where tpl_code = 'bill_order_reminder';
96
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的结算单平台已付款,请注意查收,结算单号:{$billSn}。"}' where tpl_code = 'bill_paid_reminder';
97
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的商品没有通过审核。SPU:{$goodsName}。"}' where tpl_code = 'goods_audit_failure_reminder';
98
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的商品库存不足,请及时补货。SPU:{$goodsName},SKU:{$goodsSpec}。"}' where tpl_code = 'goods_stock_warning';
99
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的商品{$goodsName}被违规下架,原因:{$reason}。"}' where tpl_code = 'goods_violation_off_shelf_reminder';
100
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的退款单:{$refundSn}超期未处理,已自动同意买家退款申请。"}' where tpl_code = 'member_auto_refund_reminder';
101
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的退货单:{$returnSn}超期未处理,已自动同意买家退货申请。"}' where tpl_code = 'member_auto_return_reminder';
102
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您有一个退款单需要处理,退款单号:{$refundSn}。"}' where tpl_code = 'member_refund_reminder';
103
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的退货单:{$returnSn}不处理收货超期未处理,已自动按弃货处理。"}' where tpl_code = 'member_return_auto_receive_reminder';
104
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您有一个退货单需要处理,退货单号:{$returnSn}。"}' where tpl_code = 'member_return_reminder';
105
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您有一个新订单需要处理,订单号:{$orderSn}。"}' where tpl_code = 'new_order_reminder';
106
+update msg_store_tpl set sms_content = '{"templateId":"978409","templateContent":"{$siteName}您的店铺{$storeName}将于{$expireTime}到期,请尽快续签。"}' where tpl_code = 'store_end_reminder';
107
+
108
+-- 关闭推手功能
109
+update vendor_resources set state = 2 where content like '%推手%';