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

+ 1
- 1
pom.xml 查看文件

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

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

72
                                           @ApiParam("房源ID") @RequestParam(value = "houseId", required = false) String houseId) throws Exception{
72
                                           @ApiParam("房源ID") @RequestParam(value = "houseId", required = false) String houseId) throws Exception{
73
 
73
 
74
 		    IPage<TaHousePerson> pg = new Page<>(pageNum, pageSize);
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
             return ResponseBean.success(result);
77
             return ResponseBean.success(result);
82
     }
78
     }
83
 
79
 

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

128
      * @param taHouseSetting 实体对象
128
      * @param taHouseSetting 实体对象
129
      * @return
129
      * @return
130
      */
130
      */
131
-    @RequestMapping(value="/taHouseSetting/{id}",method= RequestMethod.PUT)
131
+    @RequestMapping(value="/ma/taHouseSetting/{id}",method= RequestMethod.PUT)
132
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
132
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
133
     public ResponseBean taHouseSettingUpdate(@ApiParam("对象ID") @PathVariable String id,
133
     public ResponseBean taHouseSettingUpdate(@ApiParam("对象ID") @PathVariable String id,
134
                                              @ApiParam("更新内容") @RequestBody TaHouseSetting taHouseSetting) throws Exception{
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
         if (iTaHouseSettingService.updateById(taHouseSetting)){
143
         if (iTaHouseSettingService.updateById(taHouseSetting)){
137
             return ResponseBean.success(iTaHouseSettingService.getById(id));
144
             return ResponseBean.success(iTaHouseSettingService.getById(id));
138
         }else {
145
         }else {

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

1
 package com.shigongli.entity;
1
 package com.shigongli.entity;
2
 
2
 
3
 import com.baomidou.mybatisplus.annotation.IdType;
3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4
 import com.baomidou.mybatisplus.annotation.TableId;
5
 import com.baomidou.mybatisplus.annotation.TableId;
5
 import java.time.LocalDateTime;
6
 import java.time.LocalDateTime;
6
 import java.io.Serializable;
7
 import java.io.Serializable;
51
     @ApiModelProperty(value = "创建时间")
52
     @ApiModelProperty(value = "创建时间")
52
     private LocalDateTime createDate;
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
 
49
 
50
     @TableField(exist = false)
50
     @TableField(exist = false)
51
     private String image;
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
 package com.shigongli.mapper;
1
 package com.shigongli.mapper;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.shigongli.entity.TaHousePerson;
4
 import com.shigongli.entity.TaHousePerson;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
6
 
8
 
7
 /**
9
 /**
8
  * <p>
10
  * <p>
15
 @Mapper
17
 @Mapper
16
 public interface TaHousePersonMapper extends BaseMapper<TaHousePerson> {
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
 package com.shigongli.service;
1
 package com.shigongli.service;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.shigongli.entity.TaHouse;
4
 import com.shigongli.entity.TaHouse;
4
 import com.shigongli.entity.TaHousePerson;
5
 import com.shigongli.entity.TaHousePerson;
5
 import com.baomidou.mybatisplus.extension.service.IService;
6
 import com.baomidou.mybatisplus.extension.service.IService;
15
 public interface ITaHousePersonService extends IService<TaHousePerson> {
16
 public interface ITaHousePersonService extends IService<TaHousePerson> {
16
 
17
 
17
     void sendMessageToManager(TaHouse taHouse, String dateStr);
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
 
2
 
3
 import cn.binarywang.wx.miniapp.api.WxMaService;
3
 import cn.binarywang.wx.miniapp.api.WxMaService;
4
 import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
4
 import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.shigongli.common.WxUtils;
6
 import com.shigongli.common.WxUtils;
6
 import com.shigongli.config.WeixinConfig;
7
 import com.shigongli.config.WeixinConfig;
7
 import com.shigongli.entity.TaHouse;
8
 import com.shigongli.entity.TaHouse;
31
 @Slf4j
32
 @Slf4j
32
 @Service
33
 @Service
33
 public class TaHousePersonServiceImpl extends ServiceImpl<TaHousePersonMapper, TaHousePerson> implements ITaHousePersonService {
34
 public class TaHousePersonServiceImpl extends ServiceImpl<TaHousePersonMapper, TaHousePerson> implements ITaHousePersonService {
35
+    @Autowired
36
+    TaHousePersonMapper taHousePersonMapper;
37
+
34
     @Autowired
38
     @Autowired
35
     ITaShopKeeperService iTaShopKeeperService;
39
     ITaShopKeeperService iTaShopKeeperService;
36
 
40
 
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
     private void sendMaSubscribeMessage(String toUser, List<WxMaSubscribeMessage.Data> message, String page, String templateId) throws WxErrorException {
107
     private void sendMaSubscribeMessage(String toUser, List<WxMaSubscribeMessage.Data> message, String page, String templateId) throws WxErrorException {
99
         WxMaService maService = wxUtils.getMaService();
108
         WxMaService maService = wxUtils.getMaService();
100
         WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage
109
         WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage

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

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.shigongli.mapper.TaHousePersonMapper">
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
 </mapper>
23
 </mapper>

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

10
         WHERE
10
         WHERE
11
             t.house_id = #{houseId}
11
             t.house_id = #{houseId}
12
             AND t.`status` = 1
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
         ORDER BY t.create_date DESC
14
         ORDER BY t.create_date DESC
15
         LIMIT 1
15
         LIMIT 1
16
     </select>
16
     </select>

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

20
     <select id="getListByHouseOrNot" resultType="com.shigongli.entity.TaHouseSurround">
20
     <select id="getListByHouseOrNot" resultType="com.shigongli.entity.TaHouseSurround">
21
         SELECT
21
         SELECT
22
             t.*,
22
             t.*,
23
-            s.image
23
+            s.image,
24
+            q.tag_id,
25
+            q.group_id,
26
+            q.group_name
24
         FROM
27
         FROM
25
             ta_house_surround t
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
         WHERE
42
         WHERE
28
             t.`status` = 1
43
             t.`status` = 1
29
         <if test="null != houseId and '' != houseId">
44
         <if test="null != houseId and '' != houseId">
30
             AND t.house_id = #{houseId}
45
             AND t.house_id = #{houseId}
31
         </if>
46
         </if>
47
+        GROUP BY
48
+            q.image_id
32
         ORDER BY
49
         ORDER BY
33
             t.create_date DESC
50
             t.create_date DESC
34
     </select>
51
     </select>