feat():字典、部门、用户等基础业务使用MyBatis-Plus重构,完成度 40%
parent
133ad7830f
commit
744aeef761
|
@ -63,5 +63,5 @@ public interface GenTableColumnMapper extends BaseMapper<GenTableColumn> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableColumnByIds (Long[] ids);
|
||||
int deleteGenTableColumnByIds (List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -88,5 +88,5 @@ public interface GenTableMapper extends BaseMapper<GenTable> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGenTableByIds (Long[] ids);
|
||||
int deleteGenTableByIds (List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteGenTableByIds (Long[] tableIds) {
|
||||
public void deleteGenTableByIds (List<Long> tableIds) {
|
||||
genTableMapper.deleteGenTableByIds(tableIds);
|
||||
genTableColumnMapper.deleteGenTableColumnByIds(tableIds);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public interface IGenTableService {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
void deleteGenTableByIds (Long[] tableIds);
|
||||
void deleteGenTableByIds (List<Long> tableIds);
|
||||
|
||||
/**
|
||||
* 导入表结构
|
||||
|
|
|
@ -57,8 +57,9 @@ public class SysLogininforController extends BaseController {
|
|||
@RequiresPermissions("system:logininfor:remove")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public Result remove (@PathVariable("infoIds") Long[] infoIds) {
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
public Result remove (@PathVariable("infoIds") List<Long> infoIds) {
|
||||
logininforService.deleteLogininforByIds(infoIds);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:logininfor:remove")
|
||||
|
@ -80,6 +81,7 @@ public class SysLogininforController extends BaseController {
|
|||
@InnerAuth
|
||||
@PostMapping
|
||||
public Result add (@RequestBody SysLogininfor logininfor) {
|
||||
return toAjax(logininforService.insertLogininfor(logininfor));
|
||||
logininforService.insertLogininfor(logininfor);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,8 @@ public class SysMenuController extends BaseController {
|
|||
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
menuService.insertMenu(menu);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +105,8 @@ public class SysMenuController extends BaseController {
|
|||
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
menuService.updateMenu(menu);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,7 +122,8 @@ public class SysMenuController extends BaseController {
|
|||
if (menuService.checkMenuExistRole(menuId)) {
|
||||
return warn("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
menuService.deleteMenuById(menuId);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,11 +3,14 @@ package com.muyu.system.controller;
|
|||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.DataPageResp;
|
||||
import com.muyu.common.core.web.page.PageQueryModel;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.system.domain.SysNotice;
|
||||
import com.muyu.system.domain.model.SysNoticePageQueryModel;
|
||||
import com.muyu.system.domain.rep.SysNoticeListReq;
|
||||
import com.muyu.system.service.SysNoticeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -31,9 +34,11 @@ public class SysNoticeController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:notice:list")
|
||||
@PostMapping("/list")
|
||||
public Result<DataPageResp<SysNotice>> list (@RequestBody SysNotice notice) {
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return Result.success(new DataPageResp<>(0,list));
|
||||
public Result<DataPageResp<SysNotice>> list (@RequestBody SysNoticeListReq sysNoticeListReq) {
|
||||
PageQueryModel<SysNotice> sysNoticePageQueryModel = noticeService.pageQuery(SysNoticePageQueryModel.reqBuild(sysNoticeListReq));
|
||||
return Result.success(
|
||||
DataPageResp.of(sysNoticePageQueryModel)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,9 +56,10 @@ public class SysNoticeController extends BaseController {
|
|||
@RequiresPermissions("system:notice:add")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysNotice notice) {
|
||||
public Result<String> add (@Validated @RequestBody SysNotice notice) {
|
||||
notice.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
noticeService.insertNotice(notice);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,9 +68,10 @@ public class SysNoticeController extends BaseController {
|
|||
@RequiresPermissions("system:notice:edit")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysNotice notice) {
|
||||
public Result<String> edit (@Validated @RequestBody SysNotice notice) {
|
||||
notice.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
noticeService.updateNotice(notice);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +80,8 @@ public class SysNoticeController extends BaseController {
|
|||
@RequiresPermissions("system:notice:remove")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public Result remove (@PathVariable("noticeIds") Long[] noticeIds) {
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
public Result<String> remove (@PathVariable("noticeIds") List<Long> noticeIds) {
|
||||
noticeService.deleteNoticeByIds(noticeIds);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SysProfileController extends BaseController {
|
|||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result updateProfile (@RequestBody SysUser user) {
|
||||
public Result<String> updateProfile (@RequestBody SysUser user) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysUser currentUser = loginUser.getSysUser();
|
||||
currentUser.setNickName(user.getNickName());
|
||||
|
@ -72,12 +72,10 @@ public class SysProfileController extends BaseController {
|
|||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) {
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
if (userService.updateUserProfile(currentUser) > 0) {
|
||||
userService.updateUserProfile(currentUser);
|
||||
// 更新缓存用户信息
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改个人信息异常,请联系管理员");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,7 +83,7 @@ public class SysProfileController extends BaseController {
|
|||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public Result updatePwd (String oldPassword, String newPassword) {
|
||||
public Result<String> updatePwd (String oldPassword, String newPassword) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
String password = user.getPassword();
|
||||
|
@ -95,14 +93,12 @@ public class SysProfileController extends BaseController {
|
|||
if (SecurityUtils.matchesPassword(newPassword, password)) {
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword)) > 0) {
|
||||
userService.resetUserPwd(username, SecurityUtils.encryptPassword(newPassword));
|
||||
// 更新缓存用户密码
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,13 +118,12 @@ public class SysProfileController extends BaseController {
|
|||
return error("文件服务异常,请联系管理员");
|
||||
}
|
||||
String url = fileResult.getData().getUrl();
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), url)) {
|
||||
userService.updateUserAvatar(loginUser.getUsername(), url);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getSysUser().setAvatar(url);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return Result.success(url);
|
||||
}
|
||||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.muyu.common.log.annotation.Log;
|
|||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
|
@ -72,7 +71,7 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysRole role) {
|
||||
public Result<String> add (@Validated @RequestBody SysRole role) {
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
|
@ -107,10 +106,11 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public Result dataScope (@RequestBody SysRole role) {
|
||||
public Result<String> dataScope (@RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
roleService.authDataScope(role);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,11 +119,12 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public Result changeStatus (@RequestBody SysRole role) {
|
||||
public Result<String> changeStatus (@RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
roleService.updateRoleStatus(role);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,8 +133,9 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:remove")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public Result remove (@PathVariable("roleIds") Long[] roleIds) {
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
public Result<String> remove (@PathVariable("roleIds") List<Long> roleIds) {
|
||||
roleService.deleteRoleByIds(roleIds);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,7 +143,7 @@ public class SysRoleController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:role:query")
|
||||
@GetMapping("/optionselect")
|
||||
public Result optionselect () {
|
||||
public Result<List<SysRole>> optionselect () {
|
||||
return success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
|
@ -172,7 +174,8 @@ public class SysRoleController extends BaseController {
|
|||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public Result cancelAuthUser (@RequestBody SysUserRole userRole) {
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
roleService.deleteAuthUser(userRole);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,8 +184,9 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public Result cancelAuthUserAll (Long roleId, Long[] userIds) {
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
public Result<String> cancelAuthUserAll (Long roleId, List<Long> userIds) {
|
||||
roleService.deleteAuthUsers(roleId, userIds);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,9 +195,10 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public Result selectAuthUserAll (Long roleId, Long[] userIds) {
|
||||
public Result<String> selectAuthUserAll (Long roleId, List<Long> userIds) {
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
roleService.insertAuthUsers(roleId, userIds);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,7 +206,7 @@ public class SysRoleController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:role:query")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public Result deptTree (@PathVariable("roleId") Long roleId) {
|
||||
public Result<DeptTreeResp> deptTree (@PathVariable("roleId") Long roleId) {
|
||||
return Result.success(
|
||||
DeptTreeResp.builder()
|
||||
.depts(deptService.selectDeptTreeList())
|
||||
|
|
|
@ -10,22 +10,20 @@ import com.muyu.common.log.enums.BusinessType;
|
|||
import com.muyu.common.security.annotation.InnerAuth;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysDept;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.system.domain.resp.AuthRoleResp;
|
||||
import com.muyu.system.domain.resp.UserDetailInfoResp;
|
||||
import com.muyu.system.domain.resp.UserInfoResp;
|
||||
import com.muyu.system.domain.vo.TreeSelect;
|
||||
import com.muyu.system.service.*;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -71,15 +69,15 @@ public class SysUserController extends BaseController {
|
|||
@PostMapping("/export")
|
||||
public void export (HttpServletResponse response, SysUser user) {
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@RequiresPermissions("system:user:import")
|
||||
@PostMapping("/importData")
|
||||
public Result importData (MultipartFile file, boolean updateSupport) throws Exception {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
public Result<String> importData (MultipartFile file, boolean updateSupport) throws Exception {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
String operName = SecurityUtils.getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
|
@ -87,8 +85,8 @@ public class SysUserController extends BaseController {
|
|||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate (HttpServletResponse response) throws IOException {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
public void importTemplate (HttpServletResponse response) {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<>(SysUser.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
|
||||
|
@ -123,10 +121,11 @@ public class SysUserController extends BaseController {
|
|||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||
return Result.error("当前系统没有开启注册功能!");
|
||||
}
|
||||
if (!userService.checkUserNameUnique(sysUser)) {
|
||||
if (userService.checkUserNameUnique(sysUser)) {
|
||||
return Result.error("保存用户'" + username + "'失败,注册账号已存在");
|
||||
}
|
||||
return Result.success(userService.registerUser(sysUser));
|
||||
userService.registerUser(sysUser);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +134,7 @@ public class SysUserController extends BaseController {
|
|||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/getInfo")
|
||||
public Result getInfo () {
|
||||
public Result<UserInfoResp> getInfo () {
|
||||
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
|
@ -156,7 +155,7 @@ public class SysUserController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:user:query")
|
||||
@GetMapping(value = {"/", "/{userId}"})
|
||||
public Result getInfo (@PathVariable(value = "userId", required = false) Long userId) {
|
||||
public Result<UserDetailInfoResp> getInfo (@PathVariable(value = "userId", required = false) Long userId) {
|
||||
userService.checkUserDataScope(userId);
|
||||
UserDetailInfoResp.UserDetailInfoRespBuilder<?, ?> builder = UserDetailInfoResp.builder();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
|
@ -180,8 +179,8 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysUser user) {
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
public Result<String> add (@Validated @RequestBody SysUser user) {
|
||||
if (userService.checkUserNameUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
|
@ -190,7 +189,8 @@ public class SysUserController extends BaseController {
|
|||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
userService.insertUser(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,10 +199,10 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody SysUser user) {
|
||||
public Result<String> edit (@Validated @RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
if (userService.checkUserNameUnique(user)) {
|
||||
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
|
@ -210,7 +210,8 @@ public class SysUserController extends BaseController {
|
|||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
userService.updateUser(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,11 +220,12 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:remove")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public Result remove (@PathVariable("userIds") Long[] userIds) {
|
||||
if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) {
|
||||
public Result<String> remove (@PathVariable("userIds") List<Long> userIds) {
|
||||
if (userIds.contains(SecurityUtils.getUserId())) {
|
||||
return error("当前用户不能删除");
|
||||
}
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
userService.deleteUserByIds(userIds);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,12 +234,13 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public Result resetPwd (@RequestBody SysUser user) {
|
||||
public Result<String> resetPwd (@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
userService.resetPwd(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,11 +249,12 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public Result changeStatus (@RequestBody SysUser user) {
|
||||
public Result<String> changeStatus (@RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
userService.updateUserStatus(user);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,7 +262,7 @@ public class SysUserController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:user:query")
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public Result authRole (@PathVariable("userId") Long userId) {
|
||||
public Result<AuthRoleResp> authRole (@PathVariable("userId") Long userId) {
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
return Result.success(
|
||||
|
@ -275,7 +279,7 @@ public class SysUserController extends BaseController {
|
|||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
public Result insertAuthRole (Long userId, Long[] roleIds) {
|
||||
public Result<String> insertAuthRole (Long userId, Long[] roleIds) {
|
||||
userService.checkUserDataScope(userId);
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
|
@ -286,7 +290,7 @@ public class SysUserController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("system:user:list")
|
||||
@GetMapping("/deptTree")
|
||||
public Result deptTree () {
|
||||
public Result<List<TreeSelect>> deptTree () {
|
||||
return success(deptService.selectDeptTreeList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,30 +11,7 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysLogininforMapper extends BaseMapper<SysLogininfor> {
|
||||
/**
|
||||
* 新增系统登录日志
|
||||
*
|
||||
* @param logininfor 访问日志对象
|
||||
*/
|
||||
public int insertLogininfor (SysLogininfor logininfor);
|
||||
|
||||
/**
|
||||
* 查询系统登录日志集合
|
||||
*
|
||||
* @param logininfor 访问日志对象
|
||||
*
|
||||
* @return 登录记录集合
|
||||
*/
|
||||
public List<SysLogininfor> selectLogininforList (SysLogininfor logininfor);
|
||||
|
||||
/**
|
||||
* 批量删除系统登录日志
|
||||
*
|
||||
* @param infoIds 需要删除的登录日志ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLogininforByIds (Long[] infoIds);
|
||||
|
||||
/**
|
||||
* 清空系统登录日志
|
||||
|
|
|
@ -12,21 +12,6 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 菜单列表
|
||||
*/
|
||||
public List<SysMenu> selectMenuList (SysMenu menu);
|
||||
|
||||
/**
|
||||
* 根据用户所有权限
|
||||
*
|
||||
* @return 权限列表
|
||||
*/
|
||||
public List<String> selectMenuPerms ();
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
|
@ -80,59 +65,4 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|||
* @return 选中菜单列表
|
||||
*/
|
||||
public List<Long> selectMenuListByRoleId (@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
||||
|
||||
/**
|
||||
* 根据菜单ID查询信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public SysMenu selectMenuById (Long menuId);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int hasChildByMenuId (Long menuId);
|
||||
|
||||
/**
|
||||
* 新增菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu (SysMenu menu);
|
||||
|
||||
/**
|
||||
* 修改菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu (SysMenu menu);
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuById (Long menuId);
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
*
|
||||
* @param menuName 菜单名称
|
||||
* @param parentId 父菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysMenu checkMenuNameUnique (@Param("menuName") String menuName, @Param("parentId") Long parentId);
|
||||
}
|
||||
|
|
|
@ -11,57 +11,4 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysNoticeMapper extends BaseMapper<SysNotice> {
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
*
|
||||
* @return 公告信息
|
||||
*/
|
||||
public SysNotice selectNoticeById (Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<SysNotice> selectNoticeList (SysNotice notice);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNotice (SysNotice notice);
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNotice (SysNotice notice);
|
||||
|
||||
/**
|
||||
* 批量删除公告
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeById (Long noticeId);
|
||||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds (Long[] noticeIds);
|
||||
}
|
||||
|
|
|
@ -11,39 +11,6 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysOperLogMapper extends BaseMapper<SysOperLog> {
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
public int insertOperlog (SysOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<SysOperLog> selectOperLogList (SysOperLog operLog);
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOperLogByIds (Long[] operIds);
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
* @param operId 操作ID
|
||||
*
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
public SysOperLog selectOperLogById (Long operId);
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
|
|
|
@ -20,22 +20,6 @@ public interface SysPostMapper extends BaseMapper<SysPost> {
|
|||
*/
|
||||
public List<SysPost> selectPostList (SysPost post);
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
public List<SysPost> selectPostAll ();
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
*
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
public SysPost selectPostById (Long postId);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取岗位选择框列表
|
||||
*
|
||||
|
@ -53,58 +37,4 @@ public interface SysPostMapper extends BaseMapper<SysPost> {
|
|||
* @return 结果
|
||||
*/
|
||||
public List<SysPost> selectPostsByUserName (String userName);
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostById (Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostByIds (Long[] postIds);
|
||||
|
||||
/**
|
||||
* 修改岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePost (SysPost post);
|
||||
|
||||
/**
|
||||
* 新增岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPost (SysPost post);
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*
|
||||
* @param postName 岗位名称
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysPost checkPostNameUnique (String postName);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*
|
||||
* @param postCode 岗位编码
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysPost checkPostCodeUnique (String postCode);
|
||||
}
|
||||
|
|
|
@ -12,39 +12,5 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysRoleDeptMapper extends BaseMapper<SysRoleDept> {
|
||||
/**
|
||||
* 通过角色ID删除角色和部门关联
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleDeptByRoleId (Long roleId);
|
||||
|
||||
/**
|
||||
* 批量删除角色部门关联信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleDept (Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询部门使用数量
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int selectCountRoleDeptByDeptId (Long deptId);
|
||||
|
||||
/**
|
||||
* 批量新增角色部门信息
|
||||
*
|
||||
* @param roleDeptList 角色部门列表
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchRoleDept (List<SysRoleDept> roleDeptList);
|
||||
}
|
||||
|
|
|
@ -100,5 +100,5 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleByIds (Long[] roleIds);
|
||||
public int deleteRoleByIds (List<Long> roleIds);
|
||||
}
|
||||
|
|
|
@ -13,43 +13,5 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {
|
||||
/**
|
||||
* 查询菜单使用数量
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int checkMenuExistRole (Long menuId);
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色和菜单关联
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleMenuByRoleId (Long roleId);
|
||||
|
||||
/**
|
||||
* 批量删除角色菜单关联信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleMenu (Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增角色菜单信息
|
||||
*
|
||||
* @param roleMenuList 角色菜单列表
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchRoleMenu (List<SysRoleMenu> roleMenuList);
|
||||
|
||||
// 批量保存角色与菜单的关联
|
||||
boolean saveBatch(@Param("roleMenuList") List<SysRoleMenu> roleMenuList);
|
||||
|
||||
}
|
||||
|
|
|
@ -57,86 +57,4 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
*/
|
||||
public SysUser selectUserById (Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser (SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser (SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserAvatar (@Param("userName") String userName, @Param("avatar") String avatar);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd (@Param("userName") String userName, @Param("password") String password);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById (Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserByIds (Long[] userIds);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param userName 用户名称
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkUserNameUnique (String userName);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param phonenumber 手机号码
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkPhoneUnique (String phonenumber);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param email 用户邮箱
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique (String email);
|
||||
}
|
||||
|
|
|
@ -11,39 +11,5 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysUserPostMapper extends BaseMapper<SysUserPost> {
|
||||
/**
|
||||
* 通过用户ID删除用户和岗位关联
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserPostByUserId (Long userId);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserPostById (Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除用户和岗位关联
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserPost (Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增用户岗位信息
|
||||
*
|
||||
* @param userPostList 用户角色列表
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUserPost (List<SysUserPost> userPostList);
|
||||
}
|
||||
|
|
|
@ -12,58 +12,5 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||
/**
|
||||
* 通过用户ID删除用户和角色关联
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleByUserId (Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户和角色关联
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRole (Long[] ids);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserRoleByRoleId (Long roleId);
|
||||
|
||||
/**
|
||||
* 批量新增用户角色信息
|
||||
*
|
||||
* @param userRoleList 用户角色列表
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUserRole (List<SysUserRole> userRoleList);
|
||||
|
||||
/**
|
||||
* 删除用户和角色关联信息
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleInfo (SysUserRole userRole);
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleInfos (@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.muyu.system.domain.model.SysConfigPageQueryModel;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统配置业务层
|
||||
* @author DongZl
|
||||
* @description: 配置plus业务层
|
||||
* @Date 2023-11-13 上午 10:06
|
||||
|
|
|
@ -46,7 +46,7 @@ public interface SysDictDataService extends IService<SysDictData> {
|
|||
*
|
||||
* @param dictCodes 需要删除的字典数据ID
|
||||
*/
|
||||
public void deleteDictDataByIds (Long[] dictCodes);
|
||||
public void deleteDictDataByIds (List<Long> dictCodes);
|
||||
|
||||
/**
|
||||
* 新增保存字典数据信息
|
||||
|
|
|
@ -62,7 +62,7 @@ public interface SysDictTypeService extends IService<SysDictType> {
|
|||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
public void deleteDictTypeByIds (Long[] dictIds);
|
||||
public void deleteDictTypeByIds (List<Long> dictIds);
|
||||
|
||||
/**
|
||||
* 加载字典缓存数据
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface SysLogininforService extends IService<SysLogininfor> {
|
|||
*
|
||||
* @param logininfor 访问日志对象
|
||||
*/
|
||||
public int insertLogininfor (SysLogininfor logininfor);
|
||||
public void insertLogininfor (SysLogininfor logininfor);
|
||||
|
||||
/**
|
||||
* 查询系统登录日志集合
|
||||
|
@ -37,7 +37,7 @@ public interface SysLogininforService extends IService<SysLogininfor> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteLogininforByIds (Long[] infoIds);
|
||||
public void deleteLogininforByIds (List<Long> infoIds);
|
||||
|
||||
/**
|
||||
* 清空系统登录日志
|
||||
|
|
|
@ -131,28 +131,22 @@ public interface SysMenuService extends IService<SysMenu> {
|
|||
* 新增保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMenu (SysMenu menu);
|
||||
public void insertMenu (SysMenu menu);
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMenu (SysMenu menu);
|
||||
public void updateMenu (SysMenu menu);
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMenuById (Long menuId);
|
||||
public void deleteMenuById (Long menuId);
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
|
@ -163,6 +157,4 @@ public interface SysMenuService extends IService<SysMenu> {
|
|||
*/
|
||||
public boolean checkMenuNameUnique (SysMenu menu);
|
||||
|
||||
PageQueryModel<SysMenu> pageQuery(SysMenuPageQueryModel sysMenuPageQueryModel, Long userId);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,15 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysNoticeService extends IService<SysNotice> {
|
||||
|
||||
|
||||
/**
|
||||
* 通知公告份也查询
|
||||
* @param sysNoticePageQueryModel 分页查询模型
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageQueryModel<SysNotice> pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel);
|
||||
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
|
@ -22,15 +31,6 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
*/
|
||||
public SysNotice selectNoticeById (Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<SysNotice> selectNoticeList (SysNotice notice);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
|
@ -38,7 +38,7 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNotice (SysNotice notice);
|
||||
public void insertNotice (SysNotice notice);
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
|
@ -47,7 +47,7 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNotice (SysNotice notice);
|
||||
public void updateNotice (SysNotice notice);
|
||||
|
||||
/**
|
||||
* 删除公告信息
|
||||
|
@ -56,7 +56,7 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeById (Long noticeId);
|
||||
public void deleteNoticeById (Long noticeId);
|
||||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
|
@ -65,7 +65,6 @@ public interface SysNoticeService extends IService<SysNotice> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds (Long[] noticeIds);
|
||||
public void deleteNoticeByIds (List<Long> noticeIds);
|
||||
|
||||
PageQueryModel<SysNotice> pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel);
|
||||
}
|
||||
|
|
|
@ -20,16 +20,14 @@ public interface SysOperLogService extends IService<SysOperLog> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertOperlog (SysOperLog operLog);
|
||||
public void insertOperlog (SysOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*
|
||||
* @return 操作日志集合
|
||||
* 操作日志 分页查询
|
||||
* @param sysOperlogPageQueryModel 分页模型查询
|
||||
* @return 分页结果
|
||||
*/
|
||||
public List<SysOperLog> selectOperLogList (SysOperLog operLog);
|
||||
PageQueryModel<SysOperLog> pageQuery(SysOperlogPageQueryModel sysOperlogPageQueryModel);
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
|
@ -38,7 +36,7 @@ public interface SysOperLogService extends IService<SysOperLog> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOperLogByIds (Long[] operIds);
|
||||
public void deleteOperLogByIds (List<Long> operIds);
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
|
@ -54,6 +52,4 @@ public interface SysOperLogService extends IService<SysOperLog> {
|
|||
*/
|
||||
public void cleanOperLog ();
|
||||
|
||||
PageQueryModel<SysOperLog> pageQuery(SysOperlogPageQueryModel sysOperlogPageQueryModel);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,15 +13,6 @@ import java.util.List;
|
|||
* @author muyu
|
||||
*/
|
||||
public interface SysPostService extends IService<SysPost> {
|
||||
/**
|
||||
* 查询岗位信息集合
|
||||
*
|
||||
* @param post 岗位信息
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
public List<SysPost> selectPostList (SysPost post);
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
|
@ -72,7 +63,7 @@ public interface SysPostService extends IService<SysPost> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserPostById (Long postId);
|
||||
public long countUserPostById (Long postId);
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
|
@ -81,7 +72,7 @@ public interface SysPostService extends IService<SysPost> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostById (Long postId);
|
||||
public void deletePostById (Long postId);
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
|
@ -90,7 +81,7 @@ public interface SysPostService extends IService<SysPost> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePostByIds (Long[] postIds);
|
||||
public void deletePostByIds (List<Long> postIds);
|
||||
|
||||
/**
|
||||
* 新增保存岗位信息
|
||||
|
@ -99,7 +90,7 @@ public interface SysPostService extends IService<SysPost> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPost (SysPost post);
|
||||
public void insertPost (SysPost post);
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
|
@ -108,7 +99,7 @@ public interface SysPostService extends IService<SysPost> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePost (SysPost post);
|
||||
public void updatePost (SysPost post);
|
||||
|
||||
PageQueryModel<SysPost> pageQuery(SysPostPageQueryModel sysPostPageQueryModel);
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.system.domain.SysRoleDept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色与部门关联业务层
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 角色与部门关联业务
|
||||
* @date 2025/2/13 19:42
|
||||
*/
|
||||
public interface SysRoleDeptService extends IService<SysRoleDept> {
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色和部门关联
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
void deleteRoleDeptByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色与部门关联
|
||||
* @param roleIds 角色ID集合
|
||||
*/
|
||||
void deleteRoleDept(List<Long> roleIds);
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.system.domain.SysRoleMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色与菜单关联业务层
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 角色与菜单关联
|
||||
* @date 2025/2/13 19:10
|
||||
*/
|
||||
public interface SysRoleMenuService extends IService<SysRoleMenu> {
|
||||
|
||||
/**
|
||||
* 查询菜单下是否含有角色
|
||||
* @param menuId 菜单ID
|
||||
* @return 含有角色数量
|
||||
*/
|
||||
boolean checkMenuExistRole(Long menuId);
|
||||
|
||||
/**
|
||||
* 根据角色ID删除与菜单关联关系
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
void deleteRoleMenuByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 通过角色ID集合删除与菜单关联关系
|
||||
* @param roleIdList 角色ID集合
|
||||
*/
|
||||
void deleteRoleMenu(List<Long> roleIdList);
|
||||
}
|
|
@ -106,7 +106,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int countUserRoleByRoleId (Long roleId);
|
||||
public long countUserRoleByRoleId (Long roleId);
|
||||
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
|
@ -132,7 +132,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean updateRoleStatus (SysRole role);
|
||||
public void updateRoleStatus (SysRole role);
|
||||
|
||||
/**
|
||||
* 修改数据权限信息
|
||||
|
@ -140,7 +140,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean authDataScope (SysRole role);
|
||||
public void authDataScope (SysRole role);
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
|
@ -155,10 +155,8 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
* 批量删除角色信息
|
||||
*
|
||||
* @param roleIds 需要删除的角色ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRoleByIds (Long[] roleIds);
|
||||
public void deleteRoleByIds (List<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 取消授权用户角色
|
||||
|
@ -167,7 +165,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAuthUser (SysUserRole userRole);
|
||||
public void deleteAuthUser (SysUserRole userRole);
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
|
@ -177,7 +175,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAuthUsers (Long roleId, Long[] userIds);
|
||||
public void deleteAuthUsers (Long roleId, List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 批量选择授权用户角色
|
||||
|
@ -187,7 +185,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAuthUsers (Long roleId, Long[] userIds);
|
||||
public void insertAuthUsers (Long roleId, List<Long> userIds);
|
||||
|
||||
PageQueryModel<SysRole> pageQuery(SysRolePageQueryModel sysRolePageQueryModel);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与岗位关联业务层
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 用户与岗位关联业务层
|
||||
* @date 2025/2/13 21:49
|
||||
*/
|
||||
public interface SysUserPostService extends IService<SysUserPost> {
|
||||
/**
|
||||
* 通过用户ID删除用户与岗位关联
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
void deleteUserPostByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户与岗位关联
|
||||
* @param userIds 用户ID集合
|
||||
*/
|
||||
void deleteUserPost(List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
* @param postId 岗位ID
|
||||
* @return 使用数量
|
||||
*/
|
||||
long countUserPostById(Long postId);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与角色关联业务层
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 用户与角色关联业务层
|
||||
* @date 2025/2/13 21:50
|
||||
*/
|
||||
public interface SysUserRoleService extends IService<SysUserRole> {
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户和角色关联
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteUserRoleByUserId (Long userId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
long countUserRoleByRoleId(Long roleId);
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户和角色关联信息
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
*/
|
||||
public void deleteUserRoleInfo (SysUserRole userRole);
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteUserRoleInfos (Long roleId, List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 删除用户与角色关联
|
||||
* @param userIds 用户ID集合
|
||||
*/
|
||||
void deleteUserRole(List<Long> userIds);
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.web.page.PageQueryModel;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.model.SysUserPageQueryModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,7 +18,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUserList (SysUser user);
|
||||
List<SysUser> selectUserList (SysUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
|
@ -29,7 +27,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectAllocatedList (SysUser user);
|
||||
List<SysUser> selectAllocatedList (SysUser user);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
|
@ -38,7 +36,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<SysUser> selectUnallocatedList (SysUser user);
|
||||
List<SysUser> selectUnallocatedList (SysUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
|
@ -47,7 +45,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByUserName (String userName);
|
||||
SysUser selectUserByUserName (String userName);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
|
@ -56,7 +54,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserById (Long userId);
|
||||
SysUser selectUserById (Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户所属角色组
|
||||
|
@ -65,7 +63,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public String selectUserRoleGroup (String userName);
|
||||
String selectUserRoleGroup (String userName);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询用户所属岗位组
|
||||
|
@ -74,7 +72,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public String selectUserPostGroup (String userName);
|
||||
String selectUserPostGroup (String userName);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
|
@ -83,7 +81,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkUserNameUnique (SysUser user);
|
||||
boolean checkUserNameUnique (SysUser user);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
|
@ -92,7 +90,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkPhoneUnique (SysUser user);
|
||||
boolean checkPhoneUnique (SysUser user);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
|
@ -101,21 +99,21 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkEmailUnique (SysUser user);
|
||||
boolean checkEmailUnique (SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
public void checkUserAllowed (SysUser user);
|
||||
void checkUserAllowed (SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void checkUserDataScope (Long userId);
|
||||
void checkUserDataScope (Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
|
@ -124,7 +122,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser (SysUser user);
|
||||
void insertUser (SysUser user);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
|
@ -133,7 +131,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean registerUser (SysUser user);
|
||||
void registerUser (SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
|
@ -142,7 +140,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser (SysUser user);
|
||||
void updateUser (SysUser user);
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
|
@ -150,7 +148,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
public void insertUserAuth (Long userId, Long[] roleIds);
|
||||
void insertUserAuth (Long userId, Long[] roleIds);
|
||||
|
||||
/**
|
||||
* 修改用户状态
|
||||
|
@ -159,7 +157,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserStatus (SysUser user);
|
||||
void updateUserStatus (SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
|
@ -168,7 +166,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserProfile (SysUser user);
|
||||
void updateUserProfile (SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
|
@ -178,7 +176,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean updateUserAvatar (String userName, String avatar);
|
||||
void updateUserAvatar (String userName, String avatar);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
|
@ -187,7 +185,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetPwd (SysUser user);
|
||||
void resetPwd (SysUser user);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
|
@ -197,7 +195,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd (String userName, String password);
|
||||
void resetUserPwd (String userName, String password);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
|
@ -206,7 +204,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById (Long userId);
|
||||
void deleteUserById (Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
|
@ -215,7 +213,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserByIds (Long[] userIds);
|
||||
void deleteUserByIds (List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 导入用户数据
|
||||
|
@ -226,9 +224,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
PageQueryModel<SysUser> pageQuery(SysUserPageQueryModel sysUserPageQueryModel);
|
||||
String importUser (List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
||||
|
||||
/**
|
||||
* 检查部门下是否含有用户
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 系统配置业务实现层
|
||||
* @author DongZl
|
||||
* @description: 配置plus业务实现层
|
||||
* @Date 2023-11-13 上午 10:06
|
||||
|
|
|
@ -87,7 +87,7 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
|
|||
* @param dictCodes 需要删除的字典数据ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteDictDataByIds (Long[] dictCodes) {
|
||||
public void deleteDictDataByIds (List<Long> dictCodes) {
|
||||
for (Long dictCode : dictCodes) {
|
||||
SysDictData data = this.getOneById(dictCode);
|
||||
LambdaQueryWrapper<SysDictData> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -145,7 +145,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
|||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteDictTypeByIds (Long[] dictIds) {
|
||||
public void deleteDictTypeByIds (List<Long> dictIds) {
|
||||
for (Long dictId : dictIds) {
|
||||
SysDictType dictType = selectDictTypeById(dictId);
|
||||
if (sysDictDataService.isChildByType(dictType.getDictType())) {
|
||||
|
|
|
@ -34,8 +34,8 @@ public class SysLogininforServiceImpl extends ServiceImpl<SysLogininforMapper, S
|
|||
* @param logininfor 访问日志对象
|
||||
*/
|
||||
@Override
|
||||
public int insertLogininfor (SysLogininfor logininfor) {
|
||||
return logininforMapper.insertLogininfor(logininfor);
|
||||
public void insertLogininfor (SysLogininfor logininfor) {
|
||||
this.save(logininfor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,8 +64,8 @@ public class SysLogininforServiceImpl extends ServiceImpl<SysLogininforMapper, S
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteLogininforByIds (Long[] infoIds) {
|
||||
return logininforMapper.deleteLogininforByIds(infoIds);
|
||||
public void deleteLogininforByIds (List<Long> infoIds) {
|
||||
this.removeByIds(infoIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.muyu.system.mapper.SysMenuMapper;
|
|||
import com.muyu.system.mapper.SysRoleMapper;
|
||||
import com.muyu.system.mapper.SysRoleMenuMapper;
|
||||
import com.muyu.system.service.SysMenuService;
|
||||
import com.muyu.system.service.SysRoleMenuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
private SysRoleMenuService sysRoleMenuService;
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
|
@ -68,30 +69,20 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
List<SysMenu> menuList = null;
|
||||
// 管理员显示所有菜单信息
|
||||
if (SysUser.isAdmin(userId)) {
|
||||
menuList = menuMapper.selectMenuList(menu);
|
||||
LambdaQueryWrapper<SysMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName());
|
||||
lambdaQueryWrapper.eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible());
|
||||
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(menu.getStatus()), SysMenu::getStatus, menu.getStatus());
|
||||
lambdaQueryWrapper.orderByAsc(
|
||||
SysMenu::getParentId, SysMenu::getOrderNum
|
||||
);
|
||||
menuList = this.list(lambdaQueryWrapper);
|
||||
} else {
|
||||
menu.getParams().put("userId", userId);
|
||||
menuList = menuMapper.selectMenuListByUserId(menu);
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
@Override
|
||||
public PageQueryModel<SysMenu> pageQuery(SysMenuPageQueryModel sysMenuPageQueryModel, Long userId) {
|
||||
Page<SysMenu> page = null;
|
||||
// 管理员显示所有菜单信息
|
||||
if (SysUser.isAdmin(userId)) {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(sysMenuPageQueryModel.getMenuName()),SysMenu::getMenuName, sysMenuPageQueryModel.getMenuName());
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(sysMenuPageQueryModel.getStatus()),SysMenu::getStatus, sysMenuPageQueryModel.getStatus());
|
||||
page = this.page(sysMenuPageQueryModel.buildPage(), queryWrapper);
|
||||
} else {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(sysMenuPageQueryModel.getMenuName()),SysMenu::getMenuName, sysMenuPageQueryModel.getMenuName());
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(sysMenuPageQueryModel.getStatus()),SysMenu::getStatus, sysMenuPageQueryModel.getStatus());
|
||||
page = this.page(sysMenuPageQueryModel.buildPage(), queryWrapper);
|
||||
}
|
||||
return PageQueryModel.of(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
|
@ -275,7 +266,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*/
|
||||
@Override
|
||||
public SysMenu selectMenuById (Long menuId) {
|
||||
return menuMapper.selectMenuById(menuId);
|
||||
return this.getById(menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,8 +278,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean hasChildByMenuId (Long menuId) {
|
||||
int result = menuMapper.hasChildByMenuId(menuId);
|
||||
return result > 0;
|
||||
// select count(1)
|
||||
// from sys_menu
|
||||
// where parent_id = #{menuId}
|
||||
LambdaQueryWrapper<SysMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysMenu::getParentId, menuId);
|
||||
return this.count(lambdaQueryWrapper) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -300,8 +295,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean checkMenuExistRole (Long menuId) {
|
||||
int result = roleMenuMapper.checkMenuExistRole(menuId);
|
||||
return result > 0;
|
||||
return sysRoleMenuService.checkMenuExistRole(menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -312,8 +306,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMenu (SysMenu menu) {
|
||||
return menuMapper.insertMenu(menu);
|
||||
public void insertMenu (SysMenu menu) {
|
||||
this.save(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,8 +318,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMenu (SysMenu menu) {
|
||||
return menuMapper.updateMenu(menu);
|
||||
public void updateMenu (SysMenu menu) {
|
||||
this.updateById(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,8 +330,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMenuById (Long menuId) {
|
||||
return menuMapper.deleteMenuById(menuId);
|
||||
public void deleteMenuById (Long menuId) {
|
||||
this.removeById(menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -349,9 +343,10 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean checkMenuNameUnique (SysMenu menu) {
|
||||
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
||||
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) {
|
||||
LambdaQueryWrapper<SysMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysMenu::getMenuName, menu.getMenuName());
|
||||
lambdaQueryWrapper.ne(menu.getMenuId() != null, SysMenu::getParentId, menu.getParentId());
|
||||
if (this.count(lambdaQueryWrapper) > 0) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
|
|
@ -27,6 +27,21 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
private SysNoticeMapper noticeMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 通知公告份也查询
|
||||
* @param sysNoticePageQueryModel 分页查询模型
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public PageQueryModel<SysNotice> pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel) {
|
||||
LambdaQueryWrapper<SysNotice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(sysNoticePageQueryModel.getNoticeTitle()),SysNotice::getNoticeTitle, sysNoticePageQueryModel.getNoticeTitle());
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(sysNoticePageQueryModel.getNoticeType()),SysNotice::getNoticeType, sysNoticePageQueryModel.getNoticeType());
|
||||
queryWrapper.like(StringUtils.isNotEmpty(sysNoticePageQueryModel.getCreateBy()),SysNotice::getCreateBy, sysNoticePageQueryModel.getCreateBy());
|
||||
Page<SysNotice> page = this.page(sysNoticePageQueryModel.buildPage(), queryWrapper);
|
||||
return PageQueryModel.of(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
|
@ -36,19 +51,7 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
*/
|
||||
@Override
|
||||
public SysNotice selectNoticeById (Long noticeId) {
|
||||
return noticeMapper.selectNoticeById(noticeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
*
|
||||
* @return 公告集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysNotice> selectNoticeList (SysNotice notice) {
|
||||
return noticeMapper.selectNoticeList(notice);
|
||||
return this.getById(noticeId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,8 +62,8 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNotice (SysNotice notice) {
|
||||
return noticeMapper.insertNotice(notice);
|
||||
public void insertNotice (SysNotice notice) {
|
||||
this.save(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,8 +74,8 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNotice (SysNotice notice) {
|
||||
return noticeMapper.updateNotice(notice);
|
||||
public void updateNotice (SysNotice notice) {
|
||||
this.updateById(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,8 +86,8 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNoticeById (Long noticeId) {
|
||||
return noticeMapper.deleteNoticeById(noticeId);
|
||||
public void deleteNoticeById (Long noticeId) {
|
||||
this.removeById(noticeId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,17 +98,8 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNoticeByIds (Long[] noticeIds) {
|
||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||
public void deleteNoticeByIds (List<Long> noticeIds) {
|
||||
this.removeByIds(noticeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageQueryModel<SysNotice> pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel) {
|
||||
LambdaQueryWrapper<SysNotice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(sysNoticePageQueryModel.getNoticeTitle()),SysNotice::getNoticeTitle, sysNoticePageQueryModel.getNoticeTitle());
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(sysNoticePageQueryModel.getNoticeType()),SysNotice::getNoticeType, sysNoticePageQueryModel.getNoticeType());
|
||||
queryWrapper.like(StringUtils.isNotEmpty(sysNoticePageQueryModel.getCreateBy()),SysNotice::getCreateBy, sysNoticePageQueryModel.getCreateBy());
|
||||
Page<SysNotice> page = this.page(sysNoticePageQueryModel.buildPage(), queryWrapper);
|
||||
return PageQueryModel.of(page);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,54 +34,16 @@ public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOper
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertOperlog (SysOperLog operLog) {
|
||||
return operLogMapper.insertOperlog(operLog);
|
||||
public void insertOperlog (SysOperLog operLog) {
|
||||
this.save(operLog);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*
|
||||
* @return 操作日志集合
|
||||
* 操作日志 分页查询
|
||||
* @param sysOperlogPageQueryModel 分页模型查询
|
||||
* @return 分页结果
|
||||
*/
|
||||
@Override
|
||||
public List<SysOperLog> selectOperLogList (SysOperLog operLog) {
|
||||
return operLogMapper.selectOperLogList(operLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteOperLogByIds (Long[] operIds) {
|
||||
return operLogMapper.deleteOperLogByIds(operIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
* @param operId 操作ID
|
||||
*
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
@Override
|
||||
public SysOperLog selectOperLogById (Long operId) {
|
||||
return operLogMapper.selectOperLogById(operId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
@Override
|
||||
public void cleanOperLog () {
|
||||
operLogMapper.cleanOperLog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageQueryModel<SysOperLog> pageQuery(SysOperlogPageQueryModel sysOperlogPageQueryModel) {
|
||||
LambdaQueryWrapper<SysOperLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -95,4 +57,37 @@ public class SysOperLogServiceImpl extends ServiceImpl<SysOperLogMapper, SysOper
|
|||
Page<SysOperLog> page = this.page(sysOperlogPageQueryModel.buildPage(), queryWrapper);
|
||||
return PageQueryModel.of(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteOperLogByIds (List<Long> operIds) {
|
||||
this.removeByIds(operIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
* @param operId 操作ID
|
||||
*
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
@Override
|
||||
public SysOperLog selectOperLogById (Long operId) {
|
||||
return getById(operId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
@Override
|
||||
public void cleanOperLog () {
|
||||
operLogMapper.cleanOperLog();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.muyu.system.domain.model.SysPostPageQueryModel;
|
|||
import com.muyu.system.mapper.SysPostMapper;
|
||||
import com.muyu.system.mapper.SysUserPostMapper;
|
||||
import com.muyu.system.service.SysPostService;
|
||||
import com.muyu.system.service.SysUserPostService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -32,17 +33,8 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
@Autowired
|
||||
private SysUserPostMapper userPostMapper;
|
||||
|
||||
/**
|
||||
* 查询岗位信息集合
|
||||
*
|
||||
* @param post 岗位信息
|
||||
*
|
||||
* @return 岗位信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysPost> selectPostList (SysPost post) {
|
||||
return postMapper.selectPostList(post);
|
||||
}
|
||||
@Autowired
|
||||
private SysUserPostService sysUserPostService;
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
|
@ -51,7 +43,7 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
*/
|
||||
@Override
|
||||
public List<SysPost> selectPostAll () {
|
||||
return postMapper.selectPostAll();
|
||||
return this.list();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +55,7 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
*/
|
||||
@Override
|
||||
public SysPost selectPostById (Long postId) {
|
||||
return postMapper.selectPostById(postId);
|
||||
return getById(postId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,9 +79,10 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean checkPostNameUnique (SysPost post) {
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
|
||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
|
||||
LambdaQueryWrapper<SysPost> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysPost::getPostName, post.getPostName());
|
||||
lambdaQueryWrapper.eq(post.getPostId() != null, SysPost::getPostId, post.getPostId());
|
||||
if (this.count(lambdaQueryWrapper) != 0) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
@ -104,9 +97,11 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean checkPostCodeUnique (SysPost post) {
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
|
||||
if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
|
||||
|
||||
LambdaQueryWrapper<SysPost> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysPost::getPostCode, post.getPostCode());
|
||||
lambdaQueryWrapper.eq(post.getPostId() != null, SysPost::getPostId, post.getPostId());
|
||||
if (this.count(lambdaQueryWrapper) != 0) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
@ -120,8 +115,8 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int countUserPostById (Long postId) {
|
||||
return userPostMapper.countUserPostById(postId);
|
||||
public long countUserPostById (Long postId) {
|
||||
return sysUserPostService.countUserPostById(postId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,8 +127,8 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePostById (Long postId) {
|
||||
return postMapper.deletePostById(postId);
|
||||
public void deletePostById (Long postId) {
|
||||
this.removeById(postId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,14 +139,14 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePostByIds (Long[] postIds) {
|
||||
public void deletePostByIds (List<Long> postIds) {
|
||||
for (Long postId : postIds) {
|
||||
SysPost post = selectPostById(postId);
|
||||
if (countUserPostById(postId) > 0) {
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
|
||||
}
|
||||
}
|
||||
return postMapper.deletePostByIds(postIds);
|
||||
this.removeByIds(postIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,8 +157,8 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPost (SysPost post) {
|
||||
return postMapper.insertPost(post);
|
||||
public void insertPost (SysPost post) {
|
||||
this.save(post);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,8 +169,8 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePost (SysPost post) {
|
||||
return postMapper.updatePost(post);
|
||||
public void updatePost (SysPost post) {
|
||||
this.updateById(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.system.domain.SysRoleDept;
|
||||
import com.muyu.system.mapper.SysRoleDeptMapper;
|
||||
import com.muyu.system.service.SysRoleDeptService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色与部门关联业务实现
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 角色与部门关联业务实现
|
||||
* @date 2025/2/13 19:43
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleDeptServiceImpl extends ServiceImpl<SysRoleDeptMapper, SysRoleDept> implements SysRoleDeptService {
|
||||
/**
|
||||
* 通过角色ID删除角色和部门关联
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteRoleDeptByRoleId(Long roleId) {
|
||||
LambdaQueryWrapper<SysRoleDept> lambdaQueryWrapper = new LambdaQueryWrapper<SysRoleDept>().eq(SysRoleDept::getRoleId, roleId);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色与部门关联
|
||||
*
|
||||
* @param roleIds 角色ID集合
|
||||
*/
|
||||
@Override
|
||||
public void deleteRoleDept(List<Long> roleIds) {
|
||||
LambdaQueryWrapper<SysRoleDept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SysRoleDept::getRoleId, roleIds);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.system.domain.SysRoleMenu;
|
||||
import com.muyu.system.mapper.SysRoleMenuMapper;
|
||||
import com.muyu.system.service.SysRoleMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色与菜单关联业务实现层
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 角色与菜单关联业务实现层
|
||||
* @date 2025/2/13 19:11
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper,SysRoleMenu> implements SysRoleMenuService {
|
||||
/**
|
||||
* 查询菜单下是否含有角色
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 含有角色数量
|
||||
*/
|
||||
@Override
|
||||
public boolean checkMenuExistRole(Long menuId) {
|
||||
LambdaQueryWrapper<SysRoleMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysRoleMenu::getMenuId, menuId);
|
||||
return count(lambdaQueryWrapper) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID删除与菜单关联关系
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteRoleMenuByRoleId(Long roleId) {
|
||||
LambdaQueryWrapper<SysRoleMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysRoleMenu::getRoleId, roleId);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID集合删除与菜单关联关系
|
||||
*
|
||||
* @param roleIdList 角色ID集合
|
||||
*/
|
||||
@Override
|
||||
public void deleteRoleMenu(List<Long> roleIdList) {
|
||||
LambdaQueryWrapper<SysRoleMenu> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SysRoleMenu::getRoleId, roleIdList);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -5,13 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.constant.UserConstants;
|
||||
import com.muyu.common.core.enums.SysDelFlagEnum;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.page.PageQueryModel;
|
||||
import com.muyu.common.datascope.annotation.DataScope;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysOperLog;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.domain.SysRoleDept;
|
||||
|
@ -20,9 +20,11 @@ import com.muyu.system.domain.SysUserRole;
|
|||
import com.muyu.system.domain.model.SysRolePageQueryModel;
|
||||
import com.muyu.system.mapper.SysRoleDeptMapper;
|
||||
import com.muyu.system.mapper.SysRoleMapper;
|
||||
import com.muyu.system.mapper.SysRoleMenuMapper;
|
||||
import com.muyu.system.mapper.SysUserRoleMapper;
|
||||
import com.muyu.system.service.SysRoleDeptService;
|
||||
import com.muyu.system.service.SysRoleMenuService;
|
||||
import com.muyu.system.service.SysRoleService;
|
||||
import com.muyu.system.service.SysUserRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -40,13 +42,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
private SysRoleMenuService sysRoleMenuService;
|
||||
|
||||
@Autowired
|
||||
private SysRoleDeptMapper roleDeptMapper;
|
||||
private SysRoleDeptService sysRoleDeptService;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
|
@ -216,8 +218,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int countUserRoleByRoleId (Long roleId) {
|
||||
return userRoleMapper.countUserRoleByRoleId(roleId);
|
||||
public long countUserRoleByRoleId (Long roleId) {
|
||||
return sysUserRoleService.countUserRoleByRoleId(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,7 +279,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
// 执行更新
|
||||
this.update(updateWrapper);
|
||||
// 删除角色与菜单关联
|
||||
roleMenuMapper.deleteRoleMenuByRoleId(sysRole.getRoleId());
|
||||
sysRoleMenuService.deleteRoleMenuByRoleId(sysRole.getRoleId());
|
||||
return insertRoleMenu(sysRole);
|
||||
}
|
||||
|
||||
|
@ -288,9 +290,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean updateRoleStatus (SysRole role) {
|
||||
public void updateRoleStatus (SysRole role) {
|
||||
// 通过 roleId 更新角色信息
|
||||
return updateById(role);
|
||||
updateById(role);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -301,14 +303,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean authDataScope (SysRole role) {
|
||||
public void authDataScope (SysRole role) {
|
||||
// 修改角色信息
|
||||
// 通过 roleId 更新角色信息
|
||||
boolean updateResult = updateById(role);
|
||||
updateById(role);
|
||||
// 删除角色与部门关联
|
||||
roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
|
||||
// 新增角色和部门信息(数据权限)
|
||||
return updateResult;
|
||||
sysRoleDeptService.deleteRoleDeptByRoleId(role.getRoleId());
|
||||
// TODO 可能代码缺失 新增角色和部门信息(数据权限)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,7 +320,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
public int insertRoleMenu (SysRole role) {
|
||||
// 假设role.getMenuIds()返回角色关联的菜单ID列表
|
||||
List<Long> menuIds = List.of(role.getMenuIds());
|
||||
if (menuIds == null || menuIds.isEmpty()){
|
||||
if (menuIds.isEmpty()){
|
||||
return 0;
|
||||
}
|
||||
// 新增用户与角色管理
|
||||
|
@ -331,7 +332,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
list.add(rm);
|
||||
}
|
||||
// 使用MyBatis-Plus的saveBatch方法批量插入角色与菜单的关联关系
|
||||
boolean saveResult = roleMenuMapper.saveBatch(list);
|
||||
boolean saveResult = sysRoleMenuService.saveBatch(list);
|
||||
|
||||
// 返回成功插入的数量
|
||||
return saveResult ? list.size() : 0;
|
||||
|
@ -352,8 +353,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
rd.setDeptId(deptId);
|
||||
list.add(rd);
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
rows = roleDeptMapper.batchRoleDept(list);
|
||||
if (!list.isEmpty()) {
|
||||
sysRoleDeptService.saveBatch(list);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
@ -369,9 +370,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteRoleById (Long roleId) {
|
||||
// 删除角色与菜单关联
|
||||
roleMenuMapper.deleteRoleMenuByRoleId(roleId);
|
||||
sysRoleMenuService.deleteRoleMenuByRoleId(roleId);
|
||||
// 删除角色与部门关联
|
||||
roleDeptMapper.deleteRoleDeptByRoleId(roleId);
|
||||
sysRoleDeptService.deleteRoleDeptByRoleId(roleId);
|
||||
return roleMapper.deleteRoleById(roleId);
|
||||
}
|
||||
|
||||
|
@ -384,7 +385,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteRoleByIds (Long[] roleIds) {
|
||||
public void deleteRoleByIds (List<Long> roleIds) {
|
||||
for (Long roleId : roleIds) {
|
||||
checkRoleAllowed(new SysRole(roleId));
|
||||
checkRoleDataScope(roleId);
|
||||
|
@ -394,10 +395,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
}
|
||||
}
|
||||
// 删除角色与菜单关联
|
||||
roleMenuMapper.deleteRoleMenu(roleIds);
|
||||
sysRoleMenuService.deleteRoleMenu(roleIds);
|
||||
// 删除角色与部门关联
|
||||
roleDeptMapper.deleteRoleDept(roleIds);
|
||||
return roleMapper.deleteRoleByIds(roleIds);
|
||||
sysRoleDeptService.deleteRoleDept(roleIds);
|
||||
LambdaUpdateWrapper<SysRole> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(SysRole::getDelFlag, SysDelFlagEnum.NOT_EXIST.getCode());
|
||||
lambdaUpdateWrapper.eq(SysRole::getRoleId, roleIds);
|
||||
this.removeByIds(roleIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -408,8 +412,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAuthUser (SysUserRole userRole) {
|
||||
return userRoleMapper.deleteUserRoleInfo(userRole);
|
||||
public void deleteAuthUser (SysUserRole userRole) {
|
||||
sysUserRoleService.deleteUserRoleInfo(userRole);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -421,8 +425,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAuthUsers (Long roleId, Long[] userIds) {
|
||||
return userRoleMapper.deleteUserRoleInfos(roleId, userIds);
|
||||
public void deleteAuthUsers (Long roleId, List<Long> userIds) {
|
||||
sysUserRoleService.deleteUserRoleInfos(roleId, userIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -434,16 +438,16 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAuthUsers (Long roleId, Long[] userIds) {
|
||||
public void insertAuthUsers (Long roleId, List<Long> userIds) {
|
||||
// 新增用户与角色管理
|
||||
List<SysUserRole> list = new ArrayList<SysUserRole>();
|
||||
List<SysUserRole> list = new ArrayList<>();
|
||||
for (Long userId : userIds) {
|
||||
SysUserRole ur = new SysUserRole();
|
||||
ur.setUserId(userId);
|
||||
ur.setRoleId(roleId);
|
||||
list.add(ur);
|
||||
}
|
||||
return userRoleMapper.batchUserRole(list);
|
||||
sysUserRoleService.saveBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
import com.muyu.system.mapper.SysUserPostMapper;
|
||||
import com.muyu.system.service.SysUserPostService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与岗位关联业务实现层
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 用户与岗位关联业务实现层
|
||||
* @date 2025/2/13 21:51
|
||||
*/
|
||||
@Service
|
||||
public class SysUserPostServiceImpl extends ServiceImpl<SysUserPostMapper, SysUserPost> implements SysUserPostService {
|
||||
/**
|
||||
* 通过用户ID删除用户与岗位关联
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserPostByUserId(Long userId) {
|
||||
LambdaQueryWrapper<SysUserPost> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUserPost::getUserId, userId);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户与岗位关联
|
||||
*
|
||||
* @param userIds 用户ID集合
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserPost(List<Long> userIds) {
|
||||
|
||||
LambdaQueryWrapper<SysUserPost> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SysUserPost::getUserId, userIds);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 使用数量
|
||||
*/
|
||||
@Override
|
||||
public long countUserPostById(Long postId) {
|
||||
LambdaQueryWrapper<SysUserPost> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUserPost::getPostId, postId);
|
||||
return this.count(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
import com.muyu.system.mapper.SysUserRoleMapper;
|
||||
import com.muyu.system.service.SysUserRoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户与角色关联业务实现层
|
||||
* @author dongzeliang
|
||||
* @version 1.0
|
||||
* @description: 用户与角色关联业务实现层
|
||||
* @date 2025/2/13 21:50
|
||||
*/
|
||||
@Service
|
||||
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {
|
||||
/**
|
||||
* 通过用户ID删除用户和角色关联
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserRoleByUserId(Long userId) {
|
||||
LambdaQueryWrapper<SysUserRole> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUserRole::getUserId, userId);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public long countUserRoleByRoleId(Long roleId) {
|
||||
LambdaQueryWrapper<SysUserRole> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUserRole::getRoleId, roleId);
|
||||
return this.count(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户和角色关联信息
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserRoleInfo(SysUserRole userRole) {
|
||||
//delete
|
||||
// from sys_user_role
|
||||
// where user_id = #{userId}
|
||||
// and role_id = #{roleId}
|
||||
LambdaUpdateWrapper<SysUserRole> lambdaUpdateWrapper = new LambdaUpdateWrapper<SysUserRole>();
|
||||
lambdaUpdateWrapper.eq(SysUserRole::getUserId, userRole.getUserId());
|
||||
lambdaUpdateWrapper.eq(SysUserRole::getRoleId, userRole.getRoleId());
|
||||
this.remove(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserRoleInfos(Long roleId, List<Long> userIds) {
|
||||
LambdaQueryWrapper<SysUserRole> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUserRole::getRoleId, roleId);
|
||||
lambdaQueryWrapper.in(SysUserRole::getUserId, userIds);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户与角色关联
|
||||
*
|
||||
* @param userIds 用户ID集合
|
||||
*/
|
||||
@Override
|
||||
public void deleteUserRole(List<Long> userIds) {
|
||||
LambdaQueryWrapper<SysUserRole> lambdaQueryWrapper = new LambdaQueryWrapper<SysUserRole>();
|
||||
lambdaQueryWrapper.in(SysUserRole::getUserId, userIds);
|
||||
this.remove(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -1,15 +1,16 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.constant.UserConstants;
|
||||
import com.muyu.common.core.enums.SysDelFlagEnum;
|
||||
import com.muyu.common.core.enums.SysNormalDisableEnum;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.core.utils.SpringUtils;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.utils.bean.BeanValidators;
|
||||
import com.muyu.common.core.web.page.PageQueryModel;
|
||||
import com.muyu.common.datascope.annotation.DataScope;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
|
@ -17,8 +18,9 @@ import com.muyu.common.system.domain.SysUser;
|
|||
import com.muyu.system.domain.SysPost;
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
import com.muyu.system.domain.model.SysUserPageQueryModel;
|
||||
import com.muyu.system.mapper.*;
|
||||
import com.muyu.system.service.SysUserPostService;
|
||||
import com.muyu.system.service.SysUserRoleService;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import com.muyu.system.service.SysConfigService;
|
||||
import jakarta.validation.Validator;
|
||||
|
@ -31,7 +33,6 @@ import org.springframework.util.CollectionUtils;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -52,8 +53,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
private SysPostMapper postMapper;
|
||||
@Autowired
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserPostMapper userPostMapper;
|
||||
private SysUserRoleService sysUserRoleService;
|
||||
@Autowired
|
||||
private SysUserPostService sysUserPostService;
|
||||
@Autowired
|
||||
private SysConfigService configService;
|
||||
|
||||
|
@ -161,13 +165,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean checkUserNameUnique (SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUser::getUserName, user.getUserName());
|
||||
lambdaQueryWrapper.eq(SysUser::getDelFlag, SysDelFlagEnum.EXIST.getCode());
|
||||
lambdaQueryWrapper.eq(user.getUserId() != null,SysUser::getUserId, user.getUserId());
|
||||
if (this.count(lambdaQueryWrapper) > 0) {
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
|
@ -178,13 +184,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean checkPhoneUnique (SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUser::getPhonenumber, user.getPhonenumber());
|
||||
lambdaQueryWrapper.eq(SysUser::getDelFlag, SysDelFlagEnum.EXIST.getCode());
|
||||
lambdaQueryWrapper.eq(user.getUserId() != null,SysUser::getUserId, user.getUserId());
|
||||
if (this.count(lambdaQueryWrapper) > 0) {
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
|
@ -195,13 +203,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean checkEmailUnique (SysUser user) {
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
||||
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
LambdaQueryWrapper<SysUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysUser::getEmail, user.getEmail());
|
||||
lambdaQueryWrapper.eq(SysUser::getDelFlag, SysDelFlagEnum.EXIST.getCode());
|
||||
lambdaQueryWrapper.eq(user.getUserId() != null,SysUser::getUserId, user.getUserId());
|
||||
if (this.count(lambdaQueryWrapper) > 0) {
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
|
@ -241,14 +251,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertUser (SysUser user) {
|
||||
public void insertUser (SysUser user) {
|
||||
// 新增用户信息
|
||||
int rows = userMapper.insertUser(user);
|
||||
this.save(user);
|
||||
// 新增用户岗位关联
|
||||
insertUserPost(user);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -259,8 +268,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean registerUser (SysUser user) {
|
||||
return userMapper.insertUser(user) > 0;
|
||||
public void registerUser (SysUser user) {
|
||||
this.save(user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,17 +281,17 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateUser (SysUser user) {
|
||||
public void updateUser (SysUser user) {
|
||||
Long userId = user.getUserId();
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
sysUserRoleService.deleteUserRoleByUserId(userId);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
// 删除用户与岗位关联
|
||||
userPostMapper.deleteUserPostByUserId(userId);
|
||||
sysUserPostService.deleteUserPostByUserId(userId);
|
||||
// 新增用户与岗位管理
|
||||
insertUserPost(user);
|
||||
return userMapper.updateUser(user);
|
||||
this.updateById(user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,7 +303,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertUserAuth (Long userId, Long[] roleIds) {
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
sysUserRoleService.deleteUserRoleByUserId(userId);
|
||||
insertUserRole(userId, roleIds);
|
||||
}
|
||||
|
||||
|
@ -306,8 +315,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserStatus (SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
public void updateUserStatus (SysUser user) {
|
||||
// set status = #{status}
|
||||
// where user_id = #{userId}
|
||||
LambdaUpdateWrapper<SysUser> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(SysUser::getUserId, user.getUserId());
|
||||
lambdaUpdateWrapper.set(SysUser::getStatus, user.getStatus());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -318,8 +332,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserProfile (SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
public void updateUserProfile (SysUser user) {
|
||||
this.updateById(user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,8 +345,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean updateUserAvatar (String userName, String avatar) {
|
||||
return userMapper.updateUserAvatar(userName, avatar) > 0;
|
||||
public void updateUserAvatar (String userName, String avatar) {
|
||||
LambdaUpdateWrapper<SysUser> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(SysUser::getUserName, userName);
|
||||
lambdaUpdateWrapper.eq(SysUser::getAvatar, avatar);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -343,8 +360,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int resetPwd (SysUser user) {
|
||||
return userMapper.updateUser(user);
|
||||
public void resetPwd (SysUser user) {
|
||||
LambdaUpdateWrapper<SysUser> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(SysUser::getPassword, user.getPassword());
|
||||
lambdaUpdateWrapper.set(SysUser::getUpdateBy, SecurityUtils.getUsername());
|
||||
lambdaUpdateWrapper.eq(SysUser::getUserName, user.getUserName());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -356,8 +377,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int resetUserPwd (String userName, String password) {
|
||||
return userMapper.resetUserPwd(userName, password);
|
||||
public void resetUserPwd (String userName, String password) {
|
||||
LambdaUpdateWrapper<SysUser> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(SysUser::getPassword, password);
|
||||
lambdaUpdateWrapper.eq(SysUser::getUserName, userName);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -385,7 +409,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
up.setPostId(postId);
|
||||
list.add(up);
|
||||
}
|
||||
userPostMapper.batchUserPost(list);
|
||||
sysUserPostService.saveBatch(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,7 +429,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
ur.setRoleId(roleId);
|
||||
list.add(ur);
|
||||
}
|
||||
userRoleMapper.batchUserRole(list);
|
||||
sysUserRoleService.saveBatch(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,12 +442,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteUserById (Long userId) {
|
||||
public void deleteUserById (Long userId) {
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
||||
sysUserRoleService.deleteUserRoleByUserId(userId);
|
||||
// 删除用户与岗位表
|
||||
userPostMapper.deleteUserPostByUserId(userId);
|
||||
return userMapper.deleteUserById(userId);
|
||||
sysUserPostService.deleteUserPostByUserId(userId);
|
||||
LambdaUpdateWrapper<SysUser> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(SysUser::getDelFlag, SysDelFlagEnum.NOT_EXIST.getCode());
|
||||
lambdaUpdateWrapper.eq(SysUser::getUserId, userId);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -435,16 +462,19 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteUserByIds (Long[] userIds) {
|
||||
public void deleteUserByIds (List<Long> userIds) {
|
||||
for (Long userId : userIds) {
|
||||
checkUserAllowed(new SysUser(userId));
|
||||
checkUserDataScope(userId);
|
||||
}
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRole(userIds);
|
||||
sysUserRoleService.deleteUserRole(userIds);
|
||||
// 删除用户与岗位关联
|
||||
userPostMapper.deleteUserPost(userIds);
|
||||
return userMapper.deleteUserByIds(userIds);
|
||||
sysUserPostService.deleteUserPost(userIds);
|
||||
LambdaUpdateWrapper<SysUser> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(SysUser::getDelFlag, SysDelFlagEnum.NOT_EXIST.getCode());
|
||||
lambdaUpdateWrapper.in(SysUser::getUserId, userIds);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -474,7 +504,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
BeanValidators.validateWithException(validator, user);
|
||||
user.setPassword(SecurityUtils.encryptPassword(password));
|
||||
user.setCreateBy(operName);
|
||||
userMapper.insertUser(user);
|
||||
this.save(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
||||
} else if (isUpdateSupport) {
|
||||
|
@ -483,7 +513,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
checkUserDataScope(u.getUserId());
|
||||
user.setUserId(u.getUserId());
|
||||
user.setUpdateBy(operName);
|
||||
userMapper.updateUser(user);
|
||||
this.updateById(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
|
||||
} else {
|
||||
|
@ -505,19 +535,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageQueryModel<SysUser> pageQuery(SysUserPageQueryModel sysUserPageQueryModel) {
|
||||
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(sysUserPageQueryModel.getPhonenumber()),SysUser::getPhonenumber, sysUserPageQueryModel.getPhonenumber());
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(sysUserPageQueryModel.getNickName()),SysUser::getNickName, sysUserPageQueryModel.getNickName());
|
||||
queryWrapper.eq(Objects.nonNull(sysUserPageQueryModel.getStatus()),SysUser::getStatus, sysUserPageQueryModel.getStatus());
|
||||
queryWrapper.gt(Objects.nonNull(sysUserPageQueryModel.getBeginTime()),SysUser::getCreateTime, sysUserPageQueryModel.getBeginTime());
|
||||
queryWrapper.lt(Objects.nonNull(sysUserPageQueryModel.getEndTime()),SysUser::getCreateTime, sysUserPageQueryModel.getEndTime());
|
||||
Page<SysUser> page = this.page(sysUserPageQueryModel.buildPage(), queryWrapper);
|
||||
return PageQueryModel.of(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查部门下是否含有用户
|
||||
*
|
||||
|
|
|
@ -13,39 +13,6 @@
|
|||
<result property="accessTime" column="access_time"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertLogininfor" parameterType="com.muyu.common.system.domain.SysLogininfor">
|
||||
insert into sys_logininfor (user_name, status, ipaddr, msg, access_time)
|
||||
values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate())
|
||||
</insert>
|
||||
|
||||
<select id="selectLogininforList" parameterType="com.muyu.common.system.domain.SysLogininfor" resultMap="SysLogininforResult">
|
||||
select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor
|
||||
<where>
|
||||
<if test="ipaddr != null and ipaddr != ''">
|
||||
AND ipaddr like concat('%', #{ipaddr}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND access_time >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND access_time <= #{params.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by info_id desc
|
||||
</select>
|
||||
|
||||
<delete id="deleteLogininforByIds" parameterType="Long">
|
||||
delete from sys_logininfor where info_id in
|
||||
<foreach collection="array" item="infoId" open="(" separator="," close=")">
|
||||
#{infoId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="cleanLogininfor">
|
||||
truncate table sys_logininfor
|
||||
|
|
|
@ -46,22 +46,6 @@
|
|||
from sys_menu
|
||||
</sql>
|
||||
|
||||
<select id="selectMenuList" parameterType="com.muyu.system.domain.SysMenu" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
<where>
|
||||
<if test="menuName != null and menuName != ''">
|
||||
AND menu_name like concat('%', #{menuName}, '%')
|
||||
</if>
|
||||
<if test="visible != null and visible != ''">
|
||||
AND visible = #{visible}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by parent_id, order_num
|
||||
</select>
|
||||
|
||||
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
|
||||
select distinct m.menu_id,
|
||||
m.parent_id,
|
||||
|
@ -144,13 +128,6 @@
|
|||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPerms" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role ur on rm.role_id = ur.role_id
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
|
@ -169,90 +146,4 @@
|
|||
where m.status = '0'
|
||||
and rm.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where menu_id = #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="hasChildByMenuId" resultType="Integer">
|
||||
select count(1)
|
||||
from sys_menu
|
||||
where parent_id = #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="checkMenuNameUnique" parameterType="com.muyu.system.domain.SysMenu" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateMenu" parameterType="com.muyu.system.domain.SysMenu">
|
||||
update sys_menu
|
||||
<set>
|
||||
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="path != null and path != ''">path = #{path},</if>
|
||||
<if test="component != null">component = #{component},</if>
|
||||
<if test="query != null">`query` = #{query},</if>
|
||||
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
|
||||
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
|
||||
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
|
||||
<if test="visible != null">visible = #{visible},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="perms !=null">perms = #{perms},</if>
|
||||
<if test="icon !=null and icon != ''">icon = #{icon},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where menu_id = #{menuId}
|
||||
</update>
|
||||
|
||||
<insert id="insertMenu" parameterType="com.muyu.system.domain.SysMenu">
|
||||
insert into sys_menu(
|
||||
<if test="menuId != null and menuId != 0">menu_id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="menuName != null and menuName != ''">menu_name,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="path != null and path != ''">path,</if>
|
||||
<if test="component != null and component != ''">component,</if>
|
||||
<if test="query != null and query != ''">`query`,</if>
|
||||
<if test="isFrame != null and isFrame != ''">is_frame,</if>
|
||||
<if test="isCache != null and isCache != ''">is_cache,</if>
|
||||
<if test="menuType != null and menuType != ''">menu_type,</if>
|
||||
<if test="visible != null">visible,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="perms !=null and perms != ''">perms,</if>
|
||||
<if test="icon != null and icon != ''">icon,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="menuId != null and menuId != 0">#{menuId},</if>
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="menuName != null and menuName != ''">#{menuName},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="path != null and path != ''">#{path},</if>
|
||||
<if test="component != null and component != ''">#{component},</if>
|
||||
<if test="query != null and query != ''">#{query},</if>
|
||||
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
|
||||
<if test="isCache != null and isCache != ''">#{isCache},</if>
|
||||
<if test="menuType != null and menuType != ''">#{menuType},</if>
|
||||
<if test="visible != null">#{visible},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="perms !=null and perms != ''">#{perms},</if>
|
||||
<if test="icon != null and icon != ''">#{icon},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteMenuById" parameterType="Long">
|
||||
delete
|
||||
from sys_menu
|
||||
where menu_id = #{menuId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -31,70 +31,4 @@
|
|||
from sys_notice
|
||||
</sql>
|
||||
|
||||
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
|
||||
<include refid="selectNoticeVo"/>
|
||||
where notice_id = #{noticeId}
|
||||
</select>
|
||||
|
||||
<select id="selectNoticeList" parameterType="com.muyu.system.domain.SysNotice" resultMap="SysNoticeResult">
|
||||
<include refid="selectNoticeVo"/>
|
||||
<where>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">
|
||||
AND notice_title like concat('%', #{noticeTitle}, '%')
|
||||
</if>
|
||||
<if test="noticeType != null and noticeType != ''">
|
||||
AND notice_type = #{noticeType}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
AND create_by like concat('%', #{createBy}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
||||
insert into sys_notice (
|
||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
||||
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
||||
<if test="noticeContent != null and noticeContent != '' ">notice_content,</if>
|
||||
<if test="status != null and status != '' ">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
|
||||
<if test="noticeType != null and noticeType != ''">#{noticeType},</if>
|
||||
<if test="noticeContent != null and noticeContent != ''">#{noticeContent},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateNotice" parameterType="com.muyu.system.domain.SysNotice">
|
||||
update sys_notice
|
||||
<set>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle},</if>
|
||||
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType},</if>
|
||||
<if test="noticeContent != null">notice_content = #{noticeContent},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteNoticeById" parameterType="Long">
|
||||
delete
|
||||
from sys_notice
|
||||
where notice_id = #{noticeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNoticeByIds" parameterType="Long">
|
||||
delete from sys_notice where notice_id in
|
||||
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
|
||||
#{noticeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -50,52 +50,6 @@
|
|||
#{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
|
||||
</insert>
|
||||
|
||||
<select id="selectOperLogList" parameterType="com.muyu.common.system.domain.SysOperLog" resultMap="SysOperLogResult">
|
||||
<include refid="selectOperLogVo"/>
|
||||
<where>
|
||||
<if test="operIp != null and operIp != ''">
|
||||
AND oper_ip like concat('%', #{operIp}, '%')
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
AND title like concat('%', #{title}, '%')
|
||||
</if>
|
||||
<if test="businessType != null">
|
||||
AND business_type = #{businessType}
|
||||
</if>
|
||||
<if test="businessTypes != null and businessTypes.length > 0">
|
||||
AND business_type in
|
||||
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
|
||||
#{businessType}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="operName != null and operName != ''">
|
||||
AND oper_name like concat('%', #{operName}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND oper_time >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND oper_time <= #{params.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by oper_id desc
|
||||
</select>
|
||||
|
||||
<delete id="deleteOperLogByIds" parameterType="Long">
|
||||
delete from sys_oper_log where oper_id in
|
||||
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
||||
#{operId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
|
||||
<include refid="selectOperLogVo"/>
|
||||
where oper_id = #{operId}
|
||||
</select>
|
||||
|
||||
<update id="cleanOperLog">
|
||||
truncate table sys_oper_log
|
||||
</update>
|
||||
|
|
|
@ -9,30 +9,4 @@
|
|||
<result property="deptId" column="dept_id"/>
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteRoleDeptByRoleId" parameterType="Long">
|
||||
delete
|
||||
from sys_role_dept
|
||||
where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<select id="selectCountRoleDeptByDeptId" resultType="Integer">
|
||||
select count(1)
|
||||
from sys_role_dept
|
||||
where dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteRoleDept" parameterType="Long">
|
||||
delete from sys_role_dept where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchRoleDept">
|
||||
insert into sys_role_dept(role_id, dept_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.roleId},#{item.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -9,36 +9,5 @@
|
|||
<result property="menuId" column="menu_id"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="checkMenuExistRole" resultType="Integer">
|
||||
select count(1)
|
||||
from sys_role_menu
|
||||
where menu_id = #{menuId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
|
||||
delete
|
||||
from sys_role_menu
|
||||
where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRoleMenu" parameterType="Long">
|
||||
delete from sys_role_menu where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchRoleMenu">
|
||||
insert into sys_role_menu(role_id, menu_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.roleId},#{item.menuId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="saveBatch">
|
||||
insert into sys_role_menu(role_id, menu_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.roleId},#{item.menuId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -160,112 +160,11 @@
|
|||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, user_name
|
||||
from sys_user
|
||||
where user_name = #{userName}
|
||||
and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, phonenumber
|
||||
from sys_user
|
||||
where phonenumber = #{phonenumber}
|
||||
and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email
|
||||
from sys_user
|
||||
where email = #{email}
|
||||
and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="com.muyu.common.system.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="com.muyu.common.system.domain.SysUser">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="email != null ">email = #{email},</if>
|
||||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserStatus" parameterType="com.muyu.common.system.domain.SysUser">
|
||||
update sys_user
|
||||
set status = #{status}
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserAvatar" parameterType="com.muyu.common.system.domain.SysUser">
|
||||
update sys_user
|
||||
set avatar = #{avatar}
|
||||
where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
<update id="resetUserPwd" parameterType="com.muyu.common.system.domain.SysUser">
|
||||
update sys_user
|
||||
set password = #{password}
|
||||
where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
update sys_user
|
||||
set del_flag = '2'
|
||||
where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserByIds" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -9,30 +9,5 @@
|
|||
<result property="postId" column="post_id"/>
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteUserPostByUserId" parameterType="Long">
|
||||
delete
|
||||
from sys_user_post
|
||||
where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<select id="countUserPostById" resultType="Integer">
|
||||
select count(1)
|
||||
from sys_user_post
|
||||
where post_id = #{postId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserPost" parameterType="Long">
|
||||
delete from sys_user_post where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchUserPost">
|
||||
insert into sys_user_post(user_id, post_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.userId},#{item.postId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -8,44 +8,4 @@
|
|||
<result property="userId" column="user_id"/>
|
||||
<result property="roleId" column="role_id"/>
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteUserRoleByUserId" parameterType="Long">
|
||||
delete
|
||||
from sys_user_role
|
||||
where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<select id="countUserRoleByRoleId" resultType="Integer">
|
||||
select count(1)
|
||||
from sys_user_role
|
||||
where role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserRole" parameterType="Long">
|
||||
delete from sys_user_role where user_id in
|
||||
<foreach collection="array" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchUserRole">
|
||||
insert into sys_user_role(user_id, role_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.userId},#{item.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteUserRoleInfo" parameterType="com.muyu.system.domain.SysUserRole">
|
||||
delete
|
||||
from sys_user_role
|
||||
where user_id = #{userId}
|
||||
and role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserRoleInfos">
|
||||
delete from sys_user_role where role_id=#{roleId} and user_id in
|
||||
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue