用户表id改为雪花
parent
2e7acda385
commit
fb5067dda8
|
|
@ -1,29 +1,41 @@
|
||||||
package com.agri.common.core.domain.entity;
|
package com.agri.common.core.domain.entity;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.agri.common.annotation.Excel;
|
import com.agri.common.annotation.Excel;
|
||||||
import com.agri.common.annotation.Excel.ColumnType;
|
import com.agri.common.annotation.Excel.ColumnType;
|
||||||
import com.agri.common.annotation.Excel.Type;
|
import com.agri.common.annotation.Excel.Type;
|
||||||
import com.agri.common.annotation.Excels;
|
import com.agri.common.annotation.Excels;
|
||||||
import com.agri.common.core.domain.BaseEntity;
|
import com.agri.common.core.domain.BaseEntity;
|
||||||
import com.agri.common.xss.Xss;
|
import com.agri.common.xss.Xss;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对象 sys_user
|
* 用户对象 sys_user
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@TableName("sys_user")
|
||||||
public class SysUser extends BaseEntity
|
public class SysUser extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 用户ID */
|
/** 用户ID */
|
||||||
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
/** 部门ID */
|
/** 部门ID */
|
||||||
|
|
@ -79,18 +91,23 @@ public class SysUser extends BaseEntity
|
||||||
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
|
||||||
})
|
})
|
||||||
|
@TableField(exist = false)
|
||||||
private SysDept dept;
|
private SysDept dept;
|
||||||
|
|
||||||
/** 角色对象 */
|
/** 角色对象 */
|
||||||
|
@TableField(exist = false)
|
||||||
private List<SysRole> roles;
|
private List<SysRole> roles;
|
||||||
|
|
||||||
/** 角色组 */
|
/** 角色组 */
|
||||||
|
@TableField(exist = false)
|
||||||
private Long[] roleIds;
|
private Long[] roleIds;
|
||||||
|
|
||||||
/** 岗位组 */
|
/** 岗位组 */
|
||||||
|
@TableField(exist = false)
|
||||||
private Long[] postIds;
|
private Long[] postIds;
|
||||||
|
|
||||||
/** 角色ID */
|
/** 角色ID */
|
||||||
|
@TableField(exist = false)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
public SysUser()
|
public SysUser()
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
package com.agri.system.mapper;
|
package com.agri.system.mapper;
|
||||||
|
|
||||||
|
import com.agri.common.core.domain.entity.SysUser;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import com.agri.common.core.domain.entity.SysUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户表 数据层
|
* 用户表 数据层
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface SysUserMapper
|
public interface SysUserMapper extends BaseMapper<SysUser>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
package com.agri.system.service;
|
package com.agri.system.service;
|
||||||
|
|
||||||
|
import com.agri.common.core.domain.entity.SysUser;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.agri.common.core.domain.entity.SysUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层
|
* 用户 业务层
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public interface ISysUserService
|
public interface ISysUserService extends IService<SysUser>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
package com.agri.system.service.impl;
|
package com.agri.system.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.validation.Validator;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
import com.agri.common.annotation.DataScope;
|
import com.agri.common.annotation.DataScope;
|
||||||
import com.agri.common.constant.UserConstants;
|
import com.agri.common.constant.UserConstants;
|
||||||
import com.agri.common.core.domain.entity.SysRole;
|
import com.agri.common.core.domain.entity.SysRole;
|
||||||
|
|
@ -31,6 +20,19 @@ import com.agri.system.mapper.SysUserRoleMapper;
|
||||||
import com.agri.system.service.ISysConfigService;
|
import com.agri.system.service.ISysConfigService;
|
||||||
import com.agri.system.service.ISysDeptService;
|
import com.agri.system.service.ISysDeptService;
|
||||||
import com.agri.system.service.ISysUserService;
|
import com.agri.system.service.ISysUserService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.validation.Validator;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层处理
|
* 用户 业务层处理
|
||||||
|
|
@ -38,7 +40,7 @@ import com.agri.system.service.ISysUserService;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysUserServiceImpl implements ISysUserService
|
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper,SysUser> implements ISysUserService
|
||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
||||||
|
|
||||||
|
|
@ -262,7 +264,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
public int insertUser(SysUser user)
|
public int insertUser(SysUser user)
|
||||||
{
|
{
|
||||||
// 新增用户信息
|
// 新增用户信息
|
||||||
int rows = userMapper.insertUser(user);
|
int rows = userMapper.insert(user);
|
||||||
// 新增用户岗位关联
|
// 新增用户岗位关联
|
||||||
insertUserPost(user);
|
insertUserPost(user);
|
||||||
// 新增用户与角色管理
|
// 新增用户与角色管理
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue