Parcourir la source

* 认筹代码优化

顾绍勇 il y a 5 ans
Parent
révision
bd76392777

+ 3
- 14
src/main/java/com/huiju/estateagents/controller/TaPreselectionController.java Voir le fichier

@@ -120,6 +120,7 @@ public class TaPreselectionController extends BaseController {
120 120
             QueryWrapper<TaPreselection> queryWrapper = new QueryWrapper<>();
121 121
             queryWrapper.eq("org_id", orgId);
122 122
             queryWrapper.eq("sales_batch_id", taPreselection.getSalesBatchId());
123
+            queryWrapper.eq("status", 1);
123 124
             TaPreselection record = iTaPreselectionService.getOne(queryWrapper);
124 125
             if (record != null) {
125 126
                 responseBean.addError("销售批次已新增过预选");
@@ -208,10 +209,9 @@ public class TaPreselectionController extends BaseController {
208 209
      * @param taPreselection 实体对象
209 210
      * @return
210 211
      */
211
-    @RequestMapping(value = "/taPreselection/{id}", method = RequestMethod.PUT)
212
+    @RequestMapping(value = "/admin/taPreselection/{id}", method = RequestMethod.PUT)
212 213
     public ResponseBean taPreselectionUpdate(@PathVariable Integer id,
213
-                                             @RequestBody TaPreselection taPreselection,
214
-                                             HttpServletRequest request) {
214
+                                             @RequestBody TaPreselection taPreselection) {
215 215
         ResponseBean responseBean = new ResponseBean();
216 216
         try {
217 217
 
@@ -220,17 +220,6 @@ public class TaPreselectionController extends BaseController {
220 220
                 return responseBean;
221 221
             }
222 222
 
223
-            Integer orgId = getOrgId(request);
224
-            // 校验是否预选过
225
-            QueryWrapper<TaPreselection> queryWrapper = new QueryWrapper<>();
226
-            queryWrapper.eq("org_id", orgId);
227
-            queryWrapper.eq("sales_batch_id", taPreselection.getSalesBatchId());
228
-            TaPreselection record = iTaPreselectionService.getOne(queryWrapper);
229
-            if (record != null) {
230
-                responseBean.addError("销售批次已新增过预选");
231
-                return responseBean;
232
-            }
233
-
234 223
             if (StringUtils.isNotBlank(taPreselection.getPreselectionStartTime()) && StringUtils.isNotBlank(taPreselection.getPreselectionEndTime())) {
235 224
                 // 更新批次表信息
236 225
                 TaSalesBatch taSalesBatch = new TaSalesBatch();

+ 27
- 17
src/main/java/com/huiju/estateagents/controller/TaRaiseController.java Voir le fichier

@@ -36,11 +36,8 @@ public class TaRaiseController extends BaseController {
36 36
     @Autowired
37 37
     public ITaRaiseService iTaRaiseService;
38 38
 
39
-    @Autowired
40
-    private ITaSalesBatchService iTaSalesBatchService;
41
-
42 39
     /**
43
-     * 获取销售批次列表-认筹
40
+     * 获取认筹列表
44 41
      *
45 42
      * @param pageNum
46 43
      * @param pageSize
@@ -50,21 +47,21 @@ public class TaRaiseController extends BaseController {
50 47
      * @param request
51 48
      * @return
52 49
      */
53
-    @RequestMapping(value = "admin/listSalesBatchForRaise", method = RequestMethod.GET)
54
-    public ResponseBean listSalesBatchForRaise(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
55
-                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
56
-                                               String buildingId, String salesBatchName, Integer status,
57
-                                               HttpServletRequest request) {
50
+    @RequestMapping(value = "admin/listRaiseByCondition", method = RequestMethod.GET)
51
+    public ResponseBean listRaiseByCondition(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
52
+                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
53
+                                             String buildingId, String salesBatchName, Integer status,
54
+                                             HttpServletRequest request) {
58 55
         ResponseBean responseBean = new ResponseBean();
59 56
 
60 57
         try {
61 58
             Integer orgId = getOrgId(request);
62 59
             List<TaPersonBuilding> personBuildingList = getTaPersonBuildingListByUserId(request);
63 60
 
64
-            responseBean = iTaSalesBatchService.listSalesBatchForRaise(pageSize, pageNum, salesBatchName, buildingId, orgId, status, personBuildingList);
65
-            logger.info("listSalesBatchForRaise 返回结果:{}", JSONObject.toJSONString(responseBean));
61
+            responseBean = iTaRaiseService.listRaiseByCondition(pageSize, pageNum, salesBatchName, buildingId, orgId, status, personBuildingList);
62
+            logger.info("listRaiseByCondition 返回结果:{}", JSONObject.toJSONString(responseBean));
66 63
         } catch (Exception e) {
67
-            logger.error("listSalesBatchForRaise -=- {}", e);
64
+            logger.error("listRaiseByCondition -=- {}", e);
68 65
             responseBean.addError(e.getMessage());
69 66
         }
70 67
         return responseBean;
@@ -105,7 +102,7 @@ public class TaRaiseController extends BaseController {
105 102
      * @return
106 103
      */
107 104
     @RequestMapping(value = "/admin/taRaise", method = RequestMethod.POST)
108
-    public ResponseBean taRaiseAdd(@RequestBody TaRaise taRaise) {
105
+    public ResponseBean taRaiseAdd(@RequestBody TaRaise taRaise, HttpServletRequest request) {
109 106
         ResponseBean responseBean = new ResponseBean();
110 107
         try {
111 108
             // 参数校验
@@ -115,6 +112,19 @@ public class TaRaiseController extends BaseController {
115 112
                 return responseBean;
116 113
             }
117 114
 
115
+            Integer orgId = getOrgId(request);
116
+
117
+            // 校验批次是否已经认筹过
118
+            QueryWrapper<TaRaise> taRaiseQueryWrapper = new QueryWrapper<>();
119
+            taRaiseQueryWrapper.eq("orgId", orgId);
120
+            taRaiseQueryWrapper.eq("sales_batch_id", orgId);
121
+            taRaiseQueryWrapper.eq("status", 1);
122
+            TaRaise tr = iTaRaiseService.getOne(taRaiseQueryWrapper);
123
+            if (tr != null) {
124
+                responseBean.addSuccess("该销售批次已添加过认筹");
125
+                return responseBean;
126
+            }
127
+
118 128
             if (iTaRaiseService.save(taRaise)) {
119 129
                 responseBean.addSuccess(taRaise);
120 130
             } else {
@@ -181,7 +191,7 @@ public class TaRaiseController extends BaseController {
181 191
      * @param taRaise 实体对象
182 192
      * @return
183 193
      */
184
-    @RequestMapping(value = "/taRaise/{id}", method = RequestMethod.PUT)
194
+    @RequestMapping(value = "/admin/taRaise/{id}", method = RequestMethod.PUT)
185 195
     public ResponseBean taRaiseUpdate(@PathVariable Integer id,
186 196
                                       @RequestBody TaRaise taRaise) {
187 197
         ResponseBean responseBean = new ResponseBean();
@@ -204,11 +214,11 @@ public class TaRaiseController extends BaseController {
204 214
      *
205 215
      * @param id 实体ID
206 216
      */
207
-    @RequestMapping(value = "/taRaise/{id}", method = RequestMethod.GET)
208
-    public ResponseBean taRaiseGet(@PathVariable Integer id) {
217
+    @RequestMapping(value = "/admin/taRaise/{id}", method = RequestMethod.GET)
218
+    public ResponseBean taRaiseGet(@PathVariable Integer id, HttpServletRequest request) {
209 219
         ResponseBean responseBean = new ResponseBean();
210 220
         try {
211
-            responseBean.addSuccess(iTaRaiseService.getById(id));
221
+            responseBean = iTaRaiseService.getRaiseById(id, getOrgId(request));
212 222
         } catch (Exception e) {
213 223
             e.printStackTrace();
214 224
             logger.error("taRaiseDelete -=- {}", e.toString());

+ 7
- 1
src/main/java/com/huiju/estateagents/entity/TaPreselection.java Voir le fichier

@@ -12,7 +12,7 @@ import java.time.LocalDateTime;
12 12
 
13 13
 /**
14 14
  * <p>
15
- * 预选表 
15
+ * 预选表
16 16
  * </p>
17 17
  *
18 18
  * @author jobob
@@ -90,4 +90,10 @@ public class TaPreselection implements Serializable {
90 90
      */
91 91
     @TableField(exist = false)
92 92
     private Integer realHeat;
93
+
94
+    /**
95
+     * 销售批次备注
96
+     */
97
+    @TableField(exist = false)
98
+    private Integer remark;
93 99
 }

+ 28
- 2
src/main/java/com/huiju/estateagents/entity/TaRaise.java Voir le fichier

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.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 lombok.Data;
6 7
 import lombok.EqualsAndHashCode;
@@ -101,9 +102,34 @@ public class TaRaise implements Serializable {
101 102
     private LocalDateTime createDate;
102 103
 
103 104
     /**
104
-     * 基础热度
105
+     * 楼盘名
105 106
      */
106
-    private Integer heat;
107
+    @TableField(exist = false)
108
+    private String buildingName;
109
+
110
+    /**
111
+     * 销售批次名
112
+     */
113
+    @TableField(exist = false)
114
+    private String salesBatchName;
115
+
116
+    /**
117
+     * 二维码
118
+     */
119
+    @TableField(exist = false)
120
+    private String qrCode;
121
+
122
+    /**
123
+     * 认筹实际热度
124
+     */
125
+    @TableField(exist = false)
126
+    private Integer raiseRealHeat;
127
+
128
+    /**
129
+     * 销售批次备注
130
+     */
131
+    @TableField(exist = false)
132
+    private Integer remark;
107 133
 
108 134
 
109 135
 }

+ 15
- 0
src/main/java/com/huiju/estateagents/mapper/TaRaiseMapper.java Voir le fichier

@@ -1,8 +1,14 @@
1 1
 package com.huiju.estateagents.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.huiju.estateagents.entity.TaPersonBuilding;
4 6
 import com.huiju.estateagents.entity.TaRaise;
5 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+import org.springframework.stereotype.Component;
10
+
11
+import java.util.List;
6 12
 
7 13
 /**
8 14
  * <p>
@@ -13,6 +19,15 @@ import org.apache.ibatis.annotations.Mapper;
13 19
  * @since 2020-02-26
14 20
  */
15 21
 @Mapper
22
+@Component
16 23
 public interface TaRaiseMapper extends BaseMapper<TaRaise> {
17 24
 
25
+    IPage<TaRaise> listRaiseByCondition(IPage<TaRaise> page,
26
+                                        @Param("salesBatchName") String salesBatchName,
27
+                                        @Param("buildingId") String buildingId,
28
+                                        @Param("orgId") Integer orgId,
29
+                                        @Param("status") Integer status,
30
+                                        @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
31
+
32
+    TaRaise getRaiseById(Integer id, Integer orgId);
18 33
 }

+ 0
- 7
src/main/java/com/huiju/estateagents/mapper/TaSalesBatchMapper.java Voir le fichier

@@ -40,11 +40,4 @@ public interface TaSalesBatchMapper extends BaseMapper<TaSalesBatch> {
40 40
      * @return
41 41
      */
42 42
     Map<String, Object> getTotalHousesAndHeat(@Param("salesBatchId") Integer salesBatchId);
43
-
44
-    IPage<TaSalesBatch> listSalesBatchForRaise(IPage<TaSalesBatch> page,
45
-                                               @Param("salesBatchName") String salesBatchName,
46
-                                               @Param("buildingId") String buildingId,
47
-                                               @Param("orgId") Integer orgId,
48
-                                               @Param("status") Integer status,
49
-                                               @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
50 43
 }

+ 22
- 0
src/main/java/com/huiju/estateagents/service/ITaRaiseService.java Voir le fichier

@@ -2,6 +2,7 @@ package com.huiju.estateagents.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.huiju.estateagents.base.ResponseBean;
5
+import com.huiju.estateagents.entity.TaPersonBuilding;
5 6
 import com.huiju.estateagents.entity.TaRaise;
6 7
 
7 8
 import javax.servlet.http.HttpServletRequest;
@@ -17,6 +18,20 @@ import java.util.List;
17 18
  */
18 19
 public interface ITaRaiseService extends IService<TaRaise> {
19 20
 
21
+    /**
22
+     * 获取销售批次列表 - 认筹
23
+     *
24
+     * @param pageSize
25
+     * @param pageNum
26
+     * @param salesBatchName
27
+     * @param buildingId
28
+     * @param orgId
29
+     * @param status
30
+     * @return
31
+     */
32
+    ResponseBean listRaiseByCondition(Integer pageSize, Integer pageNum, String salesBatchName, String buildingId,
33
+                                      Integer orgId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId);
34
+
20 35
     /**
21 36
      * 批量删除
22 37
      *
@@ -25,4 +40,11 @@ public interface ITaRaiseService extends IService<TaRaise> {
25 40
      * @return
26 41
      */
27 42
     ResponseBean batchDelete(List<TaRaise> taRaiseList, Integer orgId);
43
+
44
+    /**
45
+     * @param id
46
+     * @param orgId
47
+     * @return
48
+     */
49
+    ResponseBean getRaiseById(Integer id, Integer orgId);
28 50
 }

+ 0
- 14
src/main/java/com/huiju/estateagents/service/ITaSalesBatchService.java Voir le fichier

@@ -36,18 +36,4 @@ public interface ITaSalesBatchService extends IService<TaSalesBatch> {
36 36
      * @return
37 37
      */
38 38
     ResponseBean getSalesBatchById(Integer salesBatchId);
39
-
40
-    /**
41
-     * 获取销售批次列表 - 认筹
42
-     *
43
-     * @param pageSize
44
-     * @param pageNum
45
-     * @param salesBatchName
46
-     * @param buildingId
47
-     * @param orgId
48
-     * @param status
49
-     * @return
50
-     */
51
-    ResponseBean listSalesBatchForRaise(Integer pageSize, Integer pageNum, String salesBatchName, String buildingId,
52
-                                        Integer orgId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId);
53 39
 }

+ 26
- 1
src/main/java/com/huiju/estateagents/service/impl/TaRaiseServiceImpl.java Voir le fichier

@@ -2,10 +2,14 @@ package com.huiju.estateagents.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
6
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 8
 import com.huiju.estateagents.base.ResponseBean;
9
+import com.huiju.estateagents.entity.TaPersonBuilding;
7 10
 import com.huiju.estateagents.entity.TaRaise;
8 11
 import com.huiju.estateagents.entity.TaRaiseRecord;
12
+import com.huiju.estateagents.entity.TaSalesBatch;
9 13
 import com.huiju.estateagents.mapper.TaRaiseMapper;
10 14
 import com.huiju.estateagents.mapper.TaRaiseRecordMapper;
11 15
 import com.huiju.estateagents.service.ITaRaiseService;
@@ -34,6 +38,21 @@ public class TaRaiseServiceImpl extends ServiceImpl<TaRaiseMapper, TaRaise> impl
34 38
     @Autowired
35 39
     private TaRaiseRecordMapper taRaiseRecordMapper;
36 40
 
41
+    @Autowired
42
+    private TaRaiseMapper taRaiseMapper;
43
+
44
+    @Override
45
+    public ResponseBean listRaiseByCondition(Integer pageSize, Integer pageNum, String salesBatchName, String buildingId, Integer orgId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId) {
46
+        logger.info("listSalesBatchForRaise 接收参数:pageSize:{},pageNum:{},salesBatchName:{},buildilgId:{},orgId:{},status:{},taPersonBuildingListByUserId:{}",
47
+                pageSize, pageNum, salesBatchName, buildingId, orgId, status, JSONObject.toJSONString(taPersonBuildingListByUserId));
48
+
49
+        ResponseBean responseBean = new ResponseBean();
50
+
51
+        IPage<TaRaise> pg = new Page<>(pageNum, pageSize);
52
+        responseBean.addSuccess(taRaiseMapper.listRaiseByCondition(pg, salesBatchName, buildingId, orgId, status, taPersonBuildingListByUserId));
53
+        return responseBean;
54
+    }
55
+
37 56
     @Override
38 57
     public ResponseBean batchDelete(List<TaRaise> taRaiseList, Integer orgId) {
39 58
         logger.info("TaRaiseServiceImpl.batchDelete 接收参数:list:{},orgId:{}", JSONObject.toJSONString(taRaiseList), orgId);
@@ -46,7 +65,6 @@ public class TaRaiseServiceImpl extends ServiceImpl<TaRaiseMapper, TaRaise> impl
46 65
         }
47 66
 
48 67
         for (TaRaise tr : taRaiseList) {
49
-
50 68
             // 校验销售批次下是否有认筹记录
51 69
             QueryWrapper<TaRaiseRecord> taRaiseRecordQueryWrapper = new QueryWrapper<>();
52 70
             taRaiseRecordQueryWrapper.eq("org_id", orgId);
@@ -71,4 +89,11 @@ public class TaRaiseServiceImpl extends ServiceImpl<TaRaiseMapper, TaRaise> impl
71 89
         }
72 90
         return responseBean;
73 91
     }
92
+
93
+    @Override
94
+    public ResponseBean getRaiseById(Integer id, Integer orgId) {
95
+        ResponseBean responseBean = new ResponseBean();
96
+        responseBean.addSuccess(taRaiseMapper.getRaiseById(id, orgId));
97
+        return responseBean;
98
+    }
74 99
 }

+ 0
- 15
src/main/java/com/huiju/estateagents/service/impl/TaSalesBatchServiceImpl.java Voir le fichier

@@ -195,19 +195,4 @@ public class TaSalesBatchServiceImpl extends ServiceImpl<TaSalesBatchMapper, TaS
195 195
         responseBean.addSuccess(result);
196 196
         return responseBean;
197 197
     }
198
-
199
-    @Override
200
-    public ResponseBean listSalesBatchForRaise(Integer pageSize, Integer pageNum, String salesBatchName, String buildingId,
201
-                                               Integer orgId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId) {
202
-
203
-        logger.info("listSalesBatchForRaise 接收参数:pageSize:{},pageNum:{},salesBatchName:{},buildilgId:{},orgId:{},status:{},taPersonBuildingListByUserId:{}",
204
-                pageSize, pageNum, salesBatchName, buildingId, orgId, status,JSONObject.toJSONString(taPersonBuildingListByUserId));
205
-
206
-        ResponseBean responseBean = new ResponseBean();
207
-
208
-        IPage<TaSalesBatch> pg = new Page<>(pageNum, pageSize);
209
-        responseBean.addSuccess(taSalesBatchMapper.listSalesBatchForRaise(pg, salesBatchName, buildingId, orgId, status, taPersonBuildingListByUserId));
210
-        return responseBean;
211
-    }
212
-
213 198
 }

+ 2
- 0
src/main/resources/mapper/TaPreselectionMapper.xml Voir le fichier

@@ -6,6 +6,7 @@
6 6
         SELECT
7 7
         t.*,
8 8
         t2.sales_number,
9
+        t2.remark,
9 10
         t3.building_name,
10 11
         ( SELECT sum( th.real_heat ) FROM ta_housing_resources th WHERE th.sales_batch_id = t2.sales_batch_id AND th.`status` = 1 ) real_heat
11 12
         FROM
@@ -43,6 +44,7 @@
43 44
         SELECT
44 45
             t.*,
45 46
             t2.qr_code,
47
+            t2.remark,
46 48
             t2.sales_batch_name,
47 49
             t2.building_id
48 50
         FROM

+ 58
- 0
src/main/resources/mapper/TaRaiseMapper.xml Voir le fichier

@@ -2,4 +2,62 @@
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.huiju.estateagents.mapper.TaRaiseMapper">
4 4
 
5
+    <select id="listRaiseByCondition" resultType="com.huiju.estateagents.entity.TaRaise">
6
+        SELECT
7
+            t.*,
8
+            t2.sales_batch_name,
9
+            t2.remark,
10
+            t3.building_name,
11
+            ( SELECT sum( th.raise_real_heat ) FROM ta_housing_resources th WHERE th.sales_batch_id = t2.sales_batch_id AND th.`status` = 1 ) raise_real_heat
12
+        FROM
13
+            ta_raise t
14
+            LEFT JOIN ta_sales_batch t2 ON t.sales_batch_id = t2.sales_batch_id
15
+            LEFT JOIN ta_building t3 ON t2.building_id = t3.building_id
16
+        WHERE
17
+            t.org_id = #{orgId}
18
+            AND t.`status` != - 1
19
+        <if test="buildingId != null and buildingId != ''">
20
+            and t2.building_id = #{buildingId}
21
+        </if>
22
+        <if test="salesBatchName != null and salesBatchName != ''">
23
+            and t2.sales_batch_name like CONCAT('%',#{salesBatchName}, '%')
24
+        </if>
25
+        <if test="status != null">
26
+            and t.status = #{status}
27
+        </if>
28
+        <if test="personBuildingList != null and personBuildingList.size > 0">
29
+            AND t2.building_id in
30
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
31
+                #{personBuilding.buildingId}
32
+            </foreach>
33
+        </if>
34
+        ORDER BY
35
+        t.create_date DESC
36
+    </select>
37
+
38
+    <select id="getRaiseById" resultType="com.huiju.estateagents.entity.TaRaise">
39
+
40
+        SELECT
41
+          t3.*,
42
+	      t4.building_name
43
+        FROM
44
+            (
45
+        SELECT
46
+            t.*,
47
+            t2.sales_batch_name,
48
+            t2.remark,
49
+            t2.qr_code,
50
+            t2.building_id
51
+        FROM
52
+            ta_raise t,
53
+            ta_sales_batch t2
54
+        WHERE
55
+            t.sales_batch_id = t2.sales_batch_id
56
+            AND t.raise_id = #{id}
57
+            AND t.org_id = #{orgId}
58
+            ) t3
59
+            LEFT JOIN ta_building t4 ON t3.building_id = t4.building_id
60
+
61
+    </select>
62
+
5 63
 </mapper>

+ 0
- 39
src/main/resources/mapper/TaSalesBatchMapper.xml Voir le fichier

@@ -50,43 +50,4 @@
50 50
         WHERE
51 51
             t.STATUS = 1 and t.sales_batch_id = #{salesBatchId}
52 52
     </select>
53
-
54
-    <select id="listSalesBatchForRaise" resultType="com.huiju.estateagents.entity.TaSalesBatch">
55
-        SELECT
56
-            t.*,
57
-            a.building_name,
58
-            r.raise_id ,
59
-            r.`status` raiseStaus,
60
-            r.house_locking_type ,
61
-            r.raise_start_time ,
62
-            r.raise_end_time ,
63
-            r.raise_price ,
64
-            r.pay_type ,
65
-            (SELECT COUNT( * ) FROM ta_raise_record r2  where r2.raise_id = r.raise_id and r2.`status` != -1) raiseCount
66
-        FROM
67
-            ta_sales_batch t
68
-            LEFT JOIN ta_building a ON t.building_id = a.building_id
69
-            INNER JOIN ta_raise r ON t.sales_batch_id = r.sales_batch_id
70
-        WHERE
71
-            t.org_id = #{orgId}
72
-            AND t.STATUS != - 1
73
-            AND r.`status` != -1
74
-        <if test="buildingId != null and buildingId != ''">
75
-            and t.building_id = #{buildingId}
76
-        </if>
77
-        <if test="salesBatchName != null and salesBatchName != ''">
78
-            and t.sales_batch_name like CONCAT('%',#{salesBatchName}, '%')
79
-        </if>
80
-        <if test="status != null">
81
-            and t.status = #{status}
82
-        </if>
83
-        <if test="personBuildingList != null and personBuildingList.size > 0">
84
-            AND t.building_id in
85
-            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
86
-                #{personBuilding.buildingId}
87
-            </foreach>
88
-        </if>
89
-        ORDER BY
90
-            t.create_date DESC
91
-    </select>
92 53
 </mapper>