From 37a011904aeb2240b2f5d95faa3c08d9d9456c74 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Fri, 01 Dec 2023 14:22:00 +0800
Subject: [PATCH] 物业公司详情查询新增

---
 src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyServiceImpl.java |   11 +++
 src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml             |   32 +++++++++-
 src/main/java/org/springblade/modules/property/vo/PropertyCompanyVO.java                    |    4 +
 src/main/java/org/springblade/modules/property/vo/PropertyDistrictUserVO.java               |   12 ++++
 src/main/java/org/springblade/modules/property/controller/PropertyCompanyController.java    |   16 +++++
 src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.java            |    8 ++
 src/main/java/org/springblade/modules/property/service/IPropertyCompanyService.java         |    8 ++
 src/main/java/org/springblade/modules/property/vo/PropertyCompanyDetailVO.java              |   54 ++++++++++++++++++
 8 files changed, 139 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/springblade/modules/property/controller/PropertyCompanyController.java b/src/main/java/org/springblade/modules/property/controller/PropertyCompanyController.java
index 9fadb6a..7e53cf4 100644
--- a/src/main/java/org/springblade/modules/property/controller/PropertyCompanyController.java
+++ b/src/main/java/org/springblade/modules/property/controller/PropertyCompanyController.java
@@ -29,6 +29,7 @@
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.property.entity.PropertyCompanyDistrictEntity;
+import org.springblade.modules.property.vo.PropertyCompanyDetailVO;
 import org.springblade.modules.property.vo.PropertyCompanyDistrictVO;
 import org.springblade.modules.property.wrapper.PropertyCompanyDistrictWrapper;
 import org.springblade.modules.system.service.IDeptService;
@@ -157,7 +158,7 @@
 	 * 物业派驻小区表 详情
 	 */
 	@GetMapping("/getUserCompayDistrict")
-	@ApiOperationSupport()
+	@ApiOperationSupport(order = 8)
 	@ApiOperation(value = "获取用户小区物业信息", notes = "")
 	public R<PropertyCompanyVO> getUserCompayDistrict(@RequestParam("houseCode") String houseCode) {
 		PropertyCompanyVO detail = propertyCompanyService.getUserCompayDistrict(houseCode);
@@ -165,4 +166,17 @@
 	}
 
 
+	/**
+	 * 物业公司 自定义详情查询
+	 * @param propertyCompany
+	 * @return
+	 */
+	@GetMapping("/getDetail")
+	@ApiOperationSupport(order = 9)
+	@ApiOperation(value = "详情", notes = "传入propertyCompany")
+	public R<PropertyCompanyDetailVO> getDetail(PropertyCompanyVO propertyCompany) {
+		return R.data(propertyCompanyService.getDetail(propertyCompany));
+	}
+
+
 }
diff --git a/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.java b/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.java
index fff6c83..e211205 100644
--- a/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.java
+++ b/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.java
@@ -18,6 +18,7 @@
 
 import org.apache.ibatis.annotations.Param;
 import org.springblade.modules.property.entity.PropertyCompanyEntity;
+import org.springblade.modules.property.vo.PropertyCompanyDetailVO;
 import org.springblade.modules.property.vo.PropertyCompanyVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -64,4 +65,11 @@
 	List<Long> getDeptListByCompanyId(@Param("list") List<Integer> toIntList);
 
     PropertyCompanyVO getUserCompayDistrict(String houseCode);
+
+	/**
+	 * 物业公司 自定义详情查询
+	 * @param propertyCompany
+	 * @return
+	 */
+	PropertyCompanyDetailVO getDetail(@Param("propertyCompany") PropertyCompanyVO propertyCompany);
 }
diff --git a/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml b/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
index a94c5d9..a9a013b 100644
--- a/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
+++ b/src/main/java/org/springblade/modules/property/mapper/PropertyCompanyMapper.xml
@@ -123,13 +123,35 @@
 <!--            <if test="updateTime != null "> and update_time = #{updateTime}</if>-->
 <!--            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>-->
 <!--        </where>-->
+    </select>
 
+    <!--物业公司详情map-->
+    <resultMap id="propertyCompanyDetailMap" type="org.springblade.modules.property.vo.PropertyCompanyDetailVO" autoMapping="true">
+        <id property="id" column="id"/>
+        <collection property="districtUserVOS"  javaType="java.util.List"
+                    ofType="org.springblade.modules.property.vo.PropertyDistrictUserVO" autoMapping="true">
+            <id property="id" column="cid"/>
+            <result property="name" column="real_name"/>
+            <result property="phone" column="companyPersonPhone"/>
+        </collection>
+    </resultMap>
 
-
-
-
-
-
+    <!--自定义详情查询-->
+    <select id="getDetail" resultMap="propertyCompanyDetailMap">
+        SELECT
+            jpc.*,
+            jpcd.principal,
+            jpcd.principal_phone AS principalPhone,
+            jpdu.id AS cid,
+            bu.real_name,
+            bu.phone AS companyPersonPhone
+        FROM
+            jczz_property_company jpc
+            LEFT JOIN jczz_property_company_district jpcd ON jpcd.property_company_id = jpc.id and jpcd.is_deleted = 0
+            LEFT JOIN jczz_property_district_user jpdu ON jpcd.id = jpdu.property_company_district_id
+            LEFT JOIN blade_user bu ON locate(jpdu.user_id,bu.id)>0 and bu.is_deleted = 0
+        WHERE jpc.is_deleted = 0
+        and jpc.id = #{propertyCompany.id}
     </select>
 
 
diff --git a/src/main/java/org/springblade/modules/property/service/IPropertyCompanyService.java b/src/main/java/org/springblade/modules/property/service/IPropertyCompanyService.java
index 938abd6..5f223c7 100644
--- a/src/main/java/org/springblade/modules/property/service/IPropertyCompanyService.java
+++ b/src/main/java/org/springblade/modules/property/service/IPropertyCompanyService.java
@@ -18,6 +18,7 @@
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.modules.property.entity.PropertyCompanyEntity;
+import org.springblade.modules.property.vo.PropertyCompanyDetailVO;
 import org.springblade.modules.property.vo.PropertyCompanyVO;
 import org.springblade.core.mp.base.BaseService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -65,4 +66,11 @@
 	boolean deleteByIds(List<Integer> toIntList);
 
     PropertyCompanyVO getUserCompayDistrict(String houseCode);
+
+	/**
+	 * 物业公司 自定义详情查询
+	 * @param propertyCompany
+	 * @return
+	 */
+	PropertyCompanyDetailVO getDetail(PropertyCompanyVO propertyCompany);
 }
diff --git a/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyServiceImpl.java b/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyServiceImpl.java
index 968c621..7a6d211 100644
--- a/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyServiceImpl.java
+++ b/src/main/java/org/springblade/modules/property/service/impl/PropertyCompanyServiceImpl.java
@@ -21,6 +21,7 @@
 import liquibase.pro.packaged.D;
 import liquibase.pro.packaged.P;
 import org.springblade.modules.property.entity.PropertyCompanyEntity;
+import org.springblade.modules.property.vo.PropertyCompanyDetailVO;
 import org.springblade.modules.property.vo.PropertyCompanyVO;
 import org.springblade.modules.property.mapper.PropertyCompanyMapper;
 import org.springblade.modules.property.service.IPropertyCompanyService;
@@ -126,4 +127,14 @@
 	public PropertyCompanyVO getUserCompayDistrict(String houseCode) {
 		return baseMapper.getUserCompayDistrict(houseCode);
 	}
+
+	/**
+	 * 物业公司 自定义详情查询
+	 * @param propertyCompany
+	 * @return
+	 */
+	@Override
+	public PropertyCompanyDetailVO getDetail(PropertyCompanyVO propertyCompany) {
+		return baseMapper.getDetail(propertyCompany);
+	}
 }
diff --git a/src/main/java/org/springblade/modules/property/vo/PropertyCompanyDetailVO.java b/src/main/java/org/springblade/modules/property/vo/PropertyCompanyDetailVO.java
new file mode 100644
index 0000000..11a09e5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/property/vo/PropertyCompanyDetailVO.java
@@ -0,0 +1,54 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.property.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.property.entity.PropertyCompanyEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 物业公司 视图实体类
+ *
+ * @author BladeX
+ * @since 2023-11-23
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class PropertyCompanyDetailVO extends PropertyCompanyEntity {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 负责人姓名
+	 */
+	@ApiModelProperty(value = "负责人姓名")
+	private String principal;
+	/**
+	 * 负责人电话
+	 */
+	@ApiModelProperty(value = "负责人电话")
+	private String principalPhone;
+
+	/**
+	 * 物业公司人员信息
+	 */
+	private List<PropertyDistrictUserVO> districtUserVOS  = new ArrayList<>();
+
+}
diff --git a/src/main/java/org/springblade/modules/property/vo/PropertyCompanyVO.java b/src/main/java/org/springblade/modules/property/vo/PropertyCompanyVO.java
index b66531f..639da8a 100644
--- a/src/main/java/org/springblade/modules/property/vo/PropertyCompanyVO.java
+++ b/src/main/java/org/springblade/modules/property/vo/PropertyCompanyVO.java
@@ -22,6 +22,9 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 物业公司 视图实体类
  *
@@ -44,4 +47,5 @@
 	@ApiModelProperty(value = "负责人电话")
 	private String principalPhone;
 
+
 }
diff --git a/src/main/java/org/springblade/modules/property/vo/PropertyDistrictUserVO.java b/src/main/java/org/springblade/modules/property/vo/PropertyDistrictUserVO.java
index 5e5610f..c19a74e 100644
--- a/src/main/java/org/springblade/modules/property/vo/PropertyDistrictUserVO.java
+++ b/src/main/java/org/springblade/modules/property/vo/PropertyDistrictUserVO.java
@@ -32,4 +32,16 @@
 public class PropertyDistrictUserVO extends PropertyDistrictUserEntity {
 	private static final long serialVersionUID = 1L;
 
+	/**
+	 * 姓名
+	 */
+	private String name;
+
+	/**
+	 * 电话
+	 */
+	private String phone;
+
+
+
 }

--
Gitblit v1.9.3