zxz 2 лет назад
Родитель
Сommit
9e410677c7

+ 10 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/OpenServiceInfoController.java

@@ -41,6 +41,16 @@ public class OpenServiceInfoController {
     public String addInfo(@RequestBody OpenServiceInfo openServiceInfo) {
         return iOpenServiceInfoService.addInfo(openServiceInfo);
     }
+    /**
+     * 客服留言列表
+     *
+     * @param openServiceInfo
+     * @return
+     */
+    @GetMapping("/selectOpenServiceList")
+    public Page<OpenServiceInfo> selectOpenServiceList(OpenServiceInfo openServiceInfo) {
+        return iOpenServiceInfoService.selectOpenServiceList(openServiceInfo);
+    }
     /**
      * 查询当前人的公司
      * @param phone

+ 6 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/OpenServiceInfo.java

@@ -3,6 +3,7 @@ package com.yh.saas.plugin.yiliangyiyun.entity;
 import com.baomidou.mybatisplus.activerecord.Model;
 import java.io.Serializable;
 
+import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
 import com.baomidou.mybatisplus.annotations.Version;
@@ -51,6 +52,11 @@ public class OpenServiceInfo extends BaseModel<OpenServiceInfo> {
      */
     private String type;
 
+    /**
+     * 模糊查询
+     */
+    @TableField(exist = false)
+    private String searchKeyWord;
 
     @Override
     protected Serializable pkVal() {

+ 17 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/OpenServiceInfoMapper.java

@@ -3,6 +3,9 @@ package com.yh.saas.plugin.yiliangyiyun.mapper;
 import com.yh.saas.plugin.yiliangyiyun.entity.OpenServiceInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  * 开通业务表 Mapper 接口
@@ -12,5 +15,19 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  * @since 2021-10-08
  */
 public interface OpenServiceInfoMapper extends BaseMapper<OpenServiceInfo> {
+    /**
+     * 根据条件查询留言总数
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getOpenServiceCountByCondition(Map<String, Object> pageView);
 
+    /**
+     * 根据条件查询留言列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<OpenServiceInfo> getOpenServiceListByCondition(Map<String, Object> pageView);
 }

+ 7 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IOpenServiceInfoService.java

@@ -27,6 +27,13 @@ public interface IOpenServiceInfoService extends IService<OpenServiceInfo> {
      * @param openServiceInfo
      */
     String addInfo(OpenServiceInfo openServiceInfo);
+    /**
+     * 客服留言列表
+     *
+     * @param openServiceInfo
+     * @return
+     */
+    Page<OpenServiceInfo> selectOpenServiceList(OpenServiceInfo openServiceInfo);
     /**
      * 查询当前人的公司
      *

+ 29 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/OpenServiceInfoServiceImpl.java

@@ -2,6 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
 import com.winsea.svc.base.base.entity.CommonCompany;
 import com.winsea.svc.base.base.entity.CommonStaff;
 import com.winsea.svc.base.base.service.ICommonCompanyService;
@@ -16,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -61,7 +64,32 @@ public class OpenServiceInfoServiceImpl extends ServiceImpl<OpenServiceInfoMappe
             return "NG";
         }
     }
-
+    /**
+     * 客服留言列表
+     *
+     * @param openServiceInfo
+     * @return
+     */
+    @Override
+    public Page<OpenServiceInfo> selectOpenServiceList(OpenServiceInfo openServiceInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (openServiceInfo.getCurrentPage() - 1)
+                * openServiceInfo.getPageSize());
+        //公司id
+        pageView.put("id", openServiceInfo.getId());
+        pageView.put("searchKeyWord", openServiceInfo.getSearchKeyWord());
+        pageView.put("pageSize", openServiceInfo.getPageSize());
+        pageView.put("currentPage", openServiceInfo.getCurrentPage());
+        // 查询客服留言总数
+        Integer dataCount = baseMapper.getOpenServiceCountByCondition(pageView);
+        List<OpenServiceInfo> dataList = baseMapper.getOpenServiceListByCondition(pageView);
+        Page<OpenServiceInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(openServiceInfo.getCurrentPage());
+        page.setSize(openServiceInfo.getPageSize());
+        return page;
+    }
     @Override
     public List<CommonCompany> selectCommonCompany(String phone) {
         List temp=new ArrayList();

+ 31 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/OpenServiceInfoMapper.xml

@@ -1,5 +1,35 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yh.saas.plugin.yiliangyiyun.mapper.OpenServiceInfoMapper">
-
+    <!-- 获得留言总数 -->
+    <select id="getOpenServiceCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(id)
+        FROM open_service_info
+        WHERE delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(mobile_phone) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+    </select>
+    <!-- 获得留言列表 -->
+    <select id="getOpenServiceListByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.OpenServiceInfo">
+        SELECT
+        id,
+        name as name,
+        mobile_phone as mobilePhone,
+        message,
+        create_date as createDate
+        FROM open_service_info
+        WHERE delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(mobile_phone) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        ORDER BY create_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>