于继渤 2 anni fa
parent
commit
165cc76cf2

+ 7 - 1
src/main/java/com/dk/mdm/controller/mst/CusFollowController.java

@@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mst.CusFollowService;
 
+import java.util.List;
+
 @Api(tags = "客户跟进API接口")
 @RestController
 @RequestMapping("/mst/cusFollow")
@@ -55,5 +57,9 @@ public class CusFollowController{
         return cusFollowService.insert(cusFollowVO);
     }
 
-
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"select_by_list"})
+    public ResponseResultVO<List<CusFollowResponse>> selectByList(@RequestBody CusFollowQuery customerQuery) {
+        return cusFollowService.selectByList(customerQuery);
+    }
 }

+ 11 - 4
src/main/java/com/dk/mdm/controller/mst/CustomerController.java

@@ -8,11 +8,8 @@ import com.dk.mdm.model.query.mst.CustomerQuery;
 import com.dk.mdm.model.response.mst.CustomerResponse;
 import com.dk.mdm.model.vo.mst.CustomerVO;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mst.CustomerService;
 
@@ -62,4 +59,14 @@ public class CustomerController{
         return customerService.update(customerVO);
     }
 
+
+    /**
+     * @desc : 查看
+     * @author : 于继渤
+     * @date : 2024/3/6 10:36
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO<?> selectByIdRespone(@PathVariable String id) {
+        return customerService.selectByIdRespone(id);
+    }
 }

+ 1 - 0
src/main/java/com/dk/mdm/mapper/mst/CusFollowMapper.java

@@ -23,6 +23,7 @@ public interface CusFollowMapper extends BaseMapper<CusFollow>{
      * @date : 2024/2/26 10:36
      */
     List<CusFollowResponse> selectByCond(CusFollowQuery cusFollowQuery);
+    List<CusFollowResponse> selectByList(CusFollowQuery cusFollowQuery);
 
     /**
      * @desc   : 根据条件进行查询(数量)

+ 23 - 2
src/main/java/com/dk/mdm/mapper/mst/CusFollowMapper.xml

@@ -72,7 +72,8 @@
         <result column="cusPhone" property="cusPhone"/>
         <result column="addressFull" property="addressFull"/>
         <result column="follow_count" property="followCount"/>
-
+        <result column="follow_staff_name" property="followStaffName"/>
+        <result column="create_time" property="createTime"  typeHandler="TimestampTypeHandler"/>
 
 
     </resultMap>
@@ -167,7 +168,7 @@
     <sql id="Condition_Join">
         <where>
             <if test="cusId != null and cusId != ''">
-                AND tccf.cus_id = #{cusId}
+                AND tccf.cus_id = #{cusId}::uuid
             </if>
             <if test="followStatus != null and followStatus != ''">
                 AND tccf.follow_status = #{followStatus}
@@ -258,6 +259,26 @@
         </if>
     </select>
 
+
+    <select id="selectByList" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List_Join"/>,
+        tmc.cus_name AS "cusName",
+        tmc.cus_phone AS "cusPhone",
+        tmc.address_full AS "addressFull",
+        tmo.org_name  AS  "orgName",
+        tms.staff_name  AS  "staffName",
+        tmc.follow_count AS follow_count,
+        tms.staff_name AS follow_staff_name,
+        tccf.op_create_time AS create_time
+        FROM dkic_b.t_crm_cus_follow tccf
+        LEFT JOIN dkic_b.t_mst_customer tmc ON tmc.cus_id = tccf.cus_id
+        LEFT JOIN dkic_b.t_mst_org tmo on tmo.org_id = tccf.follow_org
+        LEFT JOIN dkic_b.t_mst_staff tms on tms.staff_id = tccf.follow_staff
+        <include refid="Condition_Join"/>
+
+    </select>
+
     <!-- 查询表t_crm_cus_follow,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
         SELECT

+ 2 - 1
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.java

@@ -34,6 +34,7 @@ public interface CustomerMapper extends BaseMapper<Customer>{
      * @author : 于继渤
      * @date : 2022-05-26 14:05
      */
-    Object selectFollowStaffs(@Param("cusId") String customerId);
+    Object selectFollowStaffs(@Param("cusId") String cusId);
+    CustomerResponse selectByIdRespone(@Param("cusId") String cusId);
 }
 

+ 22 - 0
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -226,6 +226,7 @@
         SELECT
         count(1)
         FROM dkic_b.t_mst_customer tmc
+
         <include refid="Condition"/>
     </select>
 
@@ -237,6 +238,27 @@
         WHERE cus_id = #{cusId}::uuid
     </select>
 
+
+
+    <select id="selectByIdRespone" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List_Response"/>,
+        tmd.data_value  AS  "cusFromName",
+        tmsc.channel_name  AS  "channelName",
+        tmo.org_name  AS  "orgName",
+        tms.staff_name  AS  "staffName",
+        tms2.staff_name  AS  "reportStaffName",
+        tdk.kind_name_i18n  ->> 'zh_CN' AS "saleStatusName"
+        FROM dkic_b.t_mst_customer tmc
+        LEFT JOIN  dkic_b.t_mst_dictionary_data tmd  on tmd.data_id =  tmc.cus_from
+        LEFT JOIN  dkic_b.t_mst_sale_channel tmsc  on tmsc.channel_id =  tmc.channel_id
+        LEFT JOIN  dkic_b.t_mst_org tmo  on tmo.org_id =  tmc.org_id
+        LEFT JOIN  dkic_b.t_mst_staff tms  on tms.staff_id =  tmc.staff_id
+        LEFT JOIN  dkic_b.t_mst_staff tms2  on tms2.staff_id =  tmc.report_staff
+        LEFT JOIN  sys.t_data_kind tdk  on tdk.kind_code =  tmc.sale_status
+        WHERE cus_id = #{cusId}::uuid
+    </select>
+
     <!-- 根据主键锁定表t_mst_customer的一行数据 -->
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT

+ 4 - 0
src/main/java/com/dk/mdm/model/response/mst/CusFollowResponse.java

@@ -221,9 +221,13 @@ public class CusFollowResponse implements Serializable {
     private String cusPhone;
     private String orgName;
     private String staffName;
+    private String followStaffName;
     private String addressFull;
     private Integer followCount;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime createTime;
 
 
     private static final long serialVersionUID = 1L;

+ 4 - 0
src/main/java/com/dk/mdm/service/mst/CusFollowService.java

@@ -88,6 +88,10 @@ public class CusFollowService extends BaseService<CusFollow> {
                 cusFollowMapper.countByCond(cusFollowQuery));
     }
 
+    public ResponseResultVO<List<CusFollowResponse>> selectByList(CusFollowQuery cusFollowQuery) {
+       return ResponseResultUtil.success(cusFollowMapper.selectByList(cusFollowQuery)) ;
+    }
+
     /**
      * @desc : 新建
      * @author : 于继渤

+ 11 - 3
src/main/java/com/dk/mdm/service/mst/CustomerService.java

@@ -3,7 +3,6 @@ package com.dk.mdm.service.mst;
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.infrastructure.constant.Constant;
 import com.dk.common.infrastructure.enums.ErrorCodeEnum;
-import com.dk.common.infrastructure.util.LocalDateTimeUtils;
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
@@ -14,7 +13,6 @@ import com.dk.mdm.model.pojo.mst.Customer;
 import com.dk.mdm.mapper.mst.CustomerMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
-import com.dk.mdm.model.pojo.mst.Org;
 import com.dk.mdm.model.query.mst.CustomerQuery;
 import com.dk.mdm.model.response.mst.CustomerResponse;
 import com.dk.mdm.model.vo.mst.CustomerVO;
@@ -22,10 +20,10 @@ import com.dk.mdm.service.common.CommonService;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PathVariable;
 
 import java.time.LocalDateTime;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -137,4 +135,14 @@ public class CustomerService extends BaseService<Customer> {
         super.updateByUuid(customer);
         return ResponseResultUtil.success();
     }
+
+
+    public ResponseResultVO<CustomerResponse> selectByIdRespone(@PathVariable String id) {
+        CustomerResponse customerResponse = customerMapper.selectByIdRespone(id);
+        if (customerResponse == null) {
+            return ResponseResultUtil.error(ResponseCodeEnum.SELECT_NULL);
+        }
+        return ResponseResultUtil.success(customerResponse);
+    }
+
 }