调整用户新增接口

增加按手机号查询用户接口
master
panqihua 2 years ago
parent 4e30d3c6c2
commit 5ac36d3529
  1. 33
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  2. 10
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
  3. 11
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  4. 35
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  5. 6
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@ -1,21 +1,5 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
@ -32,6 +16,16 @@ import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户信息
@ -253,4 +247,11 @@ public class SysUserController extends BaseController
{
return success(deptService.selectDeptTreeList(dept));
}
@PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@GetMapping("/phonenumber/{phonenumber}")
public AjaxResult select(@PathVariable String phonenumber){
return success(userService.queryUserByPhone(phonenumber));
}
}

@ -1,15 +1,17 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户表 数据层
*
* @author ruoyi
*/
public interface SysUserMapper
public interface SysUserMapper extends BaseMapper<SysUser>
{
/**
* 根据条件分页查询用户列表
@ -124,4 +126,4 @@ public interface SysUserMapper
* @return 结果
*/
public SysUser checkEmailUnique(String email);
}
}

@ -1,8 +1,9 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import java.util.List;
/**
* 用户 业务层
*
@ -203,4 +204,12 @@ public interface ISysUserService
* @return 结果
*/
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
/**
* 查询用户信息
* @param phonenumber 手机号码
* @return 结果
*/
public List<SysUser> queryUserByPhone(String phonenumber);
}

@ -1,15 +1,6 @@
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysRole;
@ -22,13 +13,20 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysPostMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserPostMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户 业务层处理
@ -540,4 +538,11 @@ public class SysUserServiceImpl implements ISysUserService
}
return successMsg.toString();
}
@Override
public List<SysUser> queryUserByPhone(String phonenumber) {
LambdaQueryWrapper<SysUser> wrapper=new LambdaQueryWrapper<>();
wrapper.select(SysUser::getUserId,SysUser::getPhonenumber).like(SysUser::getPhonenumber,phonenumber);
return userMapper.selectList(wrapper);
}
}

@ -163,6 +163,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="wechatNickName != null and wechatNickName != ''">wechat_nick_name,</if>
<if test="balance != null and balance != ''">balance,</if>
<if test="referrerId != null and referrerId != ''">referrer_id,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
@ -177,6 +180,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="wechatNickName != null and wechatNickName != ''">#{wechatNickName},</if>
<if test="balance != null and balance != ''">#{balance},</if>
<if test="referrerId != null and referrerId != ''">#{referrerId},</if>
sysdate()
)
</insert>

Loading…
Cancel
Save