增加工单部门和人员的管理功能
This commit is contained in:
parent
1aadfa02ef
commit
b5d7c801ad
@ -0,0 +1,113 @@
|
||||
package com.xhpc.activity.controller;
|
||||
|
||||
|
||||
import com.xhpc.activity.domain.XhpcWorkDeptDomain;
|
||||
import com.xhpc.activity.service.WorkDeptService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.util.LogUserUtils;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/work/dept")
|
||||
public class WorkDeptController extends BaseController {
|
||||
|
||||
@Resource
|
||||
WorkDeptService workDeptService;
|
||||
|
||||
@Resource
|
||||
LogUserUtils logUserUtils;
|
||||
|
||||
|
||||
@GetMapping("/getPage")
|
||||
public TableDataInfo getPage(HttpServletRequest request,
|
||||
String status) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
params.put("status", status);
|
||||
return getDataTable(workDeptService.getPage(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getList")
|
||||
public R getList(HttpServletRequest request) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
return R.ok(workDeptService.getList(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getTree")
|
||||
public R getTree(HttpServletRequest request) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
return R.ok(workDeptService.getTree(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/detail")
|
||||
public R getDetail(@RequestParam("deptId") Long deptId) {
|
||||
|
||||
return R.ok(workDeptService.getDomainByPk(deptId));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-新增运维部门", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/")
|
||||
public R insertDomain(HttpServletRequest request, @RequestBody XhpcWorkDeptDomain domain) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setCreateBy(loginUser.getUserid().toString());
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
domain.setTenantId(loginUser.getTenantId());
|
||||
return R.ok(workDeptService.insertDomain(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-更新运维部门", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/detail")
|
||||
public R updateDomain(HttpServletRequest request, @RequestBody XhpcWorkDeptDomain domain) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
return R.ok(workDeptService.updateDomain(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-更新运维部门状态", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/status")
|
||||
public R updateDomainStatus(HttpServletRequest request, @RequestBody XhpcWorkDeptDomain domain) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
return R.ok(workDeptService.updateDomainStatus(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-删除运维部门", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public R deleteDomainByPk(@PathVariable("deptId") Long deptId) {
|
||||
|
||||
return R.ok(workDeptService.deleteDomain(deptId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
package com.xhpc.activity.controller;
|
||||
|
||||
|
||||
import com.xhpc.activity.domain.XhpcWorkUserDomain;
|
||||
import com.xhpc.activity.service.WorkUserService;
|
||||
import com.xhpc.activity.vo.SysUserResetPasswordVo;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.util.LogUserUtils;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/work/user")
|
||||
public class WorkUserController extends BaseController {
|
||||
|
||||
@Resource
|
||||
WorkUserService workUserService;
|
||||
|
||||
@Resource
|
||||
LogUserUtils logUserUtils;
|
||||
|
||||
@GetMapping("/getPage")
|
||||
public TableDataInfo getPage(HttpServletRequest request,
|
||||
String status) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
params.put("status", status);
|
||||
return getDataTable(workUserService.getPage(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getList")
|
||||
public R getList(HttpServletRequest request) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
return R.ok(workUserService.getList(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getTree")
|
||||
public R getTree(HttpServletRequest request) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
return R.ok(workUserService.getTree(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/detail")
|
||||
public R getDetail(@RequestParam("userId") Long userId) {
|
||||
|
||||
return R.ok(workUserService.findByPk(userId));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-新增运维人员", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/")
|
||||
public R insertDomain(HttpServletRequest request, @RequestBody XhpcWorkUserDomain domain) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
|
||||
domain.setTenantId(loginUser.getTenantId());
|
||||
domain.setCreateBy(loginUser.getUserid().toString());
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
return R.ok(workUserService.insertDomain(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-更新运维人员", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/detail")
|
||||
public R updateDomain(HttpServletRequest request, @RequestBody XhpcWorkUserDomain domain) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
return R.ok(workUserService.updateDomain(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-更新运维人员密码", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public R resetDomainPwd(HttpServletRequest request, @RequestBody SysUserResetPasswordVo vo) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
vo.setTenantId(loginUser.getTenantId());
|
||||
return R.ok(workUserService.resetPassword(vo));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-更新运维人员状态", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/status")
|
||||
public R updateDomainStatus(HttpServletRequest request, @RequestBody XhpcWorkUserDomain domain) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
return R.ok(workUserService.updateDomainStatus(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "工单管理-删除运维人员", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userId}")
|
||||
public R deleteDomainByPk(@PathVariable("userId") Long userId) {
|
||||
|
||||
return R.ok(workUserService.deleteDomain(userId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.xhpc.activity.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysUserRoleDomain {
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
}
|
||||
@ -81,5 +81,24 @@ public class XhpcWorkUserDomain implements Serializable {
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
// =========== 页面数据呈现
|
||||
private String deptName;
|
||||
private String tenantId;
|
||||
|
||||
|
||||
// ================ 登陆系统使用
|
||||
/**
|
||||
* 帐号
|
||||
*/
|
||||
private String loginName;
|
||||
/**
|
||||
* 登陆密码
|
||||
*/
|
||||
private String loginPassword;
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
private Long[] roleIds;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package com.xhpc.activity.mapper;
|
||||
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByUserName(@Param("userName")String userName, @Param("tenantId")String tenantId);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
public int updateUserStatus(SysUser user);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @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 int checkUserNameUnique(@Param("userName") String userName,@Param("tenantId")String tenantId);
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param phonenumber 手机号码
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkPhoneUnique(@Param("phonenumber")String phonenumber,@Param("tenantId")String tenantId);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param email 用户邮箱
|
||||
* @return 结果
|
||||
*/
|
||||
public SysUser checkEmailUnique(String email);
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.xhpc.activity.mapper;
|
||||
|
||||
import com.xhpc.activity.domain.SysUserRoleDomain;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysUserRoleMapper {
|
||||
/**
|
||||
* 通过用户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<SysUserRoleDomain> userRoleList);
|
||||
|
||||
/**
|
||||
* 删除用户和角色关联信息
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleInfo(SysUserRoleDomain userRole);
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
|
||||
}
|
||||
@ -12,15 +12,15 @@ public interface XhpcWorkDeptMapper {
|
||||
|
||||
List<Map<String, Object>> selectMapListByParams(@Param("params") Map params);
|
||||
|
||||
int deleteByPrimaryKey(Long workDeptId);
|
||||
int deleteLogicByPrimaryKey(Long workDeptId);
|
||||
|
||||
int insert(XhpcWorkDeptDomain record);
|
||||
|
||||
int insertSelective(XhpcWorkDeptDomain record);
|
||||
XhpcWorkDeptDomain selectDomainByNameAndTenant(@Param("deptName")String deptName, @Param("parentDeptId")Long parentDeptId, @Param("tenantId")String tenantId);
|
||||
|
||||
XhpcWorkDeptDomain selectByPrimaryKey(Long workDeptId);
|
||||
|
||||
int updateByPrimaryKeySelective(XhpcWorkDeptDomain record);
|
||||
|
||||
int updateByPrimaryKey(XhpcWorkDeptDomain record);
|
||||
|
||||
int updateStatusByPrimaryKey(XhpcWorkDeptDomain record);
|
||||
}
|
||||
@ -15,15 +15,19 @@ public interface XhpcWorkUserMapper {
|
||||
|
||||
List<XhpcWorkUserDomain> selectByOrderId(Long orderId);
|
||||
|
||||
int deleteByPrimaryKey(Long workUserId);
|
||||
int deleteLogicByPrimaryKey(Long workUserId);
|
||||
|
||||
int insert(XhpcWorkUserDomain record);
|
||||
|
||||
int insertSelective(XhpcWorkUserDomain record);
|
||||
|
||||
XhpcWorkUserDomain selectByPrimaryKey(Long workUserId);
|
||||
|
||||
int updateByPrimaryKeySelective(XhpcWorkUserDomain record);
|
||||
|
||||
int updateByPrimaryKey(XhpcWorkUserDomain record);
|
||||
|
||||
int updateDomainStatusByPrimaryKey(XhpcWorkUserDomain record);
|
||||
|
||||
List<XhpcWorkUserDomain> selectPage(@Param("params") Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> selectMapList(@Param("params") Map<String, Object> params);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xhpc.activity.service;
|
||||
|
||||
import com.xhpc.activity.domain.XhpcWorkDeptDomain;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface WorkDeptService {
|
||||
|
||||
List<XhpcWorkDeptDomain> getPage(Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> getList(Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> getTree(Map<String, Object> params);
|
||||
|
||||
XhpcWorkDeptDomain getDomainByPk(Long typeId);
|
||||
|
||||
Boolean insertDomain(XhpcWorkDeptDomain domain);
|
||||
|
||||
Boolean updateDomain(XhpcWorkDeptDomain domain);
|
||||
|
||||
Boolean deleteDomain(Long typeId);
|
||||
|
||||
Object updateDomainStatus(XhpcWorkDeptDomain domain);
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
package com.xhpc.activity.service;
|
||||
|
||||
import com.xhpc.activity.domain.XhpcWorkDeptDomain;
|
||||
import com.xhpc.activity.domain.XhpcWorkUserDomain;
|
||||
import com.xhpc.activity.vo.SysUserResetPasswordVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -16,4 +18,20 @@ public interface WorkUserService {
|
||||
XhpcWorkUserDomain findByPk(Long pk);
|
||||
|
||||
List<XhpcWorkUserDomain> findByOrderId(Long orderId);
|
||||
|
||||
List<XhpcWorkUserDomain> getPage(Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> getList(Map<String, Object> params);
|
||||
|
||||
List<Map<String, Object>> getTree(Map<String, Object> params);
|
||||
|
||||
Boolean insertDomain(XhpcWorkUserDomain domain);
|
||||
|
||||
Boolean updateDomain(XhpcWorkUserDomain domain);
|
||||
|
||||
Boolean deleteDomain(Long userId);
|
||||
|
||||
Boolean resetPassword(SysUserResetPasswordVo vo);
|
||||
|
||||
Object updateDomainStatus(XhpcWorkUserDomain domain);
|
||||
}
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.xhpc.activity.service.impl;
|
||||
|
||||
import com.xhpc.activity.domain.XhpcWorkDeptDomain;
|
||||
import com.xhpc.activity.mapper.XhpcWorkDeptMapper;
|
||||
import com.xhpc.activity.service.WorkDeptService;
|
||||
import com.xhpc.common.core.exception.CustomException;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class WorkDeptServiceImpl implements WorkDeptService {
|
||||
|
||||
@Resource
|
||||
XhpcWorkDeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
public List<XhpcWorkDeptDomain> getPage(Map<String, Object> params){
|
||||
return deptMapper.selectListByParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getList(Map<String, Object> params){
|
||||
List<Map<String, Object>> deptList = deptMapper.selectMapListByParams(params);
|
||||
for (Map<String, Object> dept: deptList){
|
||||
params.put("parentDeptId", dept.get("id"));
|
||||
List<Map<String,Object>> childDeptList = deptMapper.selectMapListByParams(params);
|
||||
dept.put("children", childDeptList);
|
||||
}
|
||||
return deptList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getTree(Map<String, Object> params){
|
||||
List<Map<String, Object>> deptList = deptMapper.selectMapListByParams(params);
|
||||
for (Map<String, Object> dept: deptList){
|
||||
params.put("parentDeptId", dept.get("id"));
|
||||
List<Map<String,Object>> childDeptList = deptMapper.selectMapListByParams(params);
|
||||
dept.put("children", childDeptList);
|
||||
}
|
||||
return deptList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XhpcWorkDeptDomain getDomainByPk(Long deptId){
|
||||
return deptMapper.selectByPrimaryKey(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertDomain(XhpcWorkDeptDomain domain){
|
||||
|
||||
XhpcWorkDeptDomain deptDomain = deptMapper.selectDomainByNameAndTenant(domain.getDeptName(), domain.getParentDeptId(), domain.getTenantId());
|
||||
if(StringUtils.isNotNull(deptDomain)){
|
||||
throw new CustomException("部门已存在");
|
||||
}
|
||||
|
||||
return deptMapper.insert(domain) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateDomain(XhpcWorkDeptDomain domain){
|
||||
return deptMapper.updateByPrimaryKey(domain) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateDomainStatus(XhpcWorkDeptDomain domain){
|
||||
return deptMapper.updateStatusByPrimaryKey(domain) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteDomain(Long deptId){
|
||||
return deptMapper.deleteLogicByPrimaryKey(deptId) > 0;
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,25 @@
|
||||
package com.xhpc.activity.service.impl;
|
||||
|
||||
import com.xhpc.activity.domain.SysUserRoleDomain;
|
||||
import com.xhpc.activity.domain.XhpcWorkUserDomain;
|
||||
import com.xhpc.activity.mapper.SysUserMapper;
|
||||
import com.xhpc.activity.mapper.SysUserRoleMapper;
|
||||
import com.xhpc.activity.mapper.XhpcWorkDeptMapper;
|
||||
import com.xhpc.activity.mapper.XhpcWorkUserMapper;
|
||||
import com.xhpc.activity.service.WorkUserService;
|
||||
import com.xhpc.activity.vo.SysUserResetPasswordVo;
|
||||
import com.xhpc.common.core.constant.UserConstants;
|
||||
import com.xhpc.common.core.exception.CustomException;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -22,6 +34,11 @@ public class WorkUserServiceImpl implements WorkUserService {
|
||||
@Resource
|
||||
XhpcWorkDeptMapper deptMapper;
|
||||
|
||||
@Resource
|
||||
SysUserMapper userMapper;
|
||||
@Resource
|
||||
SysUserRoleMapper roleMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean insertUser(String userName, String phone){
|
||||
@ -61,4 +78,163 @@ public class WorkUserServiceImpl implements WorkUserService {
|
||||
public List<XhpcWorkUserDomain> findByOrderId(Long orderId){
|
||||
return workUserMapper.selectByOrderId(orderId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<XhpcWorkUserDomain> getPage(Map<String, Object> params){
|
||||
return workUserMapper.selectPage(params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getList(Map<String, Object> params){
|
||||
return workUserMapper.selectMapList(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getTree(Map<String, Object> params){
|
||||
return workUserMapper.selectMapList(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertDomain(XhpcWorkUserDomain domain){
|
||||
|
||||
// todo 需要再sys_user中增加相关信息
|
||||
if(domain.getRoleIds().length==0){
|
||||
throw new CustomException("请选择角色");
|
||||
}
|
||||
int count = userMapper.checkUserNameUnique(domain.getLoginName(), domain.getTenantId());
|
||||
if(count > 0){
|
||||
throw new CustomException("新增用户'" + domain.getLoginName() + "'失败,登录账号已存在");
|
||||
}
|
||||
|
||||
SysUser sysUser = userMapper.checkPhoneUnique(domain.getPhone(), domain.getTenantId());
|
||||
if(StringUtils.isNotNull(sysUser)){
|
||||
throw new CustomException("新增用户'" + domain.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
workUserMapper.insert(domain);
|
||||
|
||||
SysUser user = new SysUser();
|
||||
getUserConvert(user, domain);
|
||||
userMapper.insertUser(user);
|
||||
|
||||
Long[] roles = domain.getRoleIds();
|
||||
if (StringUtils.isNotNull(roles))
|
||||
{
|
||||
// 新增用户与角色管理
|
||||
List<SysUserRoleDomain> list = new ArrayList<SysUserRoleDomain>();
|
||||
for (Long roleId : roles)
|
||||
{
|
||||
SysUserRoleDomain ur = new SysUserRoleDomain();
|
||||
ur.setUserId(user.getUserId());
|
||||
ur.setRoleId(roleId);
|
||||
list.add(ur);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
roleMapper.batchUserRole(list);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateDomain(XhpcWorkUserDomain domain){
|
||||
|
||||
SysUser user = userMapper.selectUserByUserName(domain.getLoginName(), domain.getTenantId());
|
||||
SysUser sysUser = userMapper.checkPhoneUnique(domain.getPhone(), domain.getTenantId());
|
||||
if(StringUtils.isNotNull(sysUser)){
|
||||
throw new CustomException("更新用户'" + domain.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
|
||||
user.setPhonenumber(domain.getPhone());
|
||||
user.setEmail(domain.getEmail());
|
||||
|
||||
workUserMapper.updateByPrimaryKey(domain);
|
||||
userMapper.updateUser(user);
|
||||
// 删除用户与角色关联
|
||||
roleMapper.deleteUserRoleByUserId(user.getUserId());
|
||||
|
||||
Long[] roles = domain.getRoleIds();
|
||||
if (StringUtils.isNotNull(roles))
|
||||
{
|
||||
// 新增用户与角色管理
|
||||
List<SysUserRoleDomain> list = new ArrayList<SysUserRoleDomain>();
|
||||
for (Long roleId : roles)
|
||||
{
|
||||
SysUserRoleDomain ur = new SysUserRoleDomain();
|
||||
ur.setUserId(user.getUserId());
|
||||
ur.setRoleId(roleId);
|
||||
list.add(ur);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
roleMapper.batchUserRole(list);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean updateDomainStatus(XhpcWorkUserDomain domain){
|
||||
SysUser user = userMapper.selectUserByUserName(domain.getLoginName(), domain.getTenantId());
|
||||
switch (domain.getStatus()){
|
||||
case 0:
|
||||
user.setStatus("1"); break;
|
||||
case 1:
|
||||
user.setStatus("0"); break;
|
||||
default:break;
|
||||
}
|
||||
userMapper.updateUserStatus(user);
|
||||
return workUserMapper.updateDomainStatusByPrimaryKey(domain) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean resetPassword(SysUserResetPasswordVo vo){
|
||||
SysUser user = userMapper.selectUserByUserName(vo.getLoginName(), vo.getTenantId());
|
||||
if(StringUtils.isNull(user)){
|
||||
throw new CustomException("用户不存在");
|
||||
}
|
||||
|
||||
userMapper.resetUserPwd(vo.getLoginName(), SecurityUtils.encryptPassword(vo.getPassword()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean deleteDomain(Long userId){
|
||||
XhpcWorkUserDomain workUserDomain = workUserMapper.selectByPrimaryKey(userId);
|
||||
if(StringUtils.isNull(workUserDomain)){
|
||||
throw new CustomException("用户不存在");
|
||||
}
|
||||
SysUser user = userMapper.selectUserByUserName(workUserDomain.getLoginName(), workUserDomain.getTenantId());
|
||||
if(StringUtils.isNotNull(user)){
|
||||
userMapper.deleteUserById(user.getUserId());
|
||||
}
|
||||
|
||||
return workUserMapper.deleteLogicByPrimaryKey(userId) > 0;
|
||||
}
|
||||
|
||||
|
||||
private void getUserConvert(SysUser user, XhpcWorkUserDomain domain){
|
||||
user.setUserName(domain.getLoginName());
|
||||
user.setNickName(domain.getUserName());
|
||||
user.setUserType("00");
|
||||
user.setEmail(domain.getEmail());
|
||||
user.setPhonenumber(domain.getPhone());
|
||||
user.setDataPowerType(0);
|
||||
user.setStatus(domain.getStatus().toString());
|
||||
|
||||
user.setAvatar("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png");
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(domain.getLoginPassword()));
|
||||
user.setTenantId(domain.getTenantId());
|
||||
user.setCreateBy(domain.getCreateBy());
|
||||
user.setCreateTime(new Date());
|
||||
user.setUpdateBy(domain.getUpdateBy());
|
||||
user.setUpdateTime(new Date());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.xhpc.activity.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysUserResetPasswordVo {
|
||||
private String loginName;
|
||||
private String password;
|
||||
private String tenantId;
|
||||
}
|
||||
@ -0,0 +1,221 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.activity.mapper.SysUserMapper">
|
||||
|
||||
<resultMap id="SysUserResult" type="com.xhpc.system.api.domain.SysUser">
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="dept_id" property="deptId"/>
|
||||
<result column="user_name" property="userName"/>
|
||||
<result column="user_type" property="userType"/>
|
||||
<result column="nick_name" property="nickName"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="phonenumber" property="phonenumber"/>
|
||||
<result column="operator_id" property="operatorId"/>
|
||||
<result column="internet_user_id" property="internetUserId"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="avatar" property="avatar"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="data_power_type" property="dataPowerType"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="login_ip" property="loginIp"/>
|
||||
<result column="login_date" property="loginDate"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="tenant_name" property="tenantName"/>
|
||||
<result column="operator_id" property="operatorId"/>
|
||||
<association column="dept_id" property="dept" javaType="com.xhpc.system.api.domain.SysDept" resultMap="deptResult"/>
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="com.xhpc.system.api.domain.SysDept">
|
||||
<id property="deptId" column="dept_id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="deptName" column="dept_name"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="leader" column="leader"/>
|
||||
<result property="status" column="dept_status"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="RoleResult" type="com.xhpc.system.api.domain.SysRole">
|
||||
<id property="roleId" column="role_id"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="roleKey" column="role_key"/>
|
||||
<result property="roleSort" column="role_sort"/>
|
||||
<result property="dataScope" column="data_scope"/>
|
||||
<result property="status" column="role_status"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id,
|
||||
u.dept_id,
|
||||
u.user_name,
|
||||
u.nick_name,
|
||||
u.email,
|
||||
u.avatar,
|
||||
u.phonenumber,
|
||||
u.password,
|
||||
u.sex,
|
||||
u.status,
|
||||
u.del_flag,
|
||||
u.login_ip,
|
||||
u.login_date,
|
||||
u.create_by,
|
||||
u.create_time,
|
||||
u.remark,
|
||||
d.dept_id,
|
||||
d.parent_id,
|
||||
d.dept_name,
|
||||
d.order_num,
|
||||
d.leader,
|
||||
d.status as dept_status,
|
||||
u.data_power_type,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.status as role_status,
|
||||
u.user_type,
|
||||
u.tenant_id,
|
||||
u.operator_id,
|
||||
xop.corp_no corpNo
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
left join xhpc_operator xop on xop.operator_id = u.operator_id and u.user_type!='00' and u.user_type!='02' and xop.tenant_id=#{tenantId} and xop.del_flag =0
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<select id="selectUserByUserName" parameterType="java.lang.String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.tenant_id =#{tenantId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="checkUserNameUnique" parameterType="java.lang.String" resultType="int">
|
||||
select count(1) from sys_user
|
||||
where user_name = #{userName}
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and tenant_id=#{tenantId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="java.lang.String" resultMap="SysUserResult">
|
||||
select user_id, phonenumber from sys_user
|
||||
where phonenumber = #{phonenumber}
|
||||
<if test="tenantId !=null and tenantId !=''">
|
||||
and tenant_id=#{tenantId}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="java.lang.String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="com.xhpc.system.api.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="operatorId != null and operatorId != ''">operator_id,</if>
|
||||
<if test="internetUserId != null and internetUserId != ''">internet_user_id,</if>
|
||||
<if test="dataPowerType != null and dataPowerType != ''">data_power_type,</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="tenantId != null and tenantId != ''">tenant_id,</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="operatorId != null and operatorId != ''">#{operatorId},</if>
|
||||
<if test="internetUserId != null and internetUserId != ''">#{internetUserId},</if>
|
||||
<if test="dataPowerType != null and dataPowerType != ''">#{dataPowerType},</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="tenantId != null and tenantId != ''">#{tenantId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="com.xhpc.system.api.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="operatorId != null and operatorId != ''">operator_id = #{operatorId},</if>
|
||||
<if test="internetUserId != null and internetUserId != ''">internet_user_id = #{internetUserId},</if>
|
||||
<if test="dataPowerType != null and dataPowerType != ''">data_power_type = #{dataPowerType},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="tenantId != null and ''!=tenantId">tenant_id = #{tenantId},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserStatus" parameterType="com.xhpc.system.api.domain.SysUser">
|
||||
update sys_user set status = #{status} where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserAvatar" parameterType="com.xhpc.system.api.domain.SysUser">
|
||||
update sys_user set avatar = #{avatar} where user_name = #{userName}
|
||||
</update>
|
||||
|
||||
<update id="resetUserPwd" parameterType="com.xhpc.system.api.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>
|
||||
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.activity.mapper.SysUserRoleMapper">
|
||||
|
||||
<resultMap type="com.xhpc.activity.domain.SysUserRoleDomain" id="SysUserRoleResult">
|
||||
<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.xhpc.activity.domain.SysUserRoleDomain">
|
||||
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>
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
|
||||
<select id="selectAmountByStatus" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(apply_amount), 0) from xhpc_clearing_checkout where del_flag =0 and operator_id=#{operatorId} and status=#{status}
|
||||
select ifnull(sum(received_amount), 0) from xhpc_clearing_checkout where del_flag =0 and operator_id=#{operatorId} and status=#{status}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
create_time, create_by, update_time, update_by
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectListByParams" resultType="com.xhpc.activity.domain.XhpcWorkDeptDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
@ -30,6 +31,7 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectMapListByParams" resultType="map">
|
||||
select
|
||||
work_dept_id as 'id',
|
||||
@ -39,18 +41,42 @@
|
||||
<if test="params.tenantId !=null and params.tenantId!=''">
|
||||
and tenant_id=#{params.tenantId}
|
||||
</if>
|
||||
<if test="params.parentDeptId !=null and params.parentDeptId!=''">
|
||||
and parent_dept_id=#{params.parentDeptId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_dept
|
||||
where work_dept_id = #{workDeptId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
|
||||
|
||||
<select id="selectDomainByNameAndTenant" resultType="com.xhpc.activity.domain.XhpcWorkDeptDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_dept
|
||||
where del_flag = 0 and dept_name = #{deptName} and tenant_id=#{tenantId}
|
||||
<choose>
|
||||
<when test="parentDeptId != null">
|
||||
and parent_dept_id=#{parentDeptId}
|
||||
</when>
|
||||
<otherwise>
|
||||
and parent_dept_id is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Long">
|
||||
update xhpc_work_dept set del_flag=2
|
||||
where work_dept_id = #{workDeptId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insert" keyColumn="work_dept_id" keyProperty="workDeptId" parameterType="com.xhpc.activity.domain.XhpcWorkDeptDomain" useGeneratedKeys="true">
|
||||
insert into xhpc_work_dept (dept_name, code, sort,
|
||||
parent_dept_id, `status`, del_flag,
|
||||
@ -61,95 +87,8 @@
|
||||
#{tenantId,jdbcType=VARCHAR}, SYSDATE(), #{createBy,jdbcType=VARCHAR},
|
||||
SYSDATE(), #{updateBy,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="work_dept_id" keyProperty="workDeptId" parameterType="com.xhpc.activity.domain.XhpcWorkDeptDomain" useGeneratedKeys="true">
|
||||
insert into xhpc_work_dept
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deptName != null">
|
||||
dept_name,
|
||||
</if>
|
||||
<if test="code != null">
|
||||
code,
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort,
|
||||
</if>
|
||||
<if test="parentDeptId != null">
|
||||
parent_dept_id,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
del_flag,
|
||||
<if test="tenantId != null">
|
||||
tenant_id,
|
||||
</if>
|
||||
create_time,
|
||||
<if test="createBy != null">
|
||||
create_by,
|
||||
</if>
|
||||
update_time,
|
||||
<if test="updateBy != null">
|
||||
update_by,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deptName != null">
|
||||
#{deptName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="code != null">
|
||||
#{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
#{sort,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="parentDeptId != null">
|
||||
#{parentDeptId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=SMALLINT},
|
||||
</if>
|
||||
0,
|
||||
<if test="tenantId != null">
|
||||
#{tenantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
SYSDATE(),
|
||||
<if test="createBy != null">
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
SYSDATE(),
|
||||
<if test="updateBy != null">
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.activity.domain.XhpcWorkDeptDomain">
|
||||
update xhpc_work_dept
|
||||
<set>
|
||||
<if test="deptName != null">
|
||||
dept_name = #{deptName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="code != null">
|
||||
code = #{code,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="parentDeptId != null">
|
||||
parent_dept_id = #{parentDeptId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
update_time = SYSDATE(),
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where work_dept_id = #{workDeptId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcWorkDeptDomain">
|
||||
update xhpc_work_dept
|
||||
set dept_name = #{deptName,jdbcType=VARCHAR},
|
||||
@ -157,9 +96,18 @@
|
||||
sort = #{sort,jdbcType=SMALLINT},
|
||||
parent_dept_id = #{parentDeptId,jdbcType=BIGINT},
|
||||
`status` = #{status,jdbcType=SMALLINT},
|
||||
tenant_id = #{tenantId,jdbcType=VARCHAR},
|
||||
update_time = SYSDATE(),
|
||||
update_by = #{updateBy,jdbcType=VARCHAR}
|
||||
where work_dept_id = #{workDeptId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateStatusByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcWorkDeptDomain">
|
||||
update xhpc_work_dept
|
||||
set `status` = #{status,jdbcType=SMALLINT},
|
||||
update_time = SYSDATE(),
|
||||
update_by = #{updateBy,jdbcType=VARCHAR}
|
||||
where work_dept_id = #{workDeptId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@ -18,17 +18,19 @@
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
work_user_id, user_name, dept_id, post_name, phone, email, wechat_openid, is_leader,
|
||||
`status`, del_flag, create_time, create_by, update_time, update_by
|
||||
u.work_user_id, u.user_name, u.dept_id, u.post_name, u.phone, u.email, u.wechat_openid, u.is_leader,
|
||||
u.`status`, u.del_flag, u.create_time, u.create_by, u.update_time, u.update_by
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectByUserNameAndPhone" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_user
|
||||
where user_name = #{userName} and phone=#{phone}
|
||||
from xhpc_work_user u
|
||||
where u.user_name = #{userName} and u.phone=#{phone}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectMapListByDeptId" resultType="map">
|
||||
select
|
||||
work_user_id as 'id',
|
||||
@ -48,16 +50,21 @@
|
||||
WHERE ou.order_id=#{orderId} and u.del_flag=0 and u.status=1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_user
|
||||
where work_user_id = #{workUserId,jdbcType=BIGINT}
|
||||
from xhpc_work_user u
|
||||
where u.work_user_id = #{workUserId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<update id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
|
||||
|
||||
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Long">
|
||||
update xhpc_work_user set del_flag=2
|
||||
where work_user_id = #{workUserId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insert" keyColumn="work_user_id" keyProperty="workUserId" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain" useGeneratedKeys="true">
|
||||
insert into xhpc_work_user (user_name, dept_id, post_name,
|
||||
phone, email, wechat_openid,
|
||||
@ -70,113 +77,8 @@
|
||||
sysdate(), #{createBy,jdbcType=VARCHAR}, sysdate(),
|
||||
#{updateBy,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="work_user_id" keyProperty="workUserId" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain" useGeneratedKeys="true">
|
||||
insert into xhpc_work_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userName != null">
|
||||
user_name,
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
dept_id,
|
||||
</if>
|
||||
<if test="postName != null">
|
||||
post_name,
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone,
|
||||
</if>
|
||||
<if test="email != null">
|
||||
email,
|
||||
</if>
|
||||
<if test="wechatOpenid != null">
|
||||
wechat_openid,
|
||||
</if>
|
||||
<if test="isLeader != null">
|
||||
is_leader,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
del_flag,
|
||||
create_time,
|
||||
<if test="createBy != null">
|
||||
create_by,
|
||||
</if>
|
||||
update_time,
|
||||
<if test="updateBy != null">
|
||||
update_by,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userName != null">
|
||||
#{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
#{deptId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="postName != null">
|
||||
#{postName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
#{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="email != null">
|
||||
#{email,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="wechatOpenid != null">
|
||||
#{wechatOpenid,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isLeader != null">
|
||||
#{isLeader,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=SMALLINT},
|
||||
</if>
|
||||
0,
|
||||
sysdate(),
|
||||
<if test="createBy != null">
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
sysdate(),
|
||||
<if test="updateBy != null">
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
||||
update xhpc_work_user
|
||||
<set>
|
||||
<if test="userName != null">
|
||||
user_name = #{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
dept_id = #{deptId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="postName != null">
|
||||
post_name = #{postName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="email != null">
|
||||
email = #{email,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="wechatOpenid != null">
|
||||
wechat_openid = #{wechatOpenid,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isLeader != null">
|
||||
is_leader = #{isLeader,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=SMALLINT},
|
||||
</if>
|
||||
update_time =sysdate(),
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where work_user_id = #{workUserId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
||||
update xhpc_work_user
|
||||
set user_name = #{userName,jdbcType=VARCHAR},
|
||||
@ -191,4 +93,55 @@
|
||||
update_by = #{updateBy,jdbcType=VARCHAR}
|
||||
where work_user_id = #{workUserId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateDomainStatusByPrimaryKey">
|
||||
update xhpc_work_user
|
||||
set `status` = #{status,jdbcType=SMALLINT},
|
||||
update_time = sysdate(),
|
||||
update_by = #{updateBy,jdbcType=VARCHAR}
|
||||
where work_user_id = #{workUserId,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectPage" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />, d.dept_name
|
||||
from xhpc_work_user u
|
||||
left xhpc_work_dept d on u.dept_id=d.work_dept_id
|
||||
where u.del_flag=0 and d.del_flag=0 and u.status=1 and d.status=1
|
||||
<if test="params.deptId!=null">
|
||||
and (u.dept_id=#{params.deptId} or u.parent_dept_id=#{params.deptId})
|
||||
</if>
|
||||
<if test="params.userName!=null and params.userName!=''">
|
||||
and u.user_name like concat('%', #{params.userName}, '%')
|
||||
</if>
|
||||
<if test="params.phone!=null and params.phone!=''">
|
||||
and u.phone like concat('%', #{params.phone}, '%')
|
||||
</if>
|
||||
<if test="params.email!=null and params.email!=''">
|
||||
and u.email like concat('%', #{params.email}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectMapList" resultType="java.util.Map">
|
||||
select
|
||||
u.work_user_id as 'id', u.user_name as 'name'
|
||||
from xhpc_work_user u
|
||||
where u.del_flag=0 and u.status=1
|
||||
<if test="params.deptId!=null">
|
||||
and u.dept_id=#{params.deptId}
|
||||
</if>
|
||||
<if test="params.userName!=null and params.userName!=''">
|
||||
and u.user_name like concat('%', #{params.userName}, '%')
|
||||
</if>
|
||||
<if test="params.phone!=null and params.phone!=''">
|
||||
and u.phone like concat('%', #{params.phone}, '%')
|
||||
</if>
|
||||
<if test="params.email!=null and params.email!=''">
|
||||
and u.email like concat('%', #{params.email}, '%')
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user