公众号登录
This commit is contained in:
parent
2870de3d22
commit
2758850d1f
@ -1,153 +1,176 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/utils/request";
|
||||
import { praseStrEmpty } from "@/utils/ruoyi";
|
||||
|
||||
// 查询用户列表
|
||||
export function listUser(query) {
|
||||
return request({
|
||||
url: '/system/user/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/list",
|
||||
method: "get",
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
// 查询用户列表
|
||||
export function listlrrUser(query) {
|
||||
return request({
|
||||
url: '/system/user/lrrlist',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/lrrlist",
|
||||
method: "get",
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
// 查询用户详细
|
||||
export function getUser(userId) {
|
||||
return request({
|
||||
url: '/system/user/' + praseStrEmpty(userId),
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/" + praseStrEmpty(userId),
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 查询用户列表根据roleId
|
||||
export function getUsersByRoleId() {
|
||||
return request({
|
||||
url: '/system/user/listbyroleid',
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/listbyroleid",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 根据roleid查询用户列表
|
||||
export function getUserOnlyByRoleId(roleId) {
|
||||
return request({
|
||||
url: '/system/user/onlybyroleid/' + roleId,
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/onlybyroleid/" + roleId,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 新增用户
|
||||
export function addUser(data) {
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/system/user",
|
||||
method: "post",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export function updateUser(data) {
|
||||
return request({
|
||||
url: '/system/user',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/system/user",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function delUser(userId) {
|
||||
return request({
|
||||
url: '/system/user/' + userId,
|
||||
method: 'delete'
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/" + userId,
|
||||
method: "delete"
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定微信
|
||||
export function bindwx(code) {
|
||||
return request({
|
||||
url: "/system/user/bindwx/" + code,
|
||||
method: "post"
|
||||
});
|
||||
}
|
||||
|
||||
// 是否已经绑定微信
|
||||
export function isbindwx() {
|
||||
return request({
|
||||
url: "/system/user/isbindwx",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 导出用户
|
||||
export function exportUser(query) {
|
||||
return request({
|
||||
url: '/system/user/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/export",
|
||||
method: "get",
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export function resetUserPwd(userId, password) {
|
||||
const data = {
|
||||
userId,
|
||||
password
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/resetPwd',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
const data = {
|
||||
userId,
|
||||
password
|
||||
};
|
||||
return request({
|
||||
url: "/system/user/resetPwd",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 用户状态修改
|
||||
export function changeUserStatus(userId, status) {
|
||||
const data = {
|
||||
userId,
|
||||
status
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/changeStatus',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
const data = {
|
||||
userId,
|
||||
status
|
||||
};
|
||||
return request({
|
||||
url: "/system/user/changeStatus",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 查询用户个人信息
|
||||
export function getUserProfile() {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'get'
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/profile",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 修改用户个人信息
|
||||
export function updateUserProfile(data) {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/profile",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 用户密码重置
|
||||
export function updateUserPwd(oldPassword, newPassword) {
|
||||
const data = {
|
||||
oldPassword,
|
||||
newPassword
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/profile/updatePwd',
|
||||
method: 'put',
|
||||
params: data
|
||||
})
|
||||
const data = {
|
||||
oldPassword,
|
||||
newPassword
|
||||
};
|
||||
return request({
|
||||
url: "/system/user/profile/updatePwd",
|
||||
method: "put",
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
// 用户头像上传
|
||||
export function uploadAvatar(data) {
|
||||
return request({
|
||||
url: '/system/user/profile/avatar',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
return request({
|
||||
url: "/system/user/profile/avatar",
|
||||
method: "post",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
// 下载用户导入模板
|
||||
export function importTemplate() {
|
||||
return request({
|
||||
url: '/system/user/importTemplate',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
return request({
|
||||
url: "/system/user/importTemplate",
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
// 登录方法
|
||||
export function wxlogin(code) {
|
||||
return request({
|
||||
url: "/wxlogin/" + code,
|
||||
method: "post"
|
||||
});
|
||||
}
|
||||
|
@ -42,6 +42,9 @@
|
||||
<el-dropdown-item @click.native="setting = true">
|
||||
<span>布局设置</span>
|
||||
</el-dropdown-item>
|
||||
<!-- <router-link to="/user/bind/wx">
|
||||
<el-dropdown-item>绑定微信</el-dropdown-item>
|
||||
</router-link> -->
|
||||
<el-dropdown-item divided @click.native="logout">
|
||||
<span>退出登录</span>
|
||||
</el-dropdown-item>
|
||||
|
@ -22,7 +22,7 @@ NProgress.configure({
|
||||
})
|
||||
|
||||
//const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
|
||||
const whiteList = ['/login', '/experience/apply/', '/experience/result/', '/experience/content/', '/benyi_child/child_preserve']
|
||||
const whiteList = ['/login','/wxlogin', '/experience/apply/', '/experience/result/', '/experience/content/', '/benyi_child/child_preserve']
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
|
@ -41,6 +41,12 @@ export const constantRoutes = [{
|
||||
import ('@/views/login'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/wxlogin',
|
||||
component: () =>
|
||||
import ('@/views/wxlogin'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/404',
|
||||
component: () =>
|
||||
@ -153,6 +159,22 @@ export const constantRoutes = [{
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
path: '/user/bind',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
redirect: 'noredirect',
|
||||
children: [{
|
||||
path: 'wx',
|
||||
component: () =>
|
||||
import ('@/views/system/user/wx/index'),
|
||||
name: 'Wx',
|
||||
meta: {
|
||||
title: '绑定微信',
|
||||
icon: ''
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
path: '/user/change',
|
||||
component: Layout,
|
||||
@ -165,7 +187,7 @@ export const constantRoutes = [{
|
||||
name: 'Changedept',
|
||||
meta: {
|
||||
title: '切换岗位',
|
||||
icon: 'user'
|
||||
icon: ''
|
||||
}
|
||||
}]
|
||||
},
|
||||
|
@ -55,6 +55,7 @@ import RaddarChart from "./dashboard/RaddarChart";
|
||||
import PieChart from "./dashboard/PieChart";
|
||||
import BarChart from "./dashboard/BarChart";
|
||||
import LineChart from "./dashboard/LineChart";
|
||||
import { bindwx, isbindwx, wxlogin } from "@/api/system/user";
|
||||
//import { getSchoolCalendars } from "@/api/benyi/schoolcalendar";
|
||||
//备用进行班级园历显示操作import { getSchoolCalendarsClass } from "@/api/benyi/schoolcalendarclass";
|
||||
|
||||
@ -69,6 +70,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
code: "",
|
||||
calendarData: [],
|
||||
value: new Date(),
|
||||
// 查询参数
|
||||
@ -77,9 +79,31 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.code = this.$route.query.code;
|
||||
//console.log(this.code);
|
||||
this.bindWxInfo();
|
||||
//this.getSchoolCalendarList();
|
||||
},
|
||||
methods: {
|
||||
async bindWxInfo() {
|
||||
await isbindwx().then((res) => {
|
||||
if (this.code != "" && this.code != null && res.msg == "1") {
|
||||
//console.log("绑定微信");
|
||||
this.$confirm("当前账号要绑定微信登录吗?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
return bindwx(this.code);
|
||||
})
|
||||
.then(() => {
|
||||
this.msgSuccess("绑定成功");
|
||||
})
|
||||
.catch(function () {});
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 查询园历列表 */
|
||||
// getSchoolCalendarList() {
|
||||
// getSchoolCalendars(this.queryParams).then(response => {
|
||||
|
86
ruoyi-ui/src/views/system/user/wx/index.vue
Normal file
86
ruoyi-ui/src/views/system/user/wx/index.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :xs="24" :sm="12" :md="8">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>个人信息</span>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="list-group list-group-striped">
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="user" />用户名称
|
||||
<div class="pull-right">{{ user.userName }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="phone" />手机号码
|
||||
<div class="pull-right">{{ user.phonenumber }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="email" />用户邮箱
|
||||
<div class="pull-right">{{ user.email }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="tree" />所属部门
|
||||
<div class="pull-right" v-if="user.dept">
|
||||
{{ user.dept.deptName }} / {{ postGroup }}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="peoples" />所属角色
|
||||
<div class="pull-right">{{ roleGroup }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="date" />创建日期
|
||||
<div class="pull-right">{{ user.createTime }}</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="star" />是否绑定微信
|
||||
<div class="pull-right">{{ wxOpenId }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
<el-button
|
||||
v-if="!wxOpenId"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="submit"
|
||||
>绑定</el-button
|
||||
>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getUserProfile } from "@/api/system/user";
|
||||
|
||||
export default {
|
||||
name: "Profile",
|
||||
data() {
|
||||
return {
|
||||
code: "",
|
||||
user: {},
|
||||
roleGroup: {},
|
||||
postGroup: {},
|
||||
wxOpenId: "",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getUser();
|
||||
},
|
||||
methods: {
|
||||
getUser() {
|
||||
getUserProfile().then((response) => {
|
||||
this.user = response.data;
|
||||
// console.log(this.user);
|
||||
this.wxOpenId = this.user.openId;
|
||||
this.roleGroup = response.roleGroup;
|
||||
this.postGroup = response.postGroup;
|
||||
});
|
||||
},
|
||||
submit() {},
|
||||
},
|
||||
};
|
||||
</script>
|
39
ruoyi-ui/src/views/wxlogin.vue
Normal file
39
ruoyi-ui/src/views/wxlogin.vue
Normal file
@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div class="dashboard-editor-container"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { wxlogin } from "@/api/system/user";
|
||||
import { getToken, setToken, removeToken } from "@/utils/auth";
|
||||
|
||||
export default {
|
||||
name: "wxLogin",
|
||||
data() {
|
||||
return {
|
||||
code: "",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.code = this.$route.query.code;
|
||||
this.wxLogin();
|
||||
},
|
||||
methods: {
|
||||
wxLogin() {
|
||||
if(getToken()){
|
||||
this.$router.push({ path: "/index?code="+this.code });
|
||||
return;
|
||||
}
|
||||
if (this.code != "" && this.code != null) {
|
||||
//console.log("zhixing");
|
||||
wxlogin(this.code).then((res) => {
|
||||
console.log(res);
|
||||
if (res.code == "200") {
|
||||
setToken(res.token);
|
||||
this.$router.push({ path: "/index" });
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -86,7 +86,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 对于登录login 验证码captchaImage 允许匿名访问
|
||||
.antMatchers("/login", "/captchaImage").anonymous()
|
||||
.antMatchers("/login","/wxlogin/**", "/captchaImage").anonymous()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
"/*.html",
|
||||
|
@ -102,4 +102,53 @@ public class SysLoginService {
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
public String wxlogin(String username, String password) {
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try {
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager
|
||||
.authenticate(new UsernamePasswordAuthenticationToken(username, password));
|
||||
} catch (Exception e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
} else {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new CustomException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys) {
|
||||
try {
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isNotEmpty(username) && StringUtils.isNotNull(user.getUser())) {
|
||||
if (StringUtils.equals(username, user.getUsername())) {
|
||||
//存在已经登录用户,抛出异常
|
||||
// CustomException alreadyLoginExcep = new CustomException("该账号已在别处登陆", HttpStatus.ALREADY_LOGIN);
|
||||
// alreadyLoginExcep.setObj(username);
|
||||
// throw alreadyLoginExcep;
|
||||
redisCache.deleteObject(key);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,15 @@ package com.ruoyi.project.system.controller;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.framework.redis.RedisCache;
|
||||
import com.ruoyi.project.system.domain.BySchool;
|
||||
import com.ruoyi.project.system.service.IBySchoolService;
|
||||
import com.ruoyi.project.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.framework.security.LoginBody;
|
||||
@ -25,12 +26,20 @@ import com.ruoyi.project.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysLoginController
|
||||
{
|
||||
public class SysLoginController {
|
||||
@Value("${wx.appid}")
|
||||
private String appid;
|
||||
|
||||
@Value("${wx.secret}")
|
||||
private String secret;
|
||||
|
||||
@Value("${wx.domain}")
|
||||
private String domain;
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@ -43,21 +52,24 @@ public class SysLoginController
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
// @Autowired
|
||||
// private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @param captcha 验证码
|
||||
* @param uuid 唯一标识
|
||||
* @param captcha 验证码
|
||||
* @param uuid 唯一标识
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
@ -66,6 +78,36 @@ public class SysLoginController
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/wxlogin/{code}")
|
||||
public AjaxResult wxlogin(@PathVariable String code) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = "";
|
||||
String url = domain;
|
||||
String parmas = "appid=" + appid + "&secret=" + secret + "&code=" + code + "&grant_type=authorization_code";
|
||||
System.out.println(parmas);
|
||||
String strResult = HttpUtils.sendGet(url, parmas);
|
||||
JSONObject jsonObject = JSONObject.parseObject(strResult);
|
||||
try {
|
||||
String openId = jsonObject.get("openid").toString();
|
||||
SysUser sysUser = userService.selectUserByWxId(openId);
|
||||
if (sysUser != null) {
|
||||
token = loginService.wxlogin(sysUser.getUserName(), sysUser.getPw());
|
||||
} else {
|
||||
return AjaxResult.error("登录失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("登录失败");
|
||||
}
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 将在其他地方登陆的账号强退
|
||||
// *
|
||||
@ -82,12 +124,11 @@ public class SysLoginController
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
public AjaxResult getInfo() {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
SysUser user = loginUser.getUser();
|
||||
// 角色集合
|
||||
@ -104,12 +145,11 @@ public class SysLoginController
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
public AjaxResult getRouters() {
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 用户信息
|
||||
SysUser user = loginUser.getUser();
|
||||
|
@ -3,11 +3,15 @@ package com.ruoyi.project.system.controller;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.project.common.SchoolCommon;
|
||||
import com.ruoyi.project.system.domain.ByTeacherJbxx;
|
||||
import com.ruoyi.project.system.domain.SysDept;
|
||||
import com.ruoyi.project.system.service.*;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@ -41,6 +45,16 @@ import com.ruoyi.project.system.domain.SysUser;
|
||||
@RestController
|
||||
@RequestMapping("/system/user")
|
||||
public class SysUserController extends BaseController {
|
||||
|
||||
@Value("${wx.appid}")
|
||||
private String appid;
|
||||
|
||||
@Value("${wx.secret}")
|
||||
private String secret;
|
||||
|
||||
@Value("${wx.domain}")
|
||||
private String domain;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@ -76,15 +90,15 @@ public class SysUserController extends BaseController {
|
||||
|
||||
@GetMapping("/lrrlist")
|
||||
public TableDataInfo lrrlist(SysUser user) {
|
||||
int l1=103;
|
||||
int l1 = 103;
|
||||
user.setDeptId(Long.valueOf(l1));
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
|
||||
int l2=105;
|
||||
int l2 = 105;
|
||||
user.setDeptId(Long.valueOf(l2));
|
||||
list.addAll(userService.selectUserList(user));
|
||||
|
||||
int l3=107;
|
||||
int l3 = 107;
|
||||
user.setDeptId(Long.valueOf(l3));
|
||||
list.addAll(userService.selectUserList(user));
|
||||
|
||||
@ -263,18 +277,18 @@ public class SysUserController extends BaseController {
|
||||
}
|
||||
|
||||
//先判断前端的roleids是否有变化
|
||||
boolean isPd=true;
|
||||
boolean isPd = true;
|
||||
if (schoolCommon.isSchool() == true) {
|
||||
List<Integer> roleIdsOld = roleService.selectYeyRoleListByUserId(user.getUserId());
|
||||
if(roleIdsOld!=null&&roleIdsOld.size()>0){
|
||||
for (int i=0;i<roleIdsOld.size();i++){
|
||||
if(roleIdsOld.get(i)==100){
|
||||
isPd=false;
|
||||
if (roleIdsOld != null && roleIdsOld.size() > 0) {
|
||||
for (int i = 0; i < roleIdsOld.size(); i++) {
|
||||
if (roleIdsOld.get(i) == 100) {
|
||||
isPd = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isPd){
|
||||
if (isPd) {
|
||||
//判断当前学校有多少个幼儿园管理员 需求至多3个幼儿园管理员
|
||||
Long[] roleIds = user.getRoleIds();
|
||||
int iCount = 0;
|
||||
@ -329,4 +343,52 @@ public class SysUserController extends BaseController {
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
@Log(title = "用户管理-绑定微信", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/bindwx/{code}")
|
||||
public AjaxResult bindWx(@PathVariable String code) {
|
||||
|
||||
String url = domain;
|
||||
String parmas = "appid=" + appid + "&secret=" + secret + "&code=" + code + "&grant_type=authorization_code";
|
||||
System.out.println(parmas);
|
||||
String strResult = HttpUtils.sendGet(url, parmas);
|
||||
JSONObject jsonObject = JSONObject.parseObject(strResult);
|
||||
try {
|
||||
String openId = jsonObject.get("openid").toString();
|
||||
System.out.println(openId);
|
||||
//首先判断当前用户是否绑定微信
|
||||
SysUser sysUser = userService.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||
if (schoolCommon.isStringEmpty(sysUser.getOpenId())) {
|
||||
//其次查询当前微信是否被绑定
|
||||
SysUser sysUserNew = new SysUser();
|
||||
sysUserNew.setOpenId(openId);
|
||||
List<SysUser> list = userService.selectUserList(sysUserNew);
|
||||
if (list != null && list.size() > 0) {
|
||||
return AjaxResult.error("当前微信已绑定其他账号");
|
||||
} else {
|
||||
//绑定
|
||||
sysUser.setOpenId(openId);
|
||||
int iCount = userService.updateUserWx(sysUser);
|
||||
return AjaxResult.success(iCount);
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("当前账户已绑定微信");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("获取信息失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/isbindwx")
|
||||
public AjaxResult isbindWx() {
|
||||
//首先判断当前用户是否绑定微信
|
||||
SysUser sysUser = userService.selectUserById(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||
if (schoolCommon.isStringEmpty(sysUser.getOpenId())) {
|
||||
return AjaxResult.success("1");
|
||||
} else {
|
||||
return AjaxResult.success("0");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@ -16,328 +17,354 @@ import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 用户对象 sys_user
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class SysUser extends BaseEntity
|
||||
{
|
||||
public class SysUser extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户ID */
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@Excel(name = "部门编号", type = Type.IMPORT)
|
||||
private Long deptId;
|
||||
|
||||
/** 用户账号 */
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@Excel(name = "登录名称")
|
||||
private String userName;
|
||||
|
||||
/** 用户昵称 */
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/** 用户邮箱 */
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/** 手机号码 */
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Excel(name = "手机号码")
|
||||
private String phonenumber;
|
||||
|
||||
/** 用户性别 */
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/** 用户头像 */
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/** 密码 */
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/** 盐加密 */
|
||||
/**
|
||||
* 盐加密
|
||||
*/
|
||||
private String salt;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/** 最后登陆IP */
|
||||
/**
|
||||
* 最后登陆IP
|
||||
*/
|
||||
@Excel(name = "最后登陆IP", type = Type.EXPORT)
|
||||
private String loginIp;
|
||||
|
||||
/** 最后登陆时间 */
|
||||
/**
|
||||
* 最后登陆时间
|
||||
*/
|
||||
@Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||
private Date loginDate;
|
||||
|
||||
/** 部门对象 */
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
@Excels({
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
||||
})
|
||||
private SysDept dept;
|
||||
|
||||
/** 角色对象 */
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
private List<SysRole> roles;
|
||||
|
||||
/** 角色组 */
|
||||
/**
|
||||
* 角色组
|
||||
*/
|
||||
private Long[] roleIds;
|
||||
|
||||
/** 岗位组 */
|
||||
/**
|
||||
* 岗位组
|
||||
*/
|
||||
private Long[] postIds;
|
||||
|
||||
/** 部门组 */
|
||||
/**
|
||||
* 部门组
|
||||
*/
|
||||
private Long[] deptIds;
|
||||
|
||||
/**教师对象*/
|
||||
/**
|
||||
* 教师对象
|
||||
*/
|
||||
private ByTeacherJbxx byTeacherJbxx;
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
/**
|
||||
* 微信openid
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
* pw
|
||||
*/
|
||||
private String pw;
|
||||
|
||||
public SysUser() {
|
||||
|
||||
}
|
||||
|
||||
public SysUser(Long userId)
|
||||
{
|
||||
public SysUser(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
public boolean isAdmin() {
|
||||
return isAdmin(this.userId);
|
||||
}
|
||||
|
||||
public static boolean isAdmin(Long userId)
|
||||
{
|
||||
public static boolean isAdmin(Long userId) {
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
||||
public String getNickName()
|
||||
{
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName)
|
||||
{
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "用户账号不能为空")
|
||||
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
||||
public String getUserName()
|
||||
{
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||
public String getEmail()
|
||||
{
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email)
|
||||
{
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
|
||||
public String getPhonenumber()
|
||||
{
|
||||
public String getPhonenumber() {
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber)
|
||||
{
|
||||
public void setPhonenumber(String phonenumber) {
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
public String getSex()
|
||||
{
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex)
|
||||
{
|
||||
public void setSex(String sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getAvatar()
|
||||
{
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar)
|
||||
{
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public String getPassword()
|
||||
{
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSalt()
|
||||
{
|
||||
public String getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public void setSalt(String salt)
|
||||
{
|
||||
public void setSalt(String salt) {
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getLoginIp()
|
||||
{
|
||||
public String getLoginIp() {
|
||||
return loginIp;
|
||||
}
|
||||
|
||||
public void setLoginIp(String loginIp)
|
||||
{
|
||||
public void setLoginIp(String loginIp) {
|
||||
this.loginIp = loginIp;
|
||||
}
|
||||
|
||||
public Date getLoginDate()
|
||||
{
|
||||
public Date getLoginDate() {
|
||||
return loginDate;
|
||||
}
|
||||
|
||||
public void setLoginDate(Date loginDate)
|
||||
{
|
||||
public void setLoginDate(Date loginDate) {
|
||||
this.loginDate = loginDate;
|
||||
}
|
||||
|
||||
public SysDept getDept()
|
||||
{
|
||||
public SysDept getDept() {
|
||||
return dept;
|
||||
}
|
||||
|
||||
public void setDept(SysDept dept)
|
||||
{
|
||||
public void setDept(SysDept dept) {
|
||||
this.dept = dept;
|
||||
}
|
||||
|
||||
public List<SysRole> getRoles()
|
||||
{
|
||||
public List<SysRole> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<SysRole> roles)
|
||||
{
|
||||
public void setRoles(List<SysRole> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public Long[] getRoleIds()
|
||||
{
|
||||
public Long[] getRoleIds() {
|
||||
return roleIds;
|
||||
}
|
||||
|
||||
public void setRoleIds(Long[] roleIds)
|
||||
{
|
||||
public void setRoleIds(Long[] roleIds) {
|
||||
this.roleIds = roleIds;
|
||||
}
|
||||
|
||||
public Long[] getPostIds()
|
||||
{
|
||||
public Long[] getPostIds() {
|
||||
return postIds;
|
||||
}
|
||||
|
||||
public void setPostIds(Long[] postIds)
|
||||
{
|
||||
public void setPostIds(Long[] postIds) {
|
||||
this.postIds = postIds;
|
||||
}
|
||||
public Long[] getDeptIds()
|
||||
{
|
||||
|
||||
public Long[] getDeptIds() {
|
||||
return deptIds;
|
||||
}
|
||||
|
||||
public void setDeptIds(Long[] deptIds)
|
||||
{
|
||||
public void setDeptIds(Long[] deptIds) {
|
||||
this.deptIds = deptIds;
|
||||
}
|
||||
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
public String getPw() {
|
||||
return pw;
|
||||
}
|
||||
|
||||
public void setPw(String pw) {
|
||||
this.pw = pw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userName", getUserName())
|
||||
.append("nickName", getNickName())
|
||||
.append("email", getEmail())
|
||||
.append("phonenumber", getPhonenumber())
|
||||
.append("sex", getSex())
|
||||
.append("avatar", getAvatar())
|
||||
.append("password", getPassword())
|
||||
.append("salt", getSalt())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("loginIp", getLoginIp())
|
||||
.append("loginDate", getLoginDate())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("dept", getDept())
|
||||
.append("byTeacherJbxx", getByTeacherJbxx())
|
||||
.toString();
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userName", getUserName())
|
||||
.append("nickName", getNickName())
|
||||
.append("email", getEmail())
|
||||
.append("phonenumber", getPhonenumber())
|
||||
.append("sex", getSex())
|
||||
.append("avatar", getAvatar())
|
||||
.append("password", getPassword())
|
||||
.append("salt", getSalt())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("loginIp", getLoginIp())
|
||||
.append("loginDate", getLoginDate())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("dept", getDept())
|
||||
.append("byTeacherJbxx", getByTeacherJbxx())
|
||||
.append("openId", getOpenId())
|
||||
.append("pw", getPw())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public ByTeacherJbxx getByTeacherJbxx() {
|
||||
|
@ -53,6 +53,14 @@ public interface SysUserMapper
|
||||
*/
|
||||
public SysUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param openId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByWxId(String openId);
|
||||
|
||||
/**
|
||||
* 根据roleId查询用户列表
|
||||
*
|
||||
@ -85,6 +93,14 @@ public interface SysUserMapper
|
||||
*/
|
||||
public int updateUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserWx(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
|
@ -51,6 +51,14 @@ public interface ISysUserService
|
||||
*/
|
||||
public SysUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param openId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByWxId(String openId);
|
||||
|
||||
/**
|
||||
* 根据roleId查询用户列表
|
||||
*
|
||||
@ -138,6 +146,14 @@ public interface ISysUserService
|
||||
*/
|
||||
public int updateUserStatus(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserWx(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
|
@ -103,6 +103,17 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
return userMapper.selectUserById(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param openId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysUser selectUserByWxId(String openId) {
|
||||
return userMapper.selectUserByWxId(openId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据roleId查询用户列表
|
||||
*
|
||||
@ -126,7 +137,6 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户所属角色组
|
||||
*
|
||||
@ -279,6 +289,17 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserWx(SysUser user) {
|
||||
return userMapper.updateUserWx(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
|
@ -129,3 +129,9 @@ file:
|
||||
# domain: https://files.benyiedu.com/
|
||||
domain: http://video.benyiedu.com/
|
||||
bucket: bywebfile
|
||||
|
||||
#wx
|
||||
wx:
|
||||
appid: wx0370c4756118456a
|
||||
secret: f57143e81f3c95b0d909d91b3116cc82
|
||||
domain: https://api.weixin.qq.com/sns/oauth2/access_token
|
||||
|
@ -1,58 +1,60 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.project.system.mapper.SysUserMapper">
|
||||
|
||||
<resultMap type="SysUser" id="SysUserResult">
|
||||
<id property="userId" column="user_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="email" column="email" />
|
||||
<result property="phonenumber" column="phonenumber" />
|
||||
<result property="sex" column="sex" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="password" column="password" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="loginIp" column="login_ip" />
|
||||
<result property="loginDate" column="login_date" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="SysDept">
|
||||
<id property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="leader" column="leader" />
|
||||
<result property="status" column="dept_status" />
|
||||
</resultMap>
|
||||
<resultMap type="SysUser" id="SysUserResult">
|
||||
<id property="userId" column="user_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="nickName" column="nick_name"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="phonenumber" column="phonenumber"/>
|
||||
<result property="sex" column="sex"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="loginIp" column="login_ip"/>
|
||||
<result property="loginDate" column="login_date"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="openId" column="open_id"/>
|
||||
<result property="pw" column="pw"/>
|
||||
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult"/>
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="SysDept">
|
||||
<id property="deptId" column="dept_id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="deptName" column="dept_name"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="leader" column="leader"/>
|
||||
<result property="status" column="dept_status"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="RoleResult" type="SysRole">
|
||||
<id property="roleId" column="role_id" />
|
||||
<result property="roleName" column="role_name" />
|
||||
<result property="roleKey" column="role_key" />
|
||||
<result property="roleSort" column="role_sort" />
|
||||
<result property="dataScope" column="data_scope" />
|
||||
<result property="status" column="role_status" />
|
||||
</resultMap>
|
||||
<resultMap id="RoleResult" type="SysRole">
|
||||
<id property="roleId" column="role_id"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="roleKey" column="role_key"/>
|
||||
<result property="roleSort" column="role_sort"/>
|
||||
<result property="dataScope" column="data_scope"/>
|
||||
<result property="status" column="role_status"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="countUserSchoolAdminRoleByDeptId" resultType="Integer">
|
||||
<select id="countUserSchoolAdminRoleByDeptId" resultType="Integer">
|
||||
select count(1) from sys_user u left join sys_user_role r on u.user_id=r.user_id
|
||||
where dept_id=#{deptId} and role_id=#{roleId} and u.status='0' and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.open_id, u.pw,
|
||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
@ -60,173 +62,199 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${dataScope}
|
||||
</select>
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from
|
||||
sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="openId != null and openId != ''">
|
||||
AND u.open_id = #{openId}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET
|
||||
(#{deptId},ancestors) ))
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectUserListAll" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
<select id="selectUserListAll" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from
|
||||
sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET
|
||||
(#{deptId},ancestors) ))
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUserListByRoleId" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != ''">
|
||||
and r.role_id = #{userId}
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
|
||||
</if>
|
||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName}
|
||||
</select>
|
||||
|
||||
</select>
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserOnlyByRoleId" parameterType="Long" resultMap="SysUserResult">
|
||||
<select id="selectUserByWxId" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.open_id = #{openId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserListByRoleId" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != ''">
|
||||
and r.role_id = #{userId}
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET
|
||||
(#{deptId},ancestors) ))
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectUserOnlyByRoleId" parameterType="Long" resultMap="SysUserResult">
|
||||
select * FROM sys_user where del_flag = '0' and user_id in (select user_id from sys_user_role where role_id = #{roleId});
|
||||
</select>
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultType="int">
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultType="int">
|
||||
select count(1) from sys_user where user_name = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber}
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email}
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<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>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="SysUser">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="email != null and email != ''">email = #{email},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserStatus" parameterType="SysUser">
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<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="openId != null and openId != ''">open_id,</if>
|
||||
<if test="pw != null and pw != ''">pw,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<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="openId != null and openId != ''">#{openId},</if>
|
||||
<if test="pw != null and pw != ''">#{pw},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="SysUser">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="email != null and email != ''">email = #{email},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="openId != null and openId != ''">open_id = #{openId},</if>
|
||||
<if test="pw != null and pw != ''">open_id = #{pw},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserStatus" parameterType="SysUser">
|
||||
update sys_user set status = #{status} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserAvatar" parameterType="SysUser">
|
||||
|
||||
<update id="updateUserWx" parameterType="SysUser">
|
||||
update sys_user set open_id = #{openId} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserAvatar" parameterType="SysUser">
|
||||
update sys_user set avatar = #{avatar} where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
<update id="resetUserPwd" parameterType="SysUser">
|
||||
update sys_user set password = #{password} where user_name = #{userName}
|
||||
|
||||
<update id="resetUserPwd" parameterType="SysUser">
|
||||
update sys_user set password = #{password},pw=#{pw} where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
delete from sys_user where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserByIds" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteUserByIds" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user