公众号登录
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";
|
import { praseStrEmpty } from "@/utils/ruoyi";
|
||||||
|
|
||||||
// 查询用户列表
|
// 查询用户列表
|
||||||
export function listUser(query) {
|
export function listUser(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/list',
|
url: "/system/user/list",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户列表
|
// 查询用户列表
|
||||||
export function listlrrUser(query) {
|
export function listlrrUser(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/lrrlist',
|
url: "/system/user/lrrlist",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户详细
|
// 查询用户详细
|
||||||
export function getUser(userId) {
|
export function getUser(userId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/' + praseStrEmpty(userId),
|
url: "/system/user/" + praseStrEmpty(userId),
|
||||||
method: 'get'
|
method: "get"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户列表根据roleId
|
// 查询用户列表根据roleId
|
||||||
export function getUsersByRoleId() {
|
export function getUsersByRoleId() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/listbyroleid',
|
url: "/system/user/listbyroleid",
|
||||||
method: 'get'
|
method: "get"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据roleid查询用户列表
|
// 根据roleid查询用户列表
|
||||||
export function getUserOnlyByRoleId(roleId) {
|
export function getUserOnlyByRoleId(roleId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/onlybyroleid/' + roleId,
|
url: "/system/user/onlybyroleid/" + roleId,
|
||||||
method: 'get'
|
method: "get"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 新增用户
|
// 新增用户
|
||||||
export function addUser(data) {
|
export function addUser(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user',
|
url: "/system/user",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户
|
// 修改用户
|
||||||
export function updateUser(data) {
|
export function updateUser(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user',
|
url: "/system/user",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除用户
|
// 删除用户
|
||||||
export function delUser(userId) {
|
export function delUser(userId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/' + userId,
|
url: "/system/user/" + userId,
|
||||||
method: 'delete'
|
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) {
|
export function exportUser(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/export',
|
url: "/system/user/export",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户密码重置
|
// 用户密码重置
|
||||||
export function resetUserPwd(userId, password) {
|
export function resetUserPwd(userId, password) {
|
||||||
const data = {
|
const data = {
|
||||||
userId,
|
userId,
|
||||||
password
|
password
|
||||||
}
|
};
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/resetPwd',
|
url: "/system/user/resetPwd",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
export function changeUserStatus(userId, status) {
|
export function changeUserStatus(userId, status) {
|
||||||
const data = {
|
const data = {
|
||||||
userId,
|
userId,
|
||||||
status
|
status
|
||||||
}
|
};
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/changeStatus',
|
url: "/system/user/changeStatus",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户个人信息
|
// 查询用户个人信息
|
||||||
export function getUserProfile() {
|
export function getUserProfile() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile',
|
url: "/system/user/profile",
|
||||||
method: 'get'
|
method: "get"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户个人信息
|
// 修改用户个人信息
|
||||||
export function updateUserProfile(data) {
|
export function updateUserProfile(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile',
|
url: "/system/user/profile",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户密码重置
|
// 用户密码重置
|
||||||
export function updateUserPwd(oldPassword, newPassword) {
|
export function updateUserPwd(oldPassword, newPassword) {
|
||||||
const data = {
|
const data = {
|
||||||
oldPassword,
|
oldPassword,
|
||||||
newPassword
|
newPassword
|
||||||
}
|
};
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile/updatePwd',
|
url: "/system/user/profile/updatePwd",
|
||||||
method: 'put',
|
method: "put",
|
||||||
params: data
|
params: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户头像上传
|
// 用户头像上传
|
||||||
export function uploadAvatar(data) {
|
export function uploadAvatar(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile/avatar',
|
url: "/system/user/profile/avatar",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下载用户导入模板
|
// 下载用户导入模板
|
||||||
export function importTemplate() {
|
export function importTemplate() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/importTemplate',
|
url: "/system/user/importTemplate",
|
||||||
method: 'get'
|
method: "get"
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 登录方法
|
||||||
|
export function wxlogin(code) {
|
||||||
|
return request({
|
||||||
|
url: "/wxlogin/" + code,
|
||||||
|
method: "post"
|
||||||
|
});
|
||||||
}
|
}
|
@ -42,6 +42,9 @@
|
|||||||
<el-dropdown-item @click.native="setting = true">
|
<el-dropdown-item @click.native="setting = true">
|
||||||
<span>布局设置</span>
|
<span>布局设置</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<!-- <router-link to="/user/bind/wx">
|
||||||
|
<el-dropdown-item>绑定微信</el-dropdown-item>
|
||||||
|
</router-link> -->
|
||||||
<el-dropdown-item divided @click.native="logout">
|
<el-dropdown-item divided @click.native="logout">
|
||||||
<span>退出登录</span>
|
<span>退出登录</span>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
@ -22,7 +22,7 @@ NProgress.configure({
|
|||||||
})
|
})
|
||||||
|
|
||||||
//const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
|
//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) => {
|
router.beforeEach((to, from, next) => {
|
||||||
NProgress.start()
|
NProgress.start()
|
||||||
|
@ -41,6 +41,12 @@ export const constantRoutes = [{
|
|||||||
import ('@/views/login'),
|
import ('@/views/login'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/wxlogin',
|
||||||
|
component: () =>
|
||||||
|
import ('@/views/wxlogin'),
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/404',
|
path: '/404',
|
||||||
component: () =>
|
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',
|
path: '/user/change',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
@ -165,7 +187,7 @@ export const constantRoutes = [{
|
|||||||
name: 'Changedept',
|
name: 'Changedept',
|
||||||
meta: {
|
meta: {
|
||||||
title: '切换岗位',
|
title: '切换岗位',
|
||||||
icon: 'user'
|
icon: ''
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
@ -55,6 +55,7 @@ import RaddarChart from "./dashboard/RaddarChart";
|
|||||||
import PieChart from "./dashboard/PieChart";
|
import PieChart from "./dashboard/PieChart";
|
||||||
import BarChart from "./dashboard/BarChart";
|
import BarChart from "./dashboard/BarChart";
|
||||||
import LineChart from "./dashboard/LineChart";
|
import LineChart from "./dashboard/LineChart";
|
||||||
|
import { bindwx, isbindwx, wxlogin } from "@/api/system/user";
|
||||||
//import { getSchoolCalendars } from "@/api/benyi/schoolcalendar";
|
//import { getSchoolCalendars } from "@/api/benyi/schoolcalendar";
|
||||||
//备用进行班级园历显示操作import { getSchoolCalendarsClass } from "@/api/benyi/schoolcalendarclass";
|
//备用进行班级园历显示操作import { getSchoolCalendarsClass } from "@/api/benyi/schoolcalendarclass";
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
code: "",
|
||||||
calendarData: [],
|
calendarData: [],
|
||||||
value: new Date(),
|
value: new Date(),
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@ -77,9 +79,31 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.code = this.$route.query.code;
|
||||||
|
//console.log(this.code);
|
||||||
|
this.bindWxInfo();
|
||||||
//this.getSchoolCalendarList();
|
//this.getSchoolCalendarList();
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
// getSchoolCalendarList() {
|
||||||
// getSchoolCalendars(this.queryParams).then(response => {
|
// 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()
|
.authorizeRequests()
|
||||||
// 对于登录login 验证码captchaImage 允许匿名访问
|
// 对于登录login 验证码captchaImage 允许匿名访问
|
||||||
.antMatchers("/login", "/captchaImage").anonymous()
|
.antMatchers("/login","/wxlogin/**", "/captchaImage").anonymous()
|
||||||
.antMatchers(
|
.antMatchers(
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
"/*.html",
|
"/*.html",
|
||||||
|
@ -102,4 +102,53 @@ public class SysLoginService {
|
|||||||
// 生成token
|
// 生成token
|
||||||
return tokenService.createToken(loginUser);
|
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.List;
|
||||||
import java.util.Set;
|
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.framework.redis.RedisCache;
|
||||||
import com.ruoyi.project.system.domain.BySchool;
|
import com.ruoyi.project.system.domain.BySchool;
|
||||||
import com.ruoyi.project.system.service.IBySchoolService;
|
import com.ruoyi.project.system.service.IBySchoolService;
|
||||||
|
import com.ruoyi.project.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
import com.ruoyi.common.utils.ServletUtils;
|
import com.ruoyi.common.utils.ServletUtils;
|
||||||
import com.ruoyi.framework.security.LoginBody;
|
import com.ruoyi.framework.security.LoginBody;
|
||||||
@ -29,8 +30,16 @@ import com.ruoyi.project.system.service.ISysMenuService;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@RestController
|
@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
|
@Autowired
|
||||||
private SysLoginService loginService;
|
private SysLoginService loginService;
|
||||||
|
|
||||||
@ -43,6 +52,10 @@ public class SysLoginController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TokenService tokenService;
|
private TokenService tokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// private RedisCache redisCache;
|
// private RedisCache redisCache;
|
||||||
|
|
||||||
@ -51,13 +64,12 @@ public class SysLoginController
|
|||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param password 密码
|
* @param password 密码
|
||||||
* @param captcha 验证码
|
* @param captcha 验证码
|
||||||
* @param uuid 唯一标识
|
* @param uuid 唯一标识
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
public AjaxResult login(@RequestBody LoginBody loginBody) {
|
||||||
{
|
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
// 生成令牌
|
// 生成令牌
|
||||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||||
@ -66,6 +78,36 @@ public class SysLoginController
|
|||||||
return ajax;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 将在其他地方登陆的账号强退
|
// * 将在其他地方登陆的账号强退
|
||||||
// *
|
// *
|
||||||
@ -86,8 +128,7 @@ public class SysLoginController
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("getInfo")
|
@GetMapping("getInfo")
|
||||||
public AjaxResult getInfo()
|
public AjaxResult getInfo() {
|
||||||
{
|
|
||||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||||
SysUser user = loginUser.getUser();
|
SysUser user = loginUser.getUser();
|
||||||
// 角色集合
|
// 角色集合
|
||||||
@ -108,8 +149,7 @@ public class SysLoginController
|
|||||||
* @return 路由信息
|
* @return 路由信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("getRouters")
|
@GetMapping("getRouters")
|
||||||
public AjaxResult getRouters()
|
public AjaxResult getRouters() {
|
||||||
{
|
|
||||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||||
// 用户信息
|
// 用户信息
|
||||||
SysUser user = loginUser.getUser();
|
SysUser user = loginUser.getUser();
|
||||||
|
@ -3,11 +3,15 @@ package com.ruoyi.project.system.controller;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
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.common.SchoolCommon;
|
||||||
import com.ruoyi.project.system.domain.ByTeacherJbxx;
|
import com.ruoyi.project.system.domain.ByTeacherJbxx;
|
||||||
import com.ruoyi.project.system.domain.SysDept;
|
import com.ruoyi.project.system.domain.SysDept;
|
||||||
import com.ruoyi.project.system.service.*;
|
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.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
@ -41,6 +45,16 @@ import com.ruoyi.project.system.domain.SysUser;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/user")
|
@RequestMapping("/system/user")
|
||||||
public class SysUserController extends BaseController {
|
public class SysUserController extends BaseController {
|
||||||
|
|
||||||
|
@Value("${wx.appid}")
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
@Value("${wx.secret}")
|
||||||
|
private String secret;
|
||||||
|
|
||||||
|
@Value("${wx.domain}")
|
||||||
|
private String domain;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
@ -76,15 +90,15 @@ public class SysUserController extends BaseController {
|
|||||||
|
|
||||||
@GetMapping("/lrrlist")
|
@GetMapping("/lrrlist")
|
||||||
public TableDataInfo lrrlist(SysUser user) {
|
public TableDataInfo lrrlist(SysUser user) {
|
||||||
int l1=103;
|
int l1 = 103;
|
||||||
user.setDeptId(Long.valueOf(l1));
|
user.setDeptId(Long.valueOf(l1));
|
||||||
List<SysUser> list = userService.selectUserList(user);
|
List<SysUser> list = userService.selectUserList(user);
|
||||||
|
|
||||||
int l2=105;
|
int l2 = 105;
|
||||||
user.setDeptId(Long.valueOf(l2));
|
user.setDeptId(Long.valueOf(l2));
|
||||||
list.addAll(userService.selectUserList(user));
|
list.addAll(userService.selectUserList(user));
|
||||||
|
|
||||||
int l3=107;
|
int l3 = 107;
|
||||||
user.setDeptId(Long.valueOf(l3));
|
user.setDeptId(Long.valueOf(l3));
|
||||||
list.addAll(userService.selectUserList(user));
|
list.addAll(userService.selectUserList(user));
|
||||||
|
|
||||||
@ -263,18 +277,18 @@ public class SysUserController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//先判断前端的roleids是否有变化
|
//先判断前端的roleids是否有变化
|
||||||
boolean isPd=true;
|
boolean isPd = true;
|
||||||
if (schoolCommon.isSchool() == true) {
|
if (schoolCommon.isSchool() == true) {
|
||||||
List<Integer> roleIdsOld = roleService.selectYeyRoleListByUserId(user.getUserId());
|
List<Integer> roleIdsOld = roleService.selectYeyRoleListByUserId(user.getUserId());
|
||||||
if(roleIdsOld!=null&&roleIdsOld.size()>0){
|
if (roleIdsOld != null && roleIdsOld.size() > 0) {
|
||||||
for (int i=0;i<roleIdsOld.size();i++){
|
for (int i = 0; i < roleIdsOld.size(); i++) {
|
||||||
if(roleIdsOld.get(i)==100){
|
if (roleIdsOld.get(i) == 100) {
|
||||||
isPd=false;
|
isPd = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isPd){
|
if (isPd) {
|
||||||
//判断当前学校有多少个幼儿园管理员 需求至多3个幼儿园管理员
|
//判断当前学校有多少个幼儿园管理员 需求至多3个幼儿园管理员
|
||||||
Long[] roleIds = user.getRoleIds();
|
Long[] roleIds = user.getRoleIds();
|
||||||
int iCount = 0;
|
int iCount = 0;
|
||||||
@ -329,4 +343,52 @@ public class SysUserController extends BaseController {
|
|||||||
user.setUpdateBy(SecurityUtils.getUsername());
|
user.setUpdateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(userService.updateUserStatus(user));
|
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.Email;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@ -19,325 +20,351 @@ import com.ruoyi.framework.web.domain.BaseEntity;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class SysUser extends BaseEntity
|
public class SysUser extends BaseEntity {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 用户ID */
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 部门ID */
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
@Excel(name = "部门编号", type = Type.IMPORT)
|
@Excel(name = "部门编号", type = Type.IMPORT)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 用户账号 */
|
/**
|
||||||
|
* 用户账号
|
||||||
|
*/
|
||||||
@Excel(name = "登录名称")
|
@Excel(name = "登录名称")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/** 用户昵称 */
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
@Excel(name = "用户名称")
|
@Excel(name = "用户名称")
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
/** 用户邮箱 */
|
/**
|
||||||
|
* 用户邮箱
|
||||||
|
*/
|
||||||
@Excel(name = "用户邮箱")
|
@Excel(name = "用户邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/** 手机号码 */
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
@Excel(name = "手机号码")
|
@Excel(name = "手机号码")
|
||||||
private String phonenumber;
|
private String phonenumber;
|
||||||
|
|
||||||
/** 用户性别 */
|
/**
|
||||||
|
* 用户性别
|
||||||
|
*/
|
||||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||||
private String sex;
|
private String sex;
|
||||||
|
|
||||||
/** 用户头像 */
|
/**
|
||||||
|
* 用户头像
|
||||||
|
*/
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
/** 密码 */
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
/** 盐加密 */
|
/**
|
||||||
|
* 盐加密
|
||||||
|
*/
|
||||||
private String salt;
|
private String salt;
|
||||||
|
|
||||||
/** 帐号状态(0正常 1停用) */
|
/**
|
||||||
|
* 帐号状态(0正常 1停用)
|
||||||
|
*/
|
||||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
/**
|
||||||
|
* 删除标志(0代表存在 2代表删除)
|
||||||
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
/** 最后登陆IP */
|
/**
|
||||||
|
* 最后登陆IP
|
||||||
|
*/
|
||||||
@Excel(name = "最后登陆IP", type = Type.EXPORT)
|
@Excel(name = "最后登陆IP", type = Type.EXPORT)
|
||||||
private String loginIp;
|
private String loginIp;
|
||||||
|
|
||||||
/** 最后登陆时间 */
|
/**
|
||||||
|
* 最后登陆时间
|
||||||
|
*/
|
||||||
@Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
@Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
private Date loginDate;
|
private Date loginDate;
|
||||||
|
|
||||||
/** 部门对象 */
|
/**
|
||||||
|
* 部门对象
|
||||||
|
*/
|
||||||
@Excels({
|
@Excels({
|
||||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
||||||
})
|
})
|
||||||
private SysDept dept;
|
private SysDept dept;
|
||||||
|
|
||||||
/** 角色对象 */
|
/**
|
||||||
|
* 角色对象
|
||||||
|
*/
|
||||||
private List<SysRole> roles;
|
private List<SysRole> roles;
|
||||||
|
|
||||||
/** 角色组 */
|
/**
|
||||||
|
* 角色组
|
||||||
|
*/
|
||||||
private Long[] roleIds;
|
private Long[] roleIds;
|
||||||
|
|
||||||
/** 岗位组 */
|
/**
|
||||||
|
* 岗位组
|
||||||
|
*/
|
||||||
private Long[] postIds;
|
private Long[] postIds;
|
||||||
|
|
||||||
/** 部门组 */
|
/**
|
||||||
|
* 部门组
|
||||||
|
*/
|
||||||
private Long[] deptIds;
|
private Long[] deptIds;
|
||||||
|
|
||||||
/**教师对象*/
|
/**
|
||||||
|
* 教师对象
|
||||||
|
*/
|
||||||
private ByTeacherJbxx byTeacherJbxx;
|
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;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getUserId()
|
public Long getUserId() {
|
||||||
{
|
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserId(Long userId)
|
public void setUserId(Long userId) {
|
||||||
{
|
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAdmin()
|
public boolean isAdmin() {
|
||||||
{
|
|
||||||
return isAdmin(this.userId);
|
return isAdmin(this.userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAdmin(Long userId)
|
public static boolean isAdmin(Long userId) {
|
||||||
{
|
|
||||||
return userId != null && 1L == userId;
|
return userId != null && 1L == userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDeptId()
|
public Long getDeptId() {
|
||||||
{
|
|
||||||
return deptId;
|
return deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptId(Long deptId)
|
public void setDeptId(Long deptId) {
|
||||||
{
|
|
||||||
this.deptId = deptId;
|
this.deptId = deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
||||||
public String getNickName()
|
public String getNickName() {
|
||||||
{
|
|
||||||
return nickName;
|
return nickName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNickName(String nickName)
|
public void setNickName(String nickName) {
|
||||||
{
|
|
||||||
this.nickName = nickName;
|
this.nickName = nickName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotBlank(message = "用户账号不能为空")
|
@NotBlank(message = "用户账号不能为空")
|
||||||
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
||||||
public String getUserName()
|
public String getUserName() {
|
||||||
{
|
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserName(String userName)
|
public void setUserName(String userName) {
|
||||||
{
|
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Email(message = "邮箱格式不正确")
|
@Email(message = "邮箱格式不正确")
|
||||||
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
|
||||||
public String getEmail()
|
public String getEmail() {
|
||||||
{
|
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmail(String email)
|
public void setEmail(String email) {
|
||||||
{
|
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
|
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
|
||||||
public String getPhonenumber()
|
public String getPhonenumber() {
|
||||||
{
|
|
||||||
return phonenumber;
|
return phonenumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPhonenumber(String phonenumber)
|
public void setPhonenumber(String phonenumber) {
|
||||||
{
|
|
||||||
this.phonenumber = phonenumber;
|
this.phonenumber = phonenumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSex()
|
public String getSex() {
|
||||||
{
|
|
||||||
return sex;
|
return sex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSex(String sex)
|
public void setSex(String sex) {
|
||||||
{
|
|
||||||
this.sex = sex;
|
this.sex = sex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAvatar()
|
public String getAvatar() {
|
||||||
{
|
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAvatar(String avatar)
|
public void setAvatar(String avatar) {
|
||||||
{
|
|
||||||
this.avatar = avatar;
|
this.avatar = avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public String getPassword()
|
public String getPassword() {
|
||||||
{
|
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassword(String password)
|
public void setPassword(String password) {
|
||||||
{
|
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSalt()
|
public String getSalt() {
|
||||||
{
|
|
||||||
return salt;
|
return salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSalt(String salt)
|
public void setSalt(String salt) {
|
||||||
{
|
|
||||||
this.salt = salt;
|
this.salt = salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus()
|
public String getStatus() {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatus(String status)
|
public void setStatus(String status) {
|
||||||
{
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDelFlag()
|
public String getDelFlag() {
|
||||||
{
|
|
||||||
return delFlag;
|
return delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDelFlag(String delFlag)
|
public void setDelFlag(String delFlag) {
|
||||||
{
|
|
||||||
this.delFlag = delFlag;
|
this.delFlag = delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoginIp()
|
public String getLoginIp() {
|
||||||
{
|
|
||||||
return loginIp;
|
return loginIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginIp(String loginIp)
|
public void setLoginIp(String loginIp) {
|
||||||
{
|
|
||||||
this.loginIp = loginIp;
|
this.loginIp = loginIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getLoginDate()
|
public Date getLoginDate() {
|
||||||
{
|
|
||||||
return loginDate;
|
return loginDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginDate(Date loginDate)
|
public void setLoginDate(Date loginDate) {
|
||||||
{
|
|
||||||
this.loginDate = loginDate;
|
this.loginDate = loginDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SysDept getDept()
|
public SysDept getDept() {
|
||||||
{
|
|
||||||
return dept;
|
return dept;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDept(SysDept dept)
|
public void setDept(SysDept dept) {
|
||||||
{
|
|
||||||
this.dept = dept;
|
this.dept = dept;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SysRole> getRoles()
|
public List<SysRole> getRoles() {
|
||||||
{
|
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoles(List<SysRole> roles)
|
public void setRoles(List<SysRole> roles) {
|
||||||
{
|
|
||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long[] getRoleIds()
|
public Long[] getRoleIds() {
|
||||||
{
|
|
||||||
return roleIds;
|
return roleIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleIds(Long[] roleIds)
|
public void setRoleIds(Long[] roleIds) {
|
||||||
{
|
|
||||||
this.roleIds = roleIds;
|
this.roleIds = roleIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long[] getPostIds()
|
public Long[] getPostIds() {
|
||||||
{
|
|
||||||
return postIds;
|
return postIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPostIds(Long[] postIds)
|
public void setPostIds(Long[] postIds) {
|
||||||
{
|
|
||||||
this.postIds = postIds;
|
this.postIds = postIds;
|
||||||
}
|
}
|
||||||
public Long[] getDeptIds()
|
|
||||||
{
|
public Long[] getDeptIds() {
|
||||||
return deptIds;
|
return deptIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptIds(Long[] deptIds)
|
public void setDeptIds(Long[] deptIds) {
|
||||||
{
|
|
||||||
this.deptIds = 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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("userId", getUserId())
|
.append("userId", getUserId())
|
||||||
.append("deptId", getDeptId())
|
.append("deptId", getDeptId())
|
||||||
.append("userName", getUserName())
|
.append("userName", getUserName())
|
||||||
.append("nickName", getNickName())
|
.append("nickName", getNickName())
|
||||||
.append("email", getEmail())
|
.append("email", getEmail())
|
||||||
.append("phonenumber", getPhonenumber())
|
.append("phonenumber", getPhonenumber())
|
||||||
.append("sex", getSex())
|
.append("sex", getSex())
|
||||||
.append("avatar", getAvatar())
|
.append("avatar", getAvatar())
|
||||||
.append("password", getPassword())
|
.append("password", getPassword())
|
||||||
.append("salt", getSalt())
|
.append("salt", getSalt())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("loginIp", getLoginIp())
|
.append("loginIp", getLoginIp())
|
||||||
.append("loginDate", getLoginDate())
|
.append("loginDate", getLoginDate())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("dept", getDept())
|
.append("dept", getDept())
|
||||||
.append("byTeacherJbxx", getByTeacherJbxx())
|
.append("byTeacherJbxx", getByTeacherJbxx())
|
||||||
.toString();
|
.append("openId", getOpenId())
|
||||||
|
.append("pw", getPw())
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByTeacherJbxx getByTeacherJbxx() {
|
public ByTeacherJbxx getByTeacherJbxx() {
|
||||||
|
@ -53,6 +53,14 @@ public interface SysUserMapper
|
|||||||
*/
|
*/
|
||||||
public SysUser selectUserById(Long userId);
|
public SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID查询用户
|
||||||
|
*
|
||||||
|
* @param openId 用户ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public SysUser selectUserByWxId(String openId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据roleId查询用户列表
|
* 根据roleId查询用户列表
|
||||||
*
|
*
|
||||||
@ -85,6 +93,14 @@ public interface SysUserMapper
|
|||||||
*/
|
*/
|
||||||
public int updateUser(SysUser user);
|
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);
|
public SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID查询用户
|
||||||
|
*
|
||||||
|
* @param openId 用户ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public SysUser selectUserByWxId(String openId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据roleId查询用户列表
|
* 根据roleId查询用户列表
|
||||||
*
|
*
|
||||||
@ -138,6 +146,14 @@ public interface ISysUserService
|
|||||||
*/
|
*/
|
||||||
public int updateUserStatus(SysUser user);
|
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);
|
return userMapper.selectUserById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID查询用户
|
||||||
|
*
|
||||||
|
* @param openId 用户ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser selectUserByWxId(String openId) {
|
||||||
|
return userMapper.selectUserByWxId(openId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据roleId查询用户列表
|
* 根据roleId查询用户列表
|
||||||
*
|
*
|
||||||
@ -126,7 +137,6 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户所属角色组
|
* 查询用户所属角色组
|
||||||
*
|
*
|
||||||
@ -279,6 +289,17 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||||||
return userMapper.updateUser(user);
|
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: https://files.benyiedu.com/
|
||||||
domain: http://video.benyiedu.com/
|
domain: http://video.benyiedu.com/
|
||||||
bucket: bywebfile
|
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" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.project.system.mapper.SysUserMapper">
|
<mapper namespace="com.ruoyi.project.system.mapper.SysUserMapper">
|
||||||
|
|
||||||
<resultMap type="SysUser" id="SysUserResult">
|
<resultMap type="SysUser" id="SysUserResult">
|
||||||
<id property="userId" column="user_id" />
|
<id property="userId" column="user_id"/>
|
||||||
<result property="deptId" column="dept_id" />
|
<result property="deptId" column="dept_id"/>
|
||||||
<result property="userName" column="user_name" />
|
<result property="userName" column="user_name"/>
|
||||||
<result property="nickName" column="nick_name" />
|
<result property="nickName" column="nick_name"/>
|
||||||
<result property="email" column="email" />
|
<result property="email" column="email"/>
|
||||||
<result property="phonenumber" column="phonenumber" />
|
<result property="phonenumber" column="phonenumber"/>
|
||||||
<result property="sex" column="sex" />
|
<result property="sex" column="sex"/>
|
||||||
<result property="avatar" column="avatar" />
|
<result property="avatar" column="avatar"/>
|
||||||
<result property="password" column="password" />
|
<result property="password" column="password"/>
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status"/>
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag"/>
|
||||||
<result property="loginIp" column="login_ip" />
|
<result property="loginIp" column="login_ip"/>
|
||||||
<result property="loginDate" column="login_date" />
|
<result property="loginDate" column="login_date"/>
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time"/>
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time"/>
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark"/>
|
||||||
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
|
<result property="openId" column="open_id"/>
|
||||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
<result property="pw" column="pw"/>
|
||||||
</resultMap>
|
<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">
|
<resultMap id="deptResult" type="SysDept">
|
||||||
<id property="deptId" column="dept_id" />
|
<id property="deptId" column="dept_id"/>
|
||||||
<result property="parentId" column="parent_id" />
|
<result property="parentId" column="parent_id"/>
|
||||||
<result property="deptName" column="dept_name" />
|
<result property="deptName" column="dept_name"/>
|
||||||
<result property="orderNum" column="order_num" />
|
<result property="orderNum" column="order_num"/>
|
||||||
<result property="leader" column="leader" />
|
<result property="leader" column="leader"/>
|
||||||
<result property="status" column="dept_status" />
|
<result property="status" column="dept_status"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<resultMap id="RoleResult" type="SysRole">
|
<resultMap id="RoleResult" type="SysRole">
|
||||||
<id property="roleId" column="role_id" />
|
<id property="roleId" column="role_id"/>
|
||||||
<result property="roleName" column="role_name" />
|
<result property="roleName" column="role_name"/>
|
||||||
<result property="roleKey" column="role_key" />
|
<result property="roleKey" column="role_key"/>
|
||||||
<result property="roleSort" column="role_sort" />
|
<result property="roleSort" column="role_sort"/>
|
||||||
<result property="dataScope" column="data_scope" />
|
<result property="dataScope" column="data_scope"/>
|
||||||
<result property="status" column="role_status" />
|
<result property="status" column="role_status"/>
|
||||||
</resultMap>
|
</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
|
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'
|
where dept_id=#{deptId} and role_id=#{roleId} and u.status='0' and u.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<sql id="selectUserVo">
|
<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,
|
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,
|
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
|
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||||
from sys_user u
|
from sys_user u
|
||||||
@ -62,171 +64,197 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
<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
|
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
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
|
||||||
where u.del_flag = '0'
|
sys_user u
|
||||||
<if test="userName != null and userName != ''">
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
AND u.user_name like concat('%', #{userName}, '%')
|
where u.del_flag = '0'
|
||||||
</if>
|
<if test="userName != null and userName != ''">
|
||||||
<if test="status != null and status != ''">
|
AND u.user_name like concat('%', #{userName}, '%')
|
||||||
AND u.status = #{status}
|
</if>
|
||||||
</if>
|
<if test="openId != null and openId != ''">
|
||||||
<if test="phonenumber != null and phonenumber != ''">
|
AND u.open_id = #{openId}
|
||||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
</if>
|
||||||
</if>
|
<if test="status != null and status != ''">
|
||||||
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
AND u.status = #{status}
|
||||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
</if>
|
||||||
</if>
|
<if test="phonenumber != null and phonenumber != ''">
|
||||||
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
</if>
|
||||||
</if>
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||||
<if test="deptId != null and deptId != 0">
|
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||||
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>
|
||||||
</if>
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||||
<!-- 数据范围过滤 -->
|
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||||
${dataScope}
|
</if>
|
||||||
</select>
|
<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 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
|
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
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
|
||||||
where u.del_flag = '0'
|
sys_user u
|
||||||
<if test="userName != null and userName != ''">
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
AND u.user_name like concat('%', #{userName}, '%')
|
where u.del_flag = '0'
|
||||||
</if>
|
<if test="userName != null and userName != ''">
|
||||||
<if test="status != null and status != ''">
|
AND u.user_name like concat('%', #{userName}, '%')
|
||||||
AND u.status = #{status}
|
</if>
|
||||||
</if>
|
<if test="status != null and status != ''">
|
||||||
<if test="phonenumber != null and phonenumber != ''">
|
AND u.status = #{status}
|
||||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
</if>
|
||||||
</if>
|
<if test="phonenumber != null and phonenumber != ''">
|
||||||
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
</if>
|
||||||
</if>
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||||
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
AND date_format(u.create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
</if>
|
||||||
</if>
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||||
<if test="deptId != null and deptId != 0">
|
AND date_format(u.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||||
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>
|
||||||
</if>
|
<if test="deptId != null and deptId != 0">
|
||||||
</select>
|
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">
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_name = #{userName}
|
where u.user_name = #{userName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_id = #{userId}
|
where u.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserListByRoleId" parameterType="SysUser" resultMap="SysUserResult">
|
<select id="selectUserByWxId" parameterType="String" 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
|
<include refid="selectUserVo"/>
|
||||||
from sys_user u
|
where u.open_id = #{openId}
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
</select>
|
||||||
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="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="selectUserOnlyByRoleId" parameterType="Long" resultMap="SysUserResult">
|
</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 * FROM sys_user where del_flag = '0' and user_id in (select user_id from sys_user_role where role_id = #{roleId});
|
||||||
</select>
|
</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 count(1) from sys_user where user_name = #{userName}
|
||||||
</select>
|
</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 user_id, phonenumber from sys_user where phonenumber = #{phonenumber}
|
||||||
</select>
|
</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 user_id, email from sys_user where email = #{email}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
insert into sys_user(
|
insert into sys_user(
|
||||||
<if test="userId != null and userId != 0">user_id,</if>
|
<if test="userId != null and userId != 0">user_id,</if>
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
<if test="userName != null and userName != ''">user_name,</if>
|
<if test="userName != null and userName != ''">user_name,</if>
|
||||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||||
<if test="email != null and email != ''">email,</if>
|
<if test="email != null and email != ''">email,</if>
|
||||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||||
<if test="sex != null and sex != ''">sex,</if>
|
<if test="sex != null and sex != ''">sex,</if>
|
||||||
<if test="password != null and password != ''">password,</if>
|
<if test="password != null and password != ''">password,</if>
|
||||||
<if test="status != null and status != ''">status,</if>
|
<if test="status != null and status != ''">status,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
create_time
|
<if test="openId != null and openId != ''">open_id,</if>
|
||||||
)values(
|
<if test="pw != null and pw != ''">pw,</if>
|
||||||
<if test="userId != null and userId != ''">#{userId},</if>
|
create_time
|
||||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
)values(
|
||||||
<if test="userName != null and userName != ''">#{userName},</if>
|
<if test="userId != null and userId != ''">#{userId},</if>
|
||||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||||
<if test="email != null and email != ''">#{email},</if>
|
<if test="userName != null and userName != ''">#{userName},</if>
|
||||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
<if test="email != null and email != ''">#{email},</if>
|
||||||
<if test="sex != null and sex != ''">#{sex},</if>
|
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||||
<if test="password != null and password != ''">#{password},</if>
|
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||||
<if test="status != null and status != ''">#{status},</if>
|
<if test="sex != null and sex != ''">#{sex},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="password != null and password != ''">#{password},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="status != null and status != ''">#{status},</if>
|
||||||
sysdate()
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
)
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
</insert>
|
<if test="openId != null and openId != ''">#{openId},</if>
|
||||||
|
<if test="pw != null and pw != ''">#{pw},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateUser" parameterType="SysUser">
|
<update id="updateUser" parameterType="SysUser">
|
||||||
update sys_user
|
update sys_user
|
||||||
<set>
|
<set>
|
||||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||||
<if test="email != null and email != ''">email = #{email},</if>
|
<if test="email != null and email != ''">email = #{email},</if>
|
||||||
<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
|
<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
|
||||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||||
<if test="password != null and password != ''">password = #{password},</if>
|
<if test="password != null and password != ''">password = #{password},</if>
|
||||||
<if test="status != null and status != ''">status = #{status},</if>
|
<if test="status != null and status != ''">status = #{status},</if>
|
||||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
update_time = sysdate()
|
<if test="openId != null and openId != ''">open_id = #{openId},</if>
|
||||||
</set>
|
<if test="pw != null and pw != ''">open_id = #{pw},</if>
|
||||||
where user_id = #{userId}
|
update_time = sysdate()
|
||||||
</update>
|
</set>
|
||||||
|
where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="updateUserStatus" parameterType="SysUser">
|
<update id="updateUserStatus" parameterType="SysUser">
|
||||||
update sys_user set status = #{status} where user_id = #{userId}
|
update sys_user set status = #{status} where user_id = #{userId}
|
||||||
</update>
|
</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 sys_user set avatar = #{avatar} where user_name = #{userName}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="resetUserPwd" parameterType="SysUser">
|
<update id="resetUserPwd" parameterType="SysUser">
|
||||||
update sys_user set password = #{password} where user_name = #{userName}
|
update sys_user set password = #{password},pw=#{pw} where user_name = #{userName}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteUserById" parameterType="Long">
|
<delete id="deleteUserById" parameterType="Long">
|
||||||
delete from sys_user where user_id = #{userId}
|
delete from sys_user where user_id = #{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteUserByIds" parameterType="Long">
|
<delete id="deleteUserByIds" parameterType="Long">
|
||||||
update sys_user set del_flag = '2' where user_id in
|
update sys_user set del_flag = '2' where user_id in
|
||||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||||
#{userId}
|
#{userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user