用户管理、端口池管理页面调通.
This commit is contained in:
@@ -9,6 +9,7 @@ const user = {
|
||||
code: '',
|
||||
token: getToken(),
|
||||
name: '',
|
||||
loginName: '',
|
||||
avatar: '',
|
||||
introduction: '',
|
||||
roles: [],
|
||||
@@ -36,6 +37,9 @@ const user = {
|
||||
SET_NAME: (state, name) => {
|
||||
state.name = name
|
||||
},
|
||||
SET_LOGIN_NAME: (state, loginName) => {
|
||||
state.loginName = loginName
|
||||
},
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
},
|
||||
@@ -68,6 +72,7 @@ const user = {
|
||||
}
|
||||
commit('SET_ROLES', [response.data.data.loginName])
|
||||
commit('SET_NAME', response.data.data.name)
|
||||
commit('SET_LOGIN_NAME', response.data.data.loginName)
|
||||
resolve(response)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
@@ -119,8 +124,10 @@ const user = {
|
||||
setToken(role)
|
||||
getUserInfo(role).then(response => {
|
||||
const data = response.data
|
||||
console.log('111222', data)
|
||||
commit('SET_ROLES', data.roles)
|
||||
commit('SET_NAME', data.name)
|
||||
commit('SET_LOGIN_NAME', data.loginName)
|
||||
commit('SET_AVATAR', data.avatar)
|
||||
commit('SET_INTRODUCTION', data.introduction)
|
||||
resolve()
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
<div class="right-menu">
|
||||
<error-log class="errLog-container right-menu-item"></error-log>
|
||||
|
||||
<el-tooltip effect="dark" :content="$t('navbar.screenfull')" placement="bottom">
|
||||
<screenfull class="screenfull right-menu-item"></screenfull>
|
||||
</el-tooltip>
|
||||
<!-- <el-tooltip effect="dark" :content="$t('navbar.screenfull')" placement="bottom">-->
|
||||
<!-- <screenfull class="screenfull right-menu-item"></screenfull>-->
|
||||
<!-- </el-tooltip>-->
|
||||
|
||||
<lang-select class="international right-menu-item"></lang-select>
|
||||
<!-- <lang-select class="international right-menu-item"></lang-select>-->
|
||||
|
||||
<el-tooltip effect="dark" :content="$t('navbar.theme')" placement="bottom">
|
||||
<theme-picker class="theme-switch right-menu-item"></theme-picker>
|
||||
</el-tooltip>
|
||||
<!-- <el-tooltip effect="dark" :content="$t('navbar.theme')" placement="bottom">-->
|
||||
<!-- <theme-picker class="theme-switch right-menu-item"></theme-picker>-->
|
||||
<!-- </el-tooltip>-->
|
||||
|
||||
<el-dropdown class="avatar-container right-menu-item" trigger="click">
|
||||
<div class="avatar-wrapper">
|
||||
<img class="user-avatar" :src="avatar+'?imageView2/1/w/80/h/80'">
|
||||
<span>{{loginName}}|{{name}}</span>
|
||||
<i class="el-icon-caret-bottom"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
@@ -28,7 +28,7 @@
|
||||
{{$t('navbar.dashboard')}}
|
||||
</el-dropdown-item>
|
||||
</router-link>
|
||||
<a target='_blank' href="https://github.com/PanJiaChen/vue-element-admin/">
|
||||
<a target='_blank' href="https://gitee.com/asgc/neutrino-proxy">
|
||||
<el-dropdown-item>
|
||||
{{$t('navbar.github')}}
|
||||
</el-dropdown-item>
|
||||
@@ -64,7 +64,8 @@ export default {
|
||||
...mapGetters([
|
||||
'sidebar',
|
||||
'name',
|
||||
'avatar'
|
||||
'avatar',
|
||||
'loginName'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
|
||||
+43
-10
@@ -27,14 +27,8 @@ import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.core.db.page.PageQuery;
|
||||
import fun.asgc.neutrino.core.web.annotation.*;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.annotation.OnlyAdmin;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserInfoReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserInfoRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.UserService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
|
||||
@@ -66,8 +60,8 @@ public class UserController {
|
||||
}
|
||||
|
||||
@GetMapping("info")
|
||||
public UserInfoRes info() {
|
||||
return userService.info();
|
||||
public UserInfoRes info(UserInfoReq req) {
|
||||
return userService.info(req);
|
||||
}
|
||||
|
||||
@OnlyAdmin
|
||||
@@ -79,4 +73,43 @@ public class UserController {
|
||||
|
||||
return userService.updateEnableStatus(req);
|
||||
}
|
||||
|
||||
@OnlyAdmin
|
||||
@PostMapping("create")
|
||||
public UserCreateRes create(@RequestBody UserCreateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotEmpty(req.getName(), "name");
|
||||
ParamCheckUtil.checkNotEmpty(req.getLoginName(), "loginName");
|
||||
|
||||
return userService.create(req);
|
||||
}
|
||||
|
||||
@OnlyAdmin
|
||||
@PostMapping("update")
|
||||
public UserUpdateRes update(@RequestBody UserUpdateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotEmpty(req.getName(), "name");
|
||||
ParamCheckUtil.checkNotEmpty(req.getLoginName(), "loginName");
|
||||
|
||||
return userService.update(req);
|
||||
}
|
||||
|
||||
@OnlyAdmin
|
||||
@PostMapping("update/password")
|
||||
public UserUpdatePasswordRes updatePassword(@RequestBody UserUpdatePasswordReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotEmpty(req.getLoginPassword(), "loginPassword");
|
||||
|
||||
return userService.updatePassword(req);
|
||||
}
|
||||
|
||||
@OnlyAdmin
|
||||
@PostMapping("delete")
|
||||
public void delete(@RequestParam("id") Integer id) {
|
||||
ParamCheckUtil.checkNotNull(id, "id");
|
||||
|
||||
userService.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/28
|
||||
*/
|
||||
@Data
|
||||
public class UserCreateReq {
|
||||
private String name;
|
||||
private String loginName;
|
||||
}
|
||||
+5
-1
@@ -21,10 +21,14 @@
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户信息请求
|
||||
* @author: wen.y
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/27
|
||||
*/
|
||||
@Data
|
||||
public class UserInfoReq {
|
||||
private Integer id;
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/28
|
||||
*/
|
||||
@Data
|
||||
public class UserUpdatePasswordReq {
|
||||
private Integer id;
|
||||
private String loginPassword;
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/28
|
||||
*/
|
||||
@Data
|
||||
public class UserUpdateReq {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String loginName;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/28
|
||||
*/
|
||||
public class UserCreateRes {
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/28
|
||||
*/
|
||||
public class UserUpdatePasswordRes {
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/28
|
||||
*/
|
||||
public class UserUpdateRes {
|
||||
|
||||
}
|
||||
+14
-3
@@ -23,13 +23,12 @@ package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.Param;
|
||||
import fun.asgc.neutrino.core.db.annotation.ResultType;
|
||||
import fun.asgc.neutrino.core.db.annotation.Select;
|
||||
import fun.asgc.neutrino.core.db.annotation.Update;
|
||||
import fun.asgc.neutrino.core.db.annotation.*;
|
||||
import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortPoolDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.UserDO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -73,4 +72,16 @@ public interface UserMapper extends SqlMapper {
|
||||
|
||||
@Update("update `user` set enable = :enable where id = :id")
|
||||
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable);
|
||||
|
||||
@Delete("delete from `user` where id = ?")
|
||||
void delete(Integer id);
|
||||
|
||||
@Update("update `user` set name = :name,login_name = :loginName where id = :id")
|
||||
void update(UserDO userDO);
|
||||
|
||||
@Update("update `user` set login_password = :loginPassword where id = :id")
|
||||
void updateLoginPassword(@Param("id") Integer id, @Param("loginPassword") String loginPassword);
|
||||
|
||||
@Insert("insert into user(`name`,`login_name`,`login_password`,`enable`,`create_time`,`update_time`) values(:name,:loginName,:loginPassword,:enable,:createTime,:updateTime)")
|
||||
void add(UserDO user);
|
||||
}
|
||||
|
||||
+44
-9
@@ -25,17 +25,12 @@ import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.core.db.page.PageQuery;
|
||||
import fun.asgc.neutrino.core.util.CollectionUtil;
|
||||
import fun.asgc.neutrino.core.util.DateUtil;
|
||||
import fun.asgc.neutrino.core.web.annotation.GetMapping;
|
||||
import fun.asgc.neutrino.core.web.annotation.RequestBody;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.ServiceException;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LoginReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserLoginRecordMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserMapper;
|
||||
@@ -44,7 +39,6 @@ import fun.asgc.neutrino.proxy.server.dal.entity.UserDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.UserLoginRecordDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.UserTokenDO;
|
||||
import fun.asgc.neutrino.proxy.server.util.Md5Util;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -58,6 +52,7 @@ import java.util.UUID;
|
||||
*/
|
||||
@Component
|
||||
public class UserService {
|
||||
private static final String DEFAULT_PASSWORD = "123456";
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
@Autowired
|
||||
@@ -141,8 +136,12 @@ public class UserService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public UserInfoRes info() {
|
||||
UserDO userDO = userMapper.findById(SystemContextHolder.getUser().getId());
|
||||
public UserInfoRes info(UserInfoReq req) {
|
||||
Integer userId = req.getId();
|
||||
if (null == userId) {
|
||||
userId = SystemContextHolder.getUser().getId();
|
||||
}
|
||||
UserDO userDO = userMapper.findById(userId);
|
||||
if (null == userDO) {
|
||||
return null;
|
||||
}
|
||||
@@ -159,4 +158,40 @@ public class UserService {
|
||||
|
||||
return new UserUpdateEnableStatusRes();
|
||||
}
|
||||
|
||||
public UserCreateRes create(UserCreateReq req) {
|
||||
|
||||
|
||||
Date now = new Date();
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setName(req.getName());
|
||||
userDO.setLoginName(req.getLoginName());
|
||||
userDO.setLoginPassword(Md5Util.encode(DEFAULT_PASSWORD));
|
||||
userDO.setEnable(EnableStatusEnum.ENABLE.getStatus());
|
||||
userDO.setCreateTime(now);
|
||||
userDO.setUpdateTime(now);
|
||||
userMapper.add(userDO);
|
||||
|
||||
return new UserCreateRes();
|
||||
}
|
||||
|
||||
public UserUpdateRes update(UserUpdateReq req) {
|
||||
UserDO userDO = new UserDO();
|
||||
userDO.setId(req.getId());
|
||||
userDO.setName(req.getName());
|
||||
userDO.setLoginName(req.getLoginName());
|
||||
userDO.setUpdateTime(new Date());
|
||||
userMapper.update(userDO);
|
||||
return new UserUpdateRes();
|
||||
}
|
||||
|
||||
public UserUpdatePasswordRes updatePassword(UserUpdatePasswordReq req) {
|
||||
String loginPassword = Md5Util.encode(req.getLoginPassword());
|
||||
userMapper.updateLoginPassword(req.getId(), loginPassword);
|
||||
return new UserUpdatePasswordRes();
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
userMapper.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user