From 4b85397fa2b5b98756752d6e922897b79aec08d8 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 28 Jun 2021 11:41:27 +0800
Subject: [PATCH] modify

---
 gc-user/src/main/java/com/xzx/gc/user/mapper/JhyInfoMapper.java              |    6 +++
 gc-core/src/main/resources/application.properties                            |    2 
 gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java            |   25 ++++++++++--
 gc-user/src/main/java/com/xzx/gc/user/controller/AdminJhyInfoController.java |   15 +++++++
 gc-user/src/main/java/com/xzx/gc/user/dto/JhyInfoListDto.java                |   25 ++++++++++++
 gc-core/src/main/java/com/xzx/gc/entity/JhyInfo.java                         |    2 
 gc-user/src/main/resources/mapper/user/JhyInfoMapper.xml                     |   17 ++++++++
 7 files changed, 85 insertions(+), 7 deletions(-)

diff --git a/gc-core/src/main/java/com/xzx/gc/entity/JhyInfo.java b/gc-core/src/main/java/com/xzx/gc/entity/JhyInfo.java
index b1d52e5..c4f3209 100644
--- a/gc-core/src/main/java/com/xzx/gc/entity/JhyInfo.java
+++ b/gc-core/src/main/java/com/xzx/gc/entity/JhyInfo.java
@@ -31,7 +31,7 @@
     /**
      * 是否集物员 1-是 2-否
      */
-    private String isJyh;
+    private String isJhy;
 
     /**
      * 审核状态 1-待审核 2-审核通过 3-审核拒绝
diff --git a/gc-core/src/main/resources/application.properties b/gc-core/src/main/resources/application.properties
index 832738b..b09f250 100644
--- a/gc-core/src/main/resources/application.properties
+++ b/gc-core/src/main/resources/application.properties
@@ -11,7 +11,7 @@
 
 
 #log
-project.log.path=/xzx/logs
+project.log.path=xzx/logs
 logstash.server.url=localhost:4560
 
 #spring
diff --git a/gc-user/src/main/java/com/xzx/gc/user/controller/AdminJhyInfoController.java b/gc-user/src/main/java/com/xzx/gc/user/controller/AdminJhyInfoController.java
index 526fa7c..3984a19 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/controller/AdminJhyInfoController.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/controller/AdminJhyInfoController.java
@@ -1,11 +1,20 @@
 package com.xzx.gc.user.controller;
 
+import com.xzx.gc.common.constant.Constants;
 import com.xzx.gc.common.request.BaseController;
+import com.xzx.gc.model.JsonResult;
+import com.xzx.gc.user.dto.JhyInfoListDto;
 import com.xzx.gc.user.service.JhyInfoService;
+import com.xzx.gc.user.vo.JhyInfoListVo;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
 
 @RestController
 @Api(tags = {"集物员--集物员管理"})
@@ -15,5 +24,9 @@
     @Autowired
     private JhyInfoService jhyInfoService;
 
-
+    @ApiOperation(value = "集货员信息列表")
+    @PostMapping(value = Constants.ADMIN_VIEW_PREFIX + "/jhy/list.json")
+    public JsonResult<Map<String, Object>> jhyList(@RequestBody JhyInfoListDto jhyInfoListDto) {
+        return JsonResult.success(jhyInfoService.queryList(jhyInfoListDto));
+    }
 }
diff --git a/gc-user/src/main/java/com/xzx/gc/user/dto/JhyInfoListDto.java b/gc-user/src/main/java/com/xzx/gc/user/dto/JhyInfoListDto.java
new file mode 100644
index 0000000..ec3aa6b
--- /dev/null
+++ b/gc-user/src/main/java/com/xzx/gc/user/dto/JhyInfoListDto.java
@@ -0,0 +1,25 @@
+package com.xzx.gc.user.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "JhyInfoListDto", description = "后台集货员列表接收参数类")
+public class JhyInfoListDto {
+
+    @ApiModelProperty(value = "第几页", required = true)
+    private int page;
+
+    @ApiModelProperty(value = "每一页数量", required = true)
+    private int limit;
+
+    @ApiModelProperty(value = "是否集货员 1-是2-否")
+    private Integer isJhy;
+
+    @ApiModelProperty(value = "查询字段")
+    private String name;
+
+    @ApiModelProperty(value = "审核状态 1-待审核 2-审核通过 3-审核拒绝")
+    private Integer status;
+}
diff --git a/gc-user/src/main/java/com/xzx/gc/user/mapper/JhyInfoMapper.java b/gc-user/src/main/java/com/xzx/gc/user/mapper/JhyInfoMapper.java
index 7e4a0b2..01d17d3 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/mapper/JhyInfoMapper.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/mapper/JhyInfoMapper.java
@@ -1,8 +1,12 @@
 package com.xzx.gc.user.mapper;
 
 import com.xzx.gc.entity.JhyInfo;
+import com.xzx.gc.user.dto.JhyInfoListDto;
+import com.xzx.gc.user.vo.JhyInfoListVo;
 import com.xzx.gc.util.GcMapper;
 import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface JhyInfoMapper extends GcMapper<JhyInfo> {
 
@@ -13,4 +17,6 @@
     JhyInfo selectJhyInfoByUserId(@Param("userId") String userId);
 
     JhyInfo selectExistJhyByIndeityOrMobile(@Param("mobile") String mobile, @Param("identity") String Identity);
+
+    List<JhyInfoListVo> selectJhyInfoList(@Param("record") JhyInfoListDto jhyInfoListDto);
 }
diff --git a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
index c547913..c8d3d1a 100644
--- a/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
+++ b/gc-user/src/main/java/com/xzx/gc/user/service/JhyInfoService.java
@@ -1,15 +1,23 @@
 package com.xzx.gc.user.service;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.xzx.gc.common.exception.RestException;
 import com.xzx.gc.entity.JhyInfo;
 import com.xzx.gc.user.dto.JhyApplyDto;
+import com.xzx.gc.user.dto.JhyInfoListDto;
 import com.xzx.gc.user.mapper.JhyInfoMapper;
+import com.xzx.gc.user.vo.JhyInfoListVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service
 @Transactional
@@ -49,10 +57,19 @@
             return false;
         }
 
-        if (JhyInfo.CHECK_PASS.equals(jhyInfo.getStatus())) {
-            return true;
-        }
+        return JhyInfo.CHECK_PASS.equals(jhyInfo.getStatus());
+    }
 
-        return false;
+    public Map<String, Object> queryList(JhyInfoListDto jhyInfoListDto) {
+        PageHelper.startPage(jhyInfoListDto.getPage(), jhyInfoListDto.getLimit());
+        List<JhyInfoListVo> jhyInfoListVos = jhyInfoMapper.selectJhyInfoList(jhyInfoListDto);
+        PageInfo<JhyInfoListVo> pageInfo = new PageInfo<>(jhyInfoListVos);
+
+        Map<String, Object> data = new HashMap<>();
+        int count = Convert.toInt(pageInfo.getTotal());
+        data.put("data", jhyInfoListVos);
+        data.put("count", count);
+        data.put("code", 0);
+        return data;
     }
 }
diff --git a/gc-user/src/main/resources/mapper/user/JhyInfoMapper.xml b/gc-user/src/main/resources/mapper/user/JhyInfoMapper.xml
index 2dd4a67..9c3171b 100644
--- a/gc-user/src/main/resources/mapper/user/JhyInfoMapper.xml
+++ b/gc-user/src/main/resources/mapper/user/JhyInfoMapper.xml
@@ -17,4 +17,21 @@
     <select id="selectExistJhyByIndeityOrMobile" resultType="com.xzx.gc.entity.JhyInfo">
         select * from xzx_jhy_info where (mobile=#{mobile} or identity = #{identity}) and status in (1, 2)
     </select>
+
+    <select id="selectJhyInfoList" resultType="com.xzx.gc.user.vo.JhyInfoListVo">
+        select * from xzx_jhy_info
+        <where>
+            1=1
+            <if test="record.name != null and record.name != ''">
+                and (username like CONCAT(CONCAT(#{record.name}, '%'), '%') or phone=#{record.phone})
+            </if>
+            <if test="record.isJhy != null and record.name != ''">
+                and is_jhy=#{record.isJhy}
+            </if>
+            <if test="record.status != null">
+                and status = #{record.status}
+            </if>
+        </where>
+        order by id desc;
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1