Forráskód Böngészése

后台 用户列表展示新增字段

limingming 1 éve
szülő
commit
93ea2be36e

+ 10 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/UserInfoController.java

@@ -1,6 +1,5 @@
 package com.ruoyi.web.controller.platform;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.controller.BaseController;
@@ -11,7 +10,10 @@ import com.ruoyi.system.domain.UserInfo;
 import com.ruoyi.system.service.UserAddressService;
 import com.ruoyi.system.service.UserInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+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.RestController;
 
 /**
  * 用户信息Controller
@@ -34,8 +36,12 @@ public class UserInfoController extends BaseController {
 //    @PreAuthorize("@ss.hasPermi('system:info:list')")
     @PostMapping("/list")
     public R<IPage<UserInfo>> list(@RequestBody  BaseParam param) {
-        IPage<UserInfo> userInfoIPage = userInfoService.page(new Page<UserInfo>().setCurrent(param.getCurrent()).setSize(param.getSize()),
-                new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getDelFlag,0));
+        Page<UserInfo> page = new Page<>(param.getCurrent(), param.getSize());
+        IPage<UserInfo> userInfoIPage = userInfoService.getUserInfoList(page,null);
+//        IPage<UserInfo> userInfoIPage = userInfoService.page(new Page<UserInfo>().setCurrent(param.getCurrent()).setSize(param.getSize()),
+//                new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getDelFlag,0));
+
+        //新加用户创建时间 用户地址的经纬度
         return R.ok(userInfoIPage);
     }
 

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserInfo.java

@@ -54,4 +54,18 @@ public class UserInfo implements Serializable {
     @TableField(exist = false)
     private String code;
 
+    /** 经度 */
+    @TableField(exist = false)
+    private String longitude;
+
+    /** 纬度 */
+    @TableField(exist = false)
+    private String latitude;
+
+
+    /** 定位时间 */
+    @TableField(exist = false)
+    private String positionTime;
+
+
 }

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserInfoMapper.java

@@ -1,7 +1,10 @@
 package com.ruoyi.system.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.system.domain.UserInfo;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 用户信息Mapper接口
@@ -11,4 +14,5 @@ import com.ruoyi.system.domain.UserInfo;
  */
 public interface UserInfoMapper extends BaseMapper<UserInfo> {
 
+    IPage<UserInfo> getUserInfoList(Page<UserInfo> page, @Param("param") String param);
 }

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/UserInfoService.java

@@ -1,5 +1,7 @@
 package com.ruoyi.system.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.system.domain.UserInfo;
 
@@ -11,4 +13,5 @@ import com.ruoyi.system.domain.UserInfo;
  */
 public interface UserInfoService  extends IService<UserInfo> {
 
+    IPage<UserInfo> getUserInfoList(Page<UserInfo> page, String param);
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserInfoServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ruoyi.system.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.system.domain.UserInfo;
 import com.ruoyi.system.mapper.UserInfoMapper;
@@ -15,4 +17,8 @@ import org.springframework.stereotype.Service;
 @Service
 public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {
 
+    @Override
+    public IPage<UserInfo> getUserInfoList(Page<UserInfo> page, String param) {
+        return this.baseMapper.getUserInfoList(page,param);
+    }
 }

+ 10 - 0
ruoyi-system/src/main/resources/mapper/system/platform/UserInfoMapper.xml

@@ -17,6 +17,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <sql id="selectTUserInfoVo">
         select id, user_phone, del_flag, create_by, create_time, update_by, update_time from t_user_info
     </sql>
+    <select id="getUserInfoList" resultType="com.ruoyi.system.domain.UserInfo">
+        SELECT a.*, c.latitude, c.longitude, c.max_create_time AS positionTime
+        FROM t_user_info a
+                 LEFT JOIN (
+            SELECT b.user_id, MAX(b.create_time) AS max_create_time, b.latitude, b.longitude
+            FROM t_user_address b
+            GROUP BY b.user_id
+        ) c ON a.id = c.user_id
+        WHERE a.del_flag = 0
+    </select>
 
 
 </mapper>