From f28e09acc11d8c1e82de8571de0e89a120a56e62 Mon Sep 17 00:00:00 2001 From: du <1725534722@qq.com> Date: Mon, 18 Nov 2024 18:53:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E4=BD=8Dbugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/tc/controller/UnitController.java | 136 ++++++++++++++++++ .../controller/system/SysUserController.java | 104 ++++---------- .../com/ruoyi/system/mapper/UnitMapper.java | 22 ++- .../com/ruoyi/system/service/UnitService.java | 29 +++- .../service/impl/SysUserServiceImpl.java | 11 -- .../system/service/impl/UnitServiceImpl.java | 61 +++++++- .../resources/mapper/system/UnitMapper.xml | 25 +++- 7 files changed, 287 insertions(+), 101 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java new file mode 100644 index 0000000..eb0f0cf --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/UnitController.java @@ -0,0 +1,136 @@ +package com.ruoyi.tc.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.Unit; +import com.ruoyi.common.core.domain.request.UnitRequest; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.service.UnitService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.util.List; + +/** + * 单位(unit)表控制层 + * @author du + * @since 2024/11/18 17:11 + */ +@Api(tags = "单位表控制层") +@RestController +//@PreAuthorize("@ss.hasAnyRoles('admin,common')") +@RequestMapping("/tc/unit") +public class UnitController { + + @Resource + private UnitService unitService; + + /** + * 获取单位列表 + */ + @ApiOperation(value = "获取单位列表",response = Unit.class) + @GetMapping("/list") + public AjaxResult list(Page page, UnitRequest unit) { + return AjaxResult.success(unitService.page(page,unit)); + } + /** + * 单位导出 + */ + @ApiOperation(value = "单位导出") + @Log(title = "单位导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, UnitRequest unit) { + List list = unitService.selectUnitList(unit); + ExcelUtil util = new ExcelUtil<>(Unit.class); + util.exportExcel(response, list, "单位数据"); + } + /** + * 单位导入 + */ + @ApiOperation(value = "单位导入") + @Log(title = "单位导入", businessType = BusinessType.IMPORT) + @PostMapping("/importData") + public AjaxResult importData(MultipartFile file) throws Exception { + ExcelUtil util = new ExcelUtil<>(Unit.class); + List list = util.importExcel(file.getInputStream()); + unitService.saveBatch(list); + for (Unit x : list) { + //查询用户表是否存在该用户 + unitService.validUser(x); + } + return AjaxResult.success(); + } + + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) { + ExcelUtil util = new ExcelUtil<>(Unit.class); + util.importTemplateExcel(response, "单位模板"); + } + + /** + * 根据id获取详细信息 + */ + @ApiOperation(value = "根据用户编号获取详细信息") + @GetMapping("/{id}") + public AjaxResult getInfo(@PathVariable(value = "id") Long id) { + return AjaxResult.success(unitService.getById(id)); + } + + /** + * 新增单位 + */ + @ApiOperation(value = "新增单位") + @Log(title = "用户管理", businessType = BusinessType.INSERT) + @PostMapping + @Transactional(rollbackFor = Exception.class) + public AjaxResult add(@Valid @RequestBody Unit unit) { + if (!unitService.lambdaQuery().eq(Unit::getUserName, unit.getUserName()).eq(Unit::getDelFlag,"0").list().isEmpty()) { + throw new ServiceException(unit.getUserName() + "'已存在单位!"); + } + //新增单位到单位信息表 + unitService.save(unit); + //查询用户表是否存在该用户 + unitService.validUser(unit); + return AjaxResult.success(); + } + + /** + * 修改用户 + */ + @ApiOperation(value = "修改用户") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping + @Transactional(rollbackFor = Exception.class) + public AjaxResult edit(@Valid @RequestBody Unit x) { + Unit byId = unitService.getById(x.getId()); + if (!byId.getUserName().equals(x.getUserName())||!byId.getNickName().equals(x.getNickName())) { + throw new ServiceException("不允许修改单位名称和统一信用代码!"); + } + unitService.updateById(x); + return AjaxResult.success(); + } + + /** + * 删除单位 + */ + @ApiOperation(value = "删除单位") + @Log(title = "删除单位", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + List userNames = unitService.selectByIds(ids); + //逻辑删除单位和用户 + unitService.deleteUsers(userNames); + unitService.deleteUnits(ids); + return AjaxResult.success(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index cb9894c..e9837e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -6,16 +6,15 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.domain.entity.Unit; -import com.ruoyi.common.core.domain.request.UnitRequest; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.system.service.*; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import com.ruoyi.system.service.ISysDeptService; +import com.ruoyi.system.service.ISysPostService; +import com.ruoyi.system.service.ISysRoleService; +import com.ruoyi.system.service.ISysUserService; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -23,7 +22,6 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.stream.Collectors; @@ -34,7 +32,6 @@ import java.util.stream.Collectors; * @author ruoyi */ @RestController -@Api(tags = "用户信息") @RequestMapping("/system/user") public class SysUserController extends BaseController { @Autowired @@ -49,13 +46,9 @@ public class SysUserController extends BaseController { @Autowired private ISysPostService postService; - @Resource - private UnitService unitService; - /** * 获取用户列表 */ - @ApiOperation(value = "获取用户列表") @PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/list") public TableDataInfo list(SysUser user) { @@ -63,56 +56,36 @@ public class SysUserController extends BaseController { List list = userService.selectUserList(user); return getDataTable(list); } - @ApiOperation(value = "用户单位导出") - @Log(title = "用户单位管理", businessType = BusinessType.EXPORT) + + @Log(title = "用户管理", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('system:user:export')") @PostMapping("/export") - public void export(HttpServletResponse response, UnitRequest unit) { -// List list = userService.selectUserList(user); -// ExcelUtil util = new ExcelUtil(SysUser.class); -// util.exportExcel(response, list, "用户数据"); - List list = unitService.selectUnitList(unit); - ExcelUtil util = new ExcelUtil<>(Unit.class); - util.exportExcel(response, list, "单位数据"); + public void export(HttpServletResponse response, SysUser user) { + List list = userService.selectUserList(user); + ExcelUtil util = new ExcelUtil(SysUser.class); + util.exportExcel(response, list, "用户数据"); } - @ApiOperation(value = "用户单位导入") - @Log(title = "用户单位管理", businessType = BusinessType.IMPORT) + + @Log(title = "用户管理", businessType = BusinessType.IMPORT) @PreAuthorize("@ss.hasPermi('system:user:import')") @PostMapping("/importData") public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { -// ExcelUtil util = new ExcelUtil(SysUser.class); -// List userList = util.importExcel(file.getInputStream()); -// String operName = getUsername(); -// String message = userService.importUser(userList, updateSupport, operName); - ExcelUtil util = new ExcelUtil<>(Unit.class); - List list = util.importExcel(file.getInputStream()); - unitService.saveBatch(list); - for (Unit x : list) { - SysUser user = new SysUser(); - user.setUserName(x.getUserName()); - user.setPassword(SecurityUtils.encryptPassword(x.getUserName().substring(x.getUserName().length() - 6))); - user.setNickName(x.getNickName()); - SysUser u = userService.selectUserByUserName(x.getUserName()); - if (StringUtils.isNull(u)) { - userService.insertUser(user); - Long[] roles = new Long[]{100L}; - userService.insertUserAuth(user.getUserId(), roles); - } - //未做修改 - } - return success(); + ExcelUtil util = new ExcelUtil(SysUser.class); + List userList = util.importExcel(file.getInputStream()); + String operName = getUsername(); + String message = userService.importUser(userList, updateSupport, operName); + return success(message); } @PostMapping("/importTemplate") public void importTemplate(HttpServletResponse response) { - ExcelUtil util = new ExcelUtil<>(Unit.class); + ExcelUtil util = new ExcelUtil(SysUser.class); util.importTemplateExcel(response, "用户数据"); } /** * 根据用户编号获取详细信息 */ - @ApiOperation(value = "根据用户编号获取详细信息") @PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping(value = {"/", "/{userId}"}) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { @@ -123,19 +96,16 @@ public class SysUserController extends BaseController { ajax.put(AjaxResult.DATA_TAG, sysUser); ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); - ajax.put("unit", unitService.lambdaQuery().eq(Unit::getUserName,sysUser.getUserName()).one()); } List roles = roleService.selectRoleAll(); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("posts", postService.selectPostAll()); - ajax.put("posts", postService.selectPostAll()); return ajax; } /** * 新增用户 */ - @ApiOperation(value = "新增用户") @PreAuthorize("@ss.hasPermi('system:user:add')") @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping @@ -145,20 +115,12 @@ public class SysUserController extends BaseController { if (!userService.checkUserNameUnique(user)) { return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); } - if (!unitService.lambdaQuery().eq(Unit::getUserName, user.getUserName()).list().isEmpty()) { - return error("新增用户'" + user.getUserName() + "'已存在单位!"); - } - //新增单位到单位信息表 - unitService.save(user.getUnitInfo()); -// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) -// { +// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { // return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); -// } -// else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) -// { +// } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { // return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); // } -// user.setCreateBy(getUsername()); + user.setCreateBy(getUsername()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); return toAjax(userService.insertUser(user)); } @@ -166,7 +128,6 @@ public class SysUserController extends BaseController { /** * 修改用户 */ - @ApiOperation(value = "修改用户") @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping @@ -178,26 +139,18 @@ public class SysUserController extends BaseController { if (!userService.checkUserNameUnique(user)) { return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); } - if (!unitService.lambdaQuery().eq(Unit::getUserName, user.getUserName()).list().isEmpty()) { - return error("修改用户'" + user.getUserName() + "'已存在单位!"); - } - unitService.updateById(user.getUnitInfo()); -// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) -// { +// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { // return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); -// } -// else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) -// { +// } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { // return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); // } -// user.setUpdateBy(getUsername()); + user.setUpdateBy(getUsername()); return toAjax(userService.updateUser(user)); } /** * 删除用户 */ - @ApiOperation(value = "删除用户") @PreAuthorize("@ss.hasPermi('system:user:remove')") @Log(title = "用户管理", businessType = BusinessType.DELETE) @DeleteMapping("/{userIds}") @@ -211,7 +164,6 @@ public class SysUserController extends BaseController { /** * 重置密码 */ - @ApiOperation(value = "重置密码") @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping("/resetPwd") @@ -219,28 +171,26 @@ public class SysUserController extends BaseController { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); -// user.setUpdateBy(getUsername()); + user.setUpdateBy(getUsername()); return toAjax(userService.resetPwd(user)); } /** * 状态修改 */ - @ApiOperation(value = "状态修改") @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") public AjaxResult changeStatus(@RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); -// user.setUpdateBy(getUsername()); + user.setUpdateBy(getUsername()); return toAjax(userService.updateUserStatus(user)); } /** * 根据用户编号获取授权角色 */ - @ApiOperation(value = "根据用户编号获取授权角色") @PreAuthorize("@ss.hasPermi('system:user:query')") @GetMapping("/authRole/{userId}") public AjaxResult authRole(@PathVariable("userId") Long userId) { @@ -255,7 +205,6 @@ public class SysUserController extends BaseController { /** * 用户授权角色 */ - @ApiOperation(value = "用户授权角色") @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.GRANT) @PutMapping("/authRole") @@ -269,7 +218,6 @@ public class SysUserController extends BaseController { /** * 获取部门树列表 */ - @ApiOperation(value = "获取部门树列表") @PreAuthorize("@ss.hasPermi('system:user:list')") @GetMapping("/deptTree") public AjaxResult deptTree(SysDept dept) { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UnitMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UnitMapper.java index 3e849c9..c827ecc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UnitMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UnitMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.entity.Unit; import com.ruoyi.common.core.domain.request.UnitRequest; import org.apache.ibatis.annotations.Param; @@ -21,9 +22,26 @@ public interface UnitMapper extends BaseMapper { * @return 用户信息集合信息 */ List selectUnitList(@Param("req") UnitRequest a); + /** + * 分页条件查询所有单位列表 + * + * @param unit 用户信息 + * @return 用户信息集合信息 + */ + Page selectUnitList(Page page, @Param("req") UnitRequest unit); + + /** + * 根据id列表查询单位 + */ + List selectByIds(Long[] ids); + + /** + * 逻辑删除单位 + */ + void deleteUnits(Long[] ids); /** - * 根据信用代码批量逻辑删除 + * 逻辑删除用户 */ - void deleteInCode(List code); + void deleteUsers(List userNames); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/UnitService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/UnitService.java index 556b15b..a5cda20 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/UnitService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/UnitService.java @@ -1,5 +1,6 @@ package com.ruoyi.system.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.entity.Unit; import com.ruoyi.common.core.domain.request.UnitRequest; @@ -13,6 +14,14 @@ import java.util.List; */ public interface UnitService extends IService { + /** + * 分页条件查询所有单位列表 + * + * @param unit 用户信息 + * @return 用户信息集合信息 + */ + Page page(Page page,UnitRequest unit); + /** * 根据条件查询所有单位列表 * @@ -21,8 +30,24 @@ public interface UnitService extends IService { */ List selectUnitList(UnitRequest unit); + + + /** + * 检查用户表是否存在该用户 + */ + void validUser(Unit unit); + + /** + * 根据id列表查询单位 + */ + List selectByIds(Long[] ids); + + /** + * 逻辑删除用户 + */ + void deleteUsers(List userNames); /** - * 根据信用代码批量逻辑删除 + * 逻辑删除单位 */ - void deleteInCode(List code); + void deleteUnits(Long[] ids); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 87fc09b..a0ce61d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -3,10 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import javax.annotation.Resource; import javax.validation.Validator; - -import com.ruoyi.system.service.UnitService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -68,8 +65,6 @@ public class SysUserServiceImpl implements ISysUserService @Autowired protected Validator validator; - @Resource - private UnitService unitService; /** * 根据条件分页查询用户列表 * @@ -476,12 +471,6 @@ public class SysUserServiceImpl implements ISysUserService userRoleMapper.deleteUserRole(userIds); // 删除用户与岗位关联 userPostMapper.deleteUserPost(userIds); - List sysUsers = userMapper.selectUserByIds(userIds); - List nl = new ArrayList<>(); - sysUsers.forEach(x->{ - nl.add(x.getUserName()); - }); - unitService.deleteInCode(nl); return userMapper.deleteUserByIds(userIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UnitServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UnitServiceImpl.java index f316d20..9a664ff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UnitServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UnitServiceImpl.java @@ -1,12 +1,19 @@ package com.ruoyi.system.service.impl; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.Unit; import com.ruoyi.common.core.domain.request.UnitRequest; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.mapper.UnitMapper; +import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.UnitService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.List; /** @@ -17,6 +24,18 @@ import java.util.List; @Service public class UnitServiceImpl extends ServiceImpl implements UnitService { + @Resource + private ISysUserService userService; + /** + * 分页条件查询所有单位列表 + * + * @param unit 用户信息 + * @return 用户信息集合信息 + */ + @Override + public Page page(Page page, UnitRequest unit) { + return baseMapper.selectUnitList(page,unit); + } /** * 根据条件查询所有单位列表 @@ -29,11 +48,47 @@ public class UnitServiceImpl extends ServiceImpl implements Un return baseMapper.selectUnitList(unit); } + /** - * 根据信用代码批量逻辑删除 + * 检查用户表是否存在该用户 */ @Override - public void deleteInCode(List code) { - baseMapper.deleteInCode(code); + public void validUser(Unit x) { + SysUser user = new SysUser(); + user.setUserName(x.getUserName()); + user.setPassword(SecurityUtils.encryptPassword(x.getUserName().substring(x.getUserName().length() - 6))); + user.setNickName(x.getNickName()); + SysUser u = userService.selectUserByUserName(x.getUserName()); + if (StringUtils.isNull(u)) { + userService.insertUser(user); + Long[] roles = new Long[]{100L}; + userService.insertUserAuth(user.getUserId(), roles); + }else { + throw new ServiceException(x.getUserName() + "'已存在单位!"); + } } + + /** + * 根据id列表查询单位 + */ + @Override + public List selectByIds(Long[] ids) { + return baseMapper.selectByIds(ids); + } + /** + * 逻辑删除用户 + */ + @Override + public void deleteUsers(List userNames) { + baseMapper.deleteUsers(userNames); + } + + /** + * 逻辑删除单位 + */ + @Override + public void deleteUnits(Long[] ids) { + baseMapper.deleteUnits(ids); + } + } diff --git a/ruoyi-system/src/main/resources/mapper/system/UnitMapper.xml b/ruoyi-system/src/main/resources/mapper/system/UnitMapper.xml index 4b25037..f2a6734 100644 --- a/ruoyi-system/src/main/resources/mapper/system/UnitMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/UnitMapper.xml @@ -47,17 +47,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - - update unit_info set del_flag = '2' where user_name in - - #{code} + + update unit_info set del_flag = '2' where id in + + #{ids} - + + + update sys_user set del_flag = '2' where user_name in + + #{userNames} + + + + \ No newline at end of file