mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 11:51:55 +08:00
[feat] 新增根据手机号模糊查询用户的接口
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.6.41.0.3</version>
|
||||
<version>3.6.41.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>3.6.41.0.3</version>
|
||||
<version>3.6.41.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>3.6.41.0.3</version>
|
||||
<version>3.6.41.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>3.6.41.0.3</version>
|
||||
<version>3.6.41.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>3.6.41.0.3</version>
|
||||
<version>3.6.41.0.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.system.api.domain.SysUser;
|
||||
|
||||
@@ -51,6 +53,14 @@ public interface SysUserMapper
|
||||
*/
|
||||
public SysUser selectUserByPhoneNumber(String phoneNumber);
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户
|
||||
*
|
||||
* @param phoneNumber 手机号
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public Page<SysUser> findByPhoneNumberStartingWith(String phoneNumber);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.ruoyi.system.api.domain.SysUser;
|
||||
|
||||
/**
|
||||
@@ -58,6 +60,14 @@ public interface ISysUserService
|
||||
*/
|
||||
public SysUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户
|
||||
*
|
||||
* @param phoneNumber 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public Page<SysUser> findByPhoneNumberStartingWith(String phoneNumber);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户所属角色组
|
||||
*
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -127,6 +129,17 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
return userMapper.selectUserByPhoneNumber(phoneNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过手机号查询用户
|
||||
*
|
||||
* @param phoneNumber 手机号
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public Page<SysUser> findByPhoneNumberStartingWith(String phoneNumber) {
|
||||
return userMapper.findByPhoneNumberStartingWith(phoneNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.controller.inner
|
||||
|
||||
import com.github.pagehelper.Page
|
||||
import com.ruoyi.common.core.domain.R
|
||||
import com.ruoyi.common.core.utils.StringUtils
|
||||
import com.ruoyi.common.core.web.controller.BaseController
|
||||
@@ -56,6 +57,15 @@ open class InnerSysUserController : BaseController() {
|
||||
return R.ok(sysUserVo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
*/
|
||||
@InnerAuth
|
||||
@GetMapping("/list/phoneNumber/{phoneNumber:\\d+}")
|
||||
fun findByPhoneNumberStartingWith(@PathVariable("phoneNumber") phoneNumber: String?): R<Page<SysUser>> {
|
||||
return R.ok(userService.findByPhoneNumberStartingWith(phoneNumber))
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取用户信息
|
||||
*/
|
||||
|
||||
@@ -146,6 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectUserVo"/>
|
||||
where u.phonenumber = #{phoneNumber} and u.del_flag = '0'
|
||||
</select>
|
||||
<select id="findByPhoneNumberStartingWith" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.phonenumber = CONCAT(#{phoneNumber},"%") and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
|
||||
Reference in New Issue
Block a user