|
@@ -0,0 +1,119 @@
|
|
|
+package com.ljq.house.biz.service.impl;
|
|
|
+
|
|
|
+import com.ljq.house.biz.dao.TmBuyingpointDao;
|
|
|
+import com.ljq.house.biz.model.TmBuyingpoint;
|
|
|
+import com.ljq.house.biz.model.TmEstate;
|
|
|
+import com.ljq.house.biz.dao.TmEstateDao;
|
|
|
+import com.ljq.house.biz.service.ITmBuyingpointService;
|
|
|
+import com.ljq.house.biz.service.ITmEstateService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.ljq.house.biz.vo.request.TmEstateReqVo;
|
|
|
+import com.ljq.house.biz.vo.response.TmEstateRspVo;
|
|
|
+import com.ljq.house.biz.vo.util.Page;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 房源管理 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author anthor
|
|
|
+ * @since 2021-06-03
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class TmEstateServiceImpl extends ServiceImpl<TmEstateDao, TmEstate> implements ITmEstateService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TmEstateDao tmEstateDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TmBuyingpointDao tmBuyingpointDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITmBuyingpointService iTmBuyingpointService;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<TmEstateRspVo> getList(TmEstateReqVo tmEstateReqVo) {
|
|
|
+
|
|
|
+ tmEstateReqVo.setLimit(tmEstateReqVo.getPageSize());
|
|
|
+ tmEstateReqVo.setOffset((tmEstateReqVo.getCurrPage() - 1) * tmEstateReqVo.getPageSize());
|
|
|
+
|
|
|
+ List<TmEstateRspVo> tmEstateRspVoList = tmEstateDao.getList(tmEstateReqVo);
|
|
|
+ List<TmBuyingpoint> tmBuyingpointList = new ArrayList<>();
|
|
|
+ if(tmEstateRspVoList!=null && tmEstateRspVoList.size()>0){
|
|
|
+ for(TmEstateRspVo ter:tmEstateRspVoList){
|
|
|
+ tmBuyingpointList = new ArrayList<>();
|
|
|
+ tmBuyingpointList = tmBuyingpointDao.getList(ter.getEstateId());
|
|
|
+ if(tmBuyingpointList !=null && tmBuyingpointList.size()>0){
|
|
|
+ ter.setTmBuyingpoint(tmBuyingpointList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Long total = tmEstateDao.countAll();
|
|
|
+ Page<TmEstateRspVo> tmEstateRspVoPage = new Page<>();
|
|
|
+ tmEstateRspVoPage.setCurrentPage(tmEstateReqVo.getCurrPage());
|
|
|
+ tmEstateRspVoPage.setCurrentCount(tmEstateReqVo.getPageSize());
|
|
|
+ tmEstateRspVoPage.setTotalCount(total);
|
|
|
+ tmEstateRspVoPage.setProductList(tmEstateRspVoList);
|
|
|
+
|
|
|
+ return tmEstateRspVoPage;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int insert(TmEstate tmEstate) {
|
|
|
+
|
|
|
+ tmEstateDao.insert(tmEstate);
|
|
|
+
|
|
|
+ List<TmBuyingpoint> tmBuyingpointList = tmEstate.getTmBuyingpoint();
|
|
|
+ if(tmBuyingpointList!=null && tmBuyingpointList.size()>0){
|
|
|
+ for(TmBuyingpoint tbp:tmBuyingpointList){
|
|
|
+ tbp.setEstateId(tmEstate.getEstateId());
|
|
|
+ iTmBuyingpointService.insert(tbp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int update(TmEstate tmEstate) {
|
|
|
+
|
|
|
+ if(tmEstate!=null && tmEstate.getTmBuyingpoint()!=null && tmEstate.getTmBuyingpoint().size()>0){
|
|
|
+ List<TmBuyingpoint> tmBuyingpointList = tmEstate.getTmBuyingpoint();
|
|
|
+ for(TmBuyingpoint tbp:tmBuyingpointList){
|
|
|
+ iTmBuyingpointService.update(tbp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tmEstateDao.update(tmEstate);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int del(String estateId) {
|
|
|
+ iTmBuyingpointService.delEstateId(estateId);
|
|
|
+ return tmEstateDao.del(estateId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<TmEstate> findAgencyEstate(String agencyUserId) {
|
|
|
+ return tmEstateDao.findAgencyEstate(agencyUserId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer findAgencyNum(String agencyUserId) {
|
|
|
+ Integer num = tmEstateDao.findAgencyNum(agencyUserId);
|
|
|
+ if(num == null ){
|
|
|
+ num = 0;
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ }
|
|
|
+}
|