weichaochao hace 5 años
padre
commit
370c0dd8d0

+ 24
- 2
src/main/java/com/huiju/estateagents/controller/TaPreselectionRecordController.java Ver fichero

15
 import org.springframework.beans.factory.annotation.Autowired;
15
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.web.bind.annotation.*;
16
 import org.springframework.web.bind.annotation.*;
17
 
17
 
18
+import javax.servlet.http.HttpServletRequest;
19
+
18
 /**
20
 /**
19
  * <p>
21
  * <p>
20
  * 预选记录表  前端控制器
22
  * 预选记录表  前端控制器
24
  * @since 2020-02-10
26
  * @since 2020-02-10
25
  */
27
  */
26
 @RestController
28
 @RestController
27
-@RequestMapping("/")
29
+@RequestMapping("/api")
28
 public class TaPreselectionRecordController extends BaseController {
30
 public class TaPreselectionRecordController extends BaseController {
29
 
31
 
30
     private final Logger logger = LoggerFactory.getLogger(TaPreselectionRecordController.class);
32
     private final Logger logger = LoggerFactory.getLogger(TaPreselectionRecordController.class);
41
      * @return
43
      * @return
42
      * @author gushaoyong
44
      * @author gushaoyong
43
      */
45
      */
44
-    @RequestMapping(value = "/taPreselectionRecord", method = RequestMethod.GET)
46
+    @RequestMapping(value = "/admin/taPreselectionRecord", method = RequestMethod.GET)
45
     public ResponseBean taPreselectionRecordList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
47
     public ResponseBean taPreselectionRecordList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
46
                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
48
                                                  @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
47
         ResponseBean responseBean = new ResponseBean();
49
         ResponseBean responseBean = new ResponseBean();
223
         }
225
         }
224
         return responseBean;
226
         return responseBean;
225
     }
227
     }
228
+
229
+    @RequestMapping(value = "/admin/taPreselectRecord", method = RequestMethod.GET)
230
+    public ResponseBean selectPreSelectRecordList(@RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
231
+                                                  @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
232
+                                                  @RequestParam(value = "salesBatchId")String salesBatchId,
233
+                                                  @RequestParam(value = "houseId", required = false)Integer houseId,
234
+                                                  @RequestParam(value = "phone", required = false) String phone,
235
+                                                  @RequestParam(value = "apartmentId", required = false) String apartmentId,
236
+                                                  @RequestParam(value = "status", required = false) Integer status,
237
+                                                  HttpServletRequest request){
238
+        ResponseBean responseBean = new ResponseBean();
239
+        try {
240
+            responseBean = iTaPreselectionRecordService.selectPreSelectRecordList(pageNum, pageSize, salesBatchId, houseId, getOrgId(request), phone, apartmentId, status);
241
+        } catch (Exception e) {
242
+            e.printStackTrace();
243
+            logger.error("taHousingResourcesList -=- {}", e.toString());
244
+            responseBean.addError(e.getMessage());
245
+        }
246
+        return responseBean;
247
+    }
226
 }
248
 }

+ 22
- 0
src/main/java/com/huiju/estateagents/mapper/TaPreselectionRecordMapper.java Ver fichero

2
 
2
 
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.huiju.estateagents.entity.TaPreselectionRecord;
6
 import com.huiju.estateagents.entity.TaPreselectionRecord;
6
 import com.huiju.estateagents.po.TaPreselectionRecordPO;
7
 import com.huiju.estateagents.po.TaPreselectionRecordPO;
7
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Mapper;
8
 import org.apache.ibatis.annotations.Param;
9
 import org.apache.ibatis.annotations.Param;
9
 import org.springframework.stereotype.Component;
10
 import org.springframework.stereotype.Component;
10
 
11
 
12
+import java.util.List;
13
+
11
 /**
14
 /**
12
  * <p>
15
  * <p>
13
  * 预选记录表  Mapper 接口
16
  * 预选记录表  Mapper 接口
38
      */
41
      */
39
     TaPreselectionRecord getRecordByPersonIdAndHouseId(@Param("personId") String personId,
42
     TaPreselectionRecord getRecordByPersonIdAndHouseId(@Param("personId") String personId,
40
                                                        @Param("houseId") String houseId);
43
                                                        @Param("houseId") String houseId);
44
+
45
+    /**
46
+     * 查询预选记录表
47
+     * @param page
48
+     * @param salesBatchId
49
+     * @param houseId
50
+     * @param orgId
51
+     * @param phone
52
+     * @param apartmentId
53
+     * @param status
54
+     * @return
55
+     */
56
+    List<TaPreselectionRecord> selectPreSelectRecordList(Page page,
57
+                                                         @Param("salesBatchId") String salesBatchId,
58
+                                                         @Param("houseId") Integer houseId,
59
+                                                         @Param("orgId") Integer orgId,
60
+                                                         @Param("phone") String phone,
61
+                                                         @Param("apartmentId") String apartmentId,
62
+                                                         @Param("status") Integer status);
41
 }
63
 }

+ 25
- 0
src/main/java/com/huiju/estateagents/po/TaPreselectionRecordPO.java Ver fichero

58
      */
58
      */
59
     @TableField(exist = false)
59
     @TableField(exist = false)
60
     private List<TaBuildingImg> buildingImgList;
60
     private List<TaBuildingImg> buildingImgList;
61
+
62
+    /**
63
+     * 用户昵称
64
+     */
65
+    private String nameOrnick;
66
+
67
+    /**
68
+     * 用户U型明
69
+     */
70
+    private String name;
71
+
72
+    /**
73
+     * 用户头像
74
+     */
75
+    private String avatarurl;
76
+
77
+    /**
78
+     * 手机号
79
+     */
80
+    private String phone;
81
+
82
+    /**
83
+     * 最后修改人
84
+     */
85
+    private String updateName;
61
 }
86
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/service/ITaPreselectionRecordService.java Ver fichero

52
      */
52
      */
53
     TaPreselectionRecord checkPreselect(String personId, String houseId);
53
     TaPreselectionRecord checkPreselect(String personId, String houseId);
54
 
54
 
55
+    ResponseBean selectPreSelectRecordList(Integer pageNum, Integer pageSize, String salesBatchId, Integer houseId, Integer orgId, String phone, String apartmentId, Integer status);
56
+
55
 }
57
 }

+ 10
- 0
src/main/java/com/huiju/estateagents/service/impl/TaPreselectionRecordServiceImpl.java Ver fichero

11
 import com.huiju.estateagents.entity.TaApartmentImg;
11
 import com.huiju.estateagents.entity.TaApartmentImg;
12
 import com.huiju.estateagents.entity.TaBuildingImg;
12
 import com.huiju.estateagents.entity.TaBuildingImg;
13
 import com.huiju.estateagents.entity.TaPreselectionRecord;
13
 import com.huiju.estateagents.entity.TaPreselectionRecord;
14
+import com.huiju.estateagents.entity.TaSharePersonFrom;
14
 import com.huiju.estateagents.mapper.TaApartmentImgMapper;
15
 import com.huiju.estateagents.mapper.TaApartmentImgMapper;
15
 import com.huiju.estateagents.mapper.TaBuildingImgMapper;
16
 import com.huiju.estateagents.mapper.TaBuildingImgMapper;
16
 import com.huiju.estateagents.mapper.TaHousingResourcesMapper;
17
 import com.huiju.estateagents.mapper.TaHousingResourcesMapper;
162
 
163
 
163
         return taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
164
         return taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
164
     }
165
     }
166
+
167
+    @Override
168
+    public ResponseBean selectPreSelectRecordList(Integer pageNum, Integer pageSize, String salesBatchId, Integer houseId, Integer orgId, String phone, String apartmentId, Integer status) {
169
+        Page page = new Page(pageNum, pageSize);
170
+        // 分页查询
171
+        List<TaPreselectionRecord> list = taPreselectionRecordMapper.selectPreSelectRecordList(page, salesBatchId, houseId, orgId, phone, apartmentId, status);
172
+        page.setRecords(list);
173
+        return ResponseBean.success(page);
174
+    }
165
 }
175
 }

+ 32
- 0
src/main/resources/mapper/TaPreselectionRecordMapper.xml Ver fichero

39
             AND t.house_id = #{houseId}
39
             AND t.house_id = #{houseId}
40
     </select>
40
     </select>
41
 
41
 
42
+    <select id="selectPreSelectRecordList" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
43
+        select t.house_id,
44
+        a.block_id as blockName,
45
+        a.unit_id as unitName,
46
+        a.floor_id as floorName,
47
+        a.room_id as roomName,
48
+        a.apartment_id,
49
+        b.nickname as nameOrnick,
50
+        b.`name`,
51
+        b.avatarurl,
52
+        b.phone,
53
+        t.`status`,
54
+        t.update_date,
55
+        (select name from ta_person t where (t.user_id = t.update_user || t.person_id = t.update_user)) as updateName
56
+        from ta_preselection_record t
57
+        left join ta_housing_resources a on t.house_id = a.house_id
58
+        left join ta_person b on t.person_id = b.person_id
59
+        where b.org_id = #{orgId} and a.sales_batch_id = #{salesBatchId}
60
+        <if test="houseId != null and houseId !=''">
61
+          and t.house_id = #{houseId}
62
+        </if>
63
+        <if test="phone != null and phone != ''">
64
+          and b.phone = #{phone}
65
+        </if>
66
+        <if test="apartmentId != null and apartmentId != ''">
67
+          and a.apartment_id = #{apartmentId}
68
+        </if>
69
+        <if test="status != null">
70
+          and t.status = #{status}
71
+        </if>
72
+    </select>
73
+
42
 </mapper>
74
 </mapper>