张延森 4 年前
父节点
当前提交
dd02641e7f

+ 1
- 1
pom.xml 查看文件

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.shigongli</groupId>
12 12
 	<artifactId>shigongli</artifactId>
13
-	<version>1.0.8</version>
13
+	<version>1.0.9</version>
14 14
 	<name>shigongli</name>
15 15
 	<description>ShiGongli Service</description>
16 16
 

+ 1
- 5
src/main/java/com/shigongli/controller/TaHousePersonController.java 查看文件

@@ -72,12 +72,8 @@ public class TaHousePersonController extends BaseController {
72 72
                                           @ApiParam("房源ID") @RequestParam(value = "houseId", required = false) String houseId) throws Exception{
73 73
 
74 74
 		    IPage<TaHousePerson> pg = new Page<>(pageNum, pageSize);
75
-            QueryWrapper<TaHousePerson> queryWrapper = new QueryWrapper<>();
76
-            queryWrapper.eq(!StringUtils.isEmpty(houseId), "house_id", houseId);
77
-            queryWrapper.eq("status", StatusConstant.NORMAL);
78
-            queryWrapper.orderByDesc("create_date");
79 75
 
80
-            IPage<TaHousePerson> result = iTaHousePersonService.page(pg, queryWrapper);
76
+            IPage<TaHousePerson> result = iTaHousePersonService.getWithSetting(pg, houseId);
81 77
             return ResponseBean.success(result);
82 78
     }
83 79
 

+ 8
- 1
src/main/java/com/shigongli/controller/TaHouseSettingController.java 查看文件

@@ -128,11 +128,18 @@ public class TaHouseSettingController extends BaseController {
128 128
      * @param taHouseSetting 实体对象
129 129
      * @return
130 130
      */
131
-    @RequestMapping(value="/taHouseSetting/{id}",method= RequestMethod.PUT)
131
+    @RequestMapping(value="/ma/taHouseSetting/{id}",method= RequestMethod.PUT)
132 132
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
133 133
     public ResponseBean taHouseSettingUpdate(@ApiParam("对象ID") @PathVariable String id,
134 134
                                              @ApiParam("更新内容") @RequestBody TaHouseSetting taHouseSetting) throws Exception{
135 135
 
136
+        TaHouseSetting origin = iTaHouseSettingService.getById(id);
137
+        if (null == origin || !StatusConstant.NORMAL.equals(origin.getStatus())) {
138
+            return ResponseBean.error("修改失败, 数据异常", ResponseBean.ERROR_UNAVAILABLE);
139
+        }
140
+
141
+        taHouseSetting.setSettingId(id);
142
+
136 143
         if (iTaHouseSettingService.updateById(taHouseSetting)){
137 144
             return ResponseBean.success(iTaHouseSettingService.getById(id));
138 145
         }else {

+ 8
- 0
src/main/java/com/shigongli/entity/TaHousePerson.java 查看文件

@@ -1,6 +1,7 @@
1 1
 package com.shigongli.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5 6
 import java.time.LocalDateTime;
6 7
 import java.io.Serializable;
@@ -51,5 +52,12 @@ public class TaHousePerson implements Serializable {
51 52
     @ApiModelProperty(value = "创建时间")
52 53
     private LocalDateTime createDate;
53 54
 
55
+    @TableField(exist = false)
56
+    private String settingId;
54 57
 
58
+    @TableField(exist = false)
59
+    private String startDate;
60
+
61
+    @TableField(exist = false)
62
+    private String endDate;
55 63
 }

+ 9
- 0
src/main/java/com/shigongli/entity/TaHouseSurround.java 查看文件

@@ -49,4 +49,13 @@ public class TaHouseSurround implements Serializable {
49 49
 
50 50
     @TableField(exist = false)
51 51
     private String image;
52
+
53
+    @TableField(exist = false)
54
+    private String tagId;
55
+
56
+    @TableField(exist = false)
57
+    private String groupId;
58
+
59
+    @TableField(exist = false)
60
+    private String groupName;
52 61
 }

+ 3
- 0
src/main/java/com/shigongli/mapper/TaHousePersonMapper.java 查看文件

@@ -1,8 +1,10 @@
1 1
 package com.shigongli.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.shigongli.entity.TaHousePerson;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
6 8
 
7 9
 /**
8 10
  * <p>
@@ -15,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
15 17
 @Mapper
16 18
 public interface TaHousePersonMapper extends BaseMapper<TaHousePerson> {
17 19
 
20
+    IPage<TaHousePerson> getWithSetting(IPage<TaHousePerson> pg, @Param("houseId") String houseId);
18 21
 }

+ 3
- 0
src/main/java/com/shigongli/service/ITaHousePersonService.java 查看文件

@@ -1,5 +1,6 @@
1 1
 package com.shigongli.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.shigongli.entity.TaHouse;
4 5
 import com.shigongli.entity.TaHousePerson;
5 6
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -15,4 +16,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
15 16
 public interface ITaHousePersonService extends IService<TaHousePerson> {
16 17
 
17 18
     void sendMessageToManager(TaHouse taHouse, String dateStr);
19
+
20
+    IPage<TaHousePerson> getWithSetting(IPage<TaHousePerson> pg, String houseId);
18 21
 }

+ 9
- 0
src/main/java/com/shigongli/service/impl/TaHousePersonServiceImpl.java 查看文件

@@ -2,6 +2,7 @@ package com.shigongli.service.impl;
2 2
 
3 3
 import cn.binarywang.wx.miniapp.api.WxMaService;
4 4
 import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.shigongli.common.WxUtils;
6 7
 import com.shigongli.config.WeixinConfig;
7 8
 import com.shigongli.entity.TaHouse;
@@ -31,6 +32,9 @@ import java.util.List;
31 32
 @Slf4j
32 33
 @Service
33 34
 public class TaHousePersonServiceImpl extends ServiceImpl<TaHousePersonMapper, TaHousePerson> implements ITaHousePersonService {
35
+    @Autowired
36
+    TaHousePersonMapper taHousePersonMapper;
37
+
34 38
     @Autowired
35 39
     ITaShopKeeperService iTaShopKeeperService;
36 40
 
@@ -95,6 +99,11 @@ public class TaHousePersonServiceImpl extends ServiceImpl<TaHousePersonMapper, T
95 99
         }
96 100
     }
97 101
 
102
+    @Override
103
+    public IPage<TaHousePerson> getWithSetting(IPage<TaHousePerson> pg, String houseId) {
104
+        return taHousePersonMapper.getWithSetting(pg, houseId);
105
+    }
106
+
98 107
     private void sendMaSubscribeMessage(String toUser, List<WxMaSubscribeMessage.Data> message, String page, String templateId) throws WxErrorException {
99 108
         WxMaService maService = wxUtils.getMaService();
100 109
         WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage

+ 18
- 0
src/main/resources/mapper/TaHousePersonMapper.xml 查看文件

@@ -2,4 +2,22 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.shigongli.mapper.TaHousePersonMapper">
4 4
 
5
+    <select id="getWithSetting" resultType="com.shigongli.entity.TaHousePerson">
6
+        SELECT
7
+            t.*,
8
+            m.setting_id,
9
+            m.start_date,
10
+            m.end_date
11
+        FROM
12
+            ta_house_person t
13
+            INNER JOIN ta_house_order s ON t.order_id = s.order_id
14
+            INNER JOIN ta_house_setting m ON s.setting_id = m.setting_id
15
+        WHERE
16
+            t.`status` = 1
17
+        <if test="null != houseId and '' != houseId">
18
+            AND t.house_id = #{houseId}
19
+        </if>
20
+        ORDER BY
21
+            s.create_date DESC
22
+    </select>
5 23
 </mapper>

+ 1
- 1
src/main/resources/mapper/TaHouseSettingMapper.xml 查看文件

@@ -10,7 +10,7 @@
10 10
         WHERE
11 11
             t.house_id = #{houseId}
12 12
             AND t.`status` = 1
13
-            AND t.start_date &lt;= DATE_FORMAT( now( ), '%Y-%m-%d' ) AND t.end_date &gt;= DATE_FORMAT( now( ), '%Y-%m-%d' )
13
+            AND t.start_date &gt;= DATE_FORMAT( now( ), '%Y-%m-%d' ) AND t.end_date &gt;= DATE_FORMAT( now( ), '%Y-%m-%d' )
14 14
         ORDER BY t.create_date DESC
15 15
         LIMIT 1
16 16
     </select>

+ 19
- 2
src/main/resources/mapper/TaHouseSurroundMapper.xml 查看文件

@@ -20,15 +20,32 @@
20 20
     <select id="getListByHouseOrNot" resultType="com.shigongli.entity.TaHouseSurround">
21 21
         SELECT
22 22
             t.*,
23
-            s.image
23
+            s.image,
24
+            q.tag_id,
25
+            q.group_id,
26
+            q.group_name
24 27
         FROM
25 28
             ta_house_surround t
26
-        INNER JOIN ta_meta_image s ON t.image_id = s.image_id
29
+            INNER JOIN ta_meta_image s ON t.image_id = s.image_id
30
+            INNER JOIN (
31
+                SELECT
32
+                    m.image_id,
33
+                    m.tag_id,
34
+                    n.group_id,
35
+                    h.`name` as group_name
36
+                FROM
37
+                    ta_meta_image_tag m
38
+                    INNER JOIN ta_mate_tag n ON m.tag_id = n.tag_id
39
+                    INNER JOIN ta_mate_tag_group h on n.group_id = h.group_id
40
+                HAVING 1
41
+            ) q ON q.image_id = t.image_id
27 42
         WHERE
28 43
             t.`status` = 1
29 44
         <if test="null != houseId and '' != houseId">
30 45
             AND t.house_id = #{houseId}
31 46
         </if>
47
+        GROUP BY
48
+            q.image_id
32 49
         ORDER BY
33 50
             t.create_date DESC
34 51
     </select>