dingxin 6 лет назад
Родитель
Сommit
e846311643

+ 1
- 1
whole-estate/src/main/java/com/example/wholeestate/controller/BuildingController.java Просмотреть файл

@@ -90,7 +90,7 @@ public class BuildingController extends BaseController {
90 90
     @ApiOperation(value = "楼盘添加", notes = "楼盘添加")
91 91
     @ApiImplicitParams({
92 92
             @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "buildingName:楼盘名称," +
93
-                    "name:楼盘别名,price:价格,openingDate:开盘时间,coordinate:项目坐标,propertyType:物业类型,dynamic:最新动态,tel:电话")
93
+                    "name:楼盘别名,price:价格,openingDate:开盘时间,coordinate:项目坐标,propertyType:物业类型,dynamic:最新动态,tel:电话,img:[]多个图片,imgType:图片类型,orderNo:排序")
94 94
 
95 95
     })
96 96
 

+ 16
- 0
whole-estate/src/main/java/com/example/wholeestate/dao/BuildingImgMapper.java Просмотреть файл

@@ -0,0 +1,16 @@
1
+package com.example.wholeestate.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.example.wholeestate.model.BuildingImg;
5
+
6
+/**
7
+ * <p>
8
+ * 楼盘图片表 Mapper 接口
9
+ * </p>
10
+ *
11
+ * @author jobob
12
+ * @since 2019-03-21
13
+ */
14
+public interface BuildingImgMapper extends BaseMapper<BuildingImg> {
15
+
16
+}

+ 59
- 0
whole-estate/src/main/java/com/example/wholeestate/model/BuildingImg.java Просмотреть файл

@@ -0,0 +1,59 @@
1
+package com.example.wholeestate.model;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import java.time.LocalDateTime;
5
+import java.io.Serializable;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+/**
11
+ * <p>
12
+ * 楼盘图片表
13
+ * </p>
14
+ *
15
+ * @author jobob
16
+ * @since 2019-03-21
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = false)
20
+@Accessors(chain = true)
21
+@TableName("ta_building_img")
22
+public class BuildingImg implements Serializable {
23
+
24
+    private static final long serialVersionUID = 1L;
25
+
26
+    /**
27
+     * 图片ID
28
+     */
29
+    private String imgId;
30
+
31
+    /**
32
+     * 楼盘ID
33
+     */
34
+    private String buildingId;
35
+
36
+    private String imgType;
37
+
38
+    /**
39
+     * 图片地址
40
+     */
41
+    private String url;
42
+
43
+    /**
44
+     * 排序
45
+     */
46
+    private Integer orderNo;
47
+
48
+    /**
49
+     * 0正常,-1删除
50
+     */
51
+    private Integer status;
52
+
53
+    /**
54
+     * 创建时间
55
+     */
56
+    private LocalDateTime createDate;
57
+
58
+
59
+}

+ 21
- 0
whole-estate/src/main/java/com/example/wholeestate/service/impl/BuildingServiceImpl.java Просмотреть файл

@@ -1,5 +1,6 @@
1 1
 package com.example.wholeestate.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONArray;
3 4
 import com.alibaba.fastjson.JSONObject;
4 5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -8,10 +9,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 9
 import com.example.wholeestate.common.resp.ResponseBean;
9 10
 import com.example.wholeestate.common.uuid.IdGen;
10 11
 import com.example.wholeestate.dao.AppointmentMapper;
12
+import com.example.wholeestate.dao.BuildingImgMapper;
11 13
 import com.example.wholeestate.dao.BuildingMapper;
12 14
 import com.example.wholeestate.dao.CustomerMapper;
13 15
 import com.example.wholeestate.model.Appointment;
14 16
 import com.example.wholeestate.model.Building;
17
+import com.example.wholeestate.model.BuildingImg;
15 18
 import com.example.wholeestate.model.Customer;
16 19
 import com.example.wholeestate.service.IBuildingService;
17 20
 import com.fasterxml.jackson.databind.util.ArrayBuilders;
@@ -43,6 +46,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
43 46
 
44 47
     @Autowired
45 48
     private  CustomerMapper customerMapper;
49
+
50
+    @Autowired
51
+    private BuildingImgMapper buildingImgMapper;
46 52
     private IdGen idGen = IdGen.get();
47 53
 
48 54
     @Override
@@ -147,6 +153,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
147 153
 
148 154
             JSONObject object= JSONObject.parseObject(parameter);
149 155
 
156
+            JSONArray contentImg = object.getJSONArray("img");
157
+            String imgType = object.getString("imgType");
158
+            String orderNo = object.getString("orderNo");
159
+            String[] contentImgArray = contentImg.toArray(new String[]{});
150 160
             Building building = JSONObject.parseObject(parameter,Building.class);
151 161
 //            if (!"".equals(building.getBuildingId())&&null!=building.getBuildingId()){
152 162
 //                response.addError("楼盘名称不能为空");
@@ -165,6 +175,17 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
165 175
             building.setCreateDate(LocalDateTime.now());
166 176
             building.setStatus(0);
167 177
             buildingMapper.insert(building);
178
+
179
+        for (String img : contentImgArray) {
180
+            BuildingImg Images = new BuildingImg();
181
+            Images.setBuildingId(building.getBuildingId());
182
+            Images.setImgType(imgType);
183
+            Images.setUrl(img);
184
+            Images.setOrderNo(Integer.valueOf(orderNo));
185
+            Images.setStatus(0);
186
+            Images.setCreateDate(LocalDateTime.now());
187
+            buildingImgMapper.insert(Images);
188
+        }
168 189
             response.addSuccess("成功");
169 190
             return response;
170 191
         }

+ 5
- 0
whole-estate/src/main/resources/mapper/BuildingImgMapper.xml Просмотреть файл

@@ -0,0 +1,5 @@
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.example.wholeestate.dao.BuildingImgMapper">
4
+
5
+</mapper>