注册系统用户时为系统用户绑定所属的代理组织
This commit is contained in:
parent
83a0563f66
commit
36da0dfb4b
@ -30,56 +30,30 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 检查系统用户名是否存在
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "SELECT COUNT(*) FROM sys_user WHERE user_name = :userName", nativeQuery = true)
|
||||
int checkUserName(@Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 查找用户实体根据用户名
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "SELECT * FROM sys_user WHERE user_name = :userName", nativeQuery = true)
|
||||
SysUserEntity selectByUserName(@Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户信息
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
SysUserEntity findByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 更新用户登录信息
|
||||
*
|
||||
* @param userName
|
||||
* @param ipAddress
|
||||
* @return
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " + "WHERE user_name = :userName ;", nativeQuery = true)
|
||||
int updateSysUserLogin(@Param("userName") String userName, @Param("ipAddress") String ipAddress);
|
||||
|
||||
/**
|
||||
* 软删除系统用户根据用户名
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "UPDATE sys_user SET delete_flag = 1 " + "WHERE user_name = :userName ;", nativeQuery = true)
|
||||
int softDeleteSysUserByUserName(@Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 软删除系统用户根据id
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "UPDATE sys_user SET delete_flag = 1 " + "WHERE id = :id ;", nativeQuery = true)
|
||||
@ -87,9 +61,6 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 删除系统用户(危险操作!)
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "DELETE FROM sys_user WHERE user_name = :userName ;", nativeQuery = true)
|
||||
@ -97,25 +68,18 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 查询用户信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark) " + "from SysUserEntity")
|
||||
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark,agentOrgId) from SysUserEntity")
|
||||
List<SysUserVo> selectAll();
|
||||
|
||||
/**
|
||||
* 根据用户名查询实体信息
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark) " + "from SysUserEntity where userName = :userName")
|
||||
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark,agentOrgId) from SysUserEntity where userName = :userName")
|
||||
SysUserVo selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 启用
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
@Query(value = "update sys_user set active_flag = 0 where id = ?", nativeQuery = true)
|
||||
@Modifying(clearAutomatically = true)
|
||||
@ -123,8 +87,6 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 禁用
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
@Query(value = "update sys_user set active_flag = 1 where id = ?", nativeQuery = true)
|
||||
@Modifying(clearAutomatically = true)
|
||||
@ -132,9 +94,6 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 用户修改密码
|
||||
*
|
||||
* @param userId
|
||||
* @param newPassword
|
||||
*/
|
||||
@Query(value = "update sys_user set password = ?2 where id = ?1", nativeQuery = true)
|
||||
@Modifying(clearAutomatically = true)
|
||||
@ -142,18 +101,12 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 根据id查询用户的信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Query(value = "select * from sys_user where id = ?", nativeQuery = true)
|
||||
SysUserEntity selectByUserId(Integer userId);
|
||||
|
||||
/**
|
||||
* 根据id修改账户的到期时间
|
||||
*
|
||||
* @param userId
|
||||
* @param overTime
|
||||
*/
|
||||
@Query(value = "update sys_user set over_time = ?2 where id = ?1", nativeQuery = true)
|
||||
@Modifying(clearAutomatically = true)
|
||||
@ -161,8 +114,6 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 将账户的期限修改为永久有效
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
@Query(value = "update sys_user set over_time = '永久' and day_num = 1 where id = ?", nativeQuery = true)
|
||||
@Modifying(clearAutomatically = true)
|
||||
@ -170,9 +121,6 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 记录用户登录次数
|
||||
*
|
||||
* @param userId
|
||||
* @param loginNum
|
||||
*/
|
||||
@Query(value = "update sys_user set login_num = ?2 where id = ?1", nativeQuery = true)
|
||||
@Modifying(clearAutomatically = true)
|
||||
@ -180,13 +128,9 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Integer> {
|
||||
|
||||
/**
|
||||
* 修改登陆时间
|
||||
*
|
||||
* @param userId
|
||||
* @param loginLastTime
|
||||
*/
|
||||
@Query(value = "update sys_user set login_last_time = ?2 where id = ?1", nativeQuery = true)
|
||||
@Modifying(clearAutomatically = true)
|
||||
void updateLoginLastTime(Integer userId, String loginLastTime);
|
||||
|
||||
|
||||
}
|
||||
|
@ -58,6 +58,11 @@ public class SysUserQo {
|
||||
|
||||
private String accountType;
|
||||
|
||||
/**
|
||||
* 代理组织ID
|
||||
*/
|
||||
private Long agentOrgId;
|
||||
|
||||
public SysUserQo() {
|
||||
}
|
||||
|
||||
@ -164,4 +169,12 @@ public class SysUserQo {
|
||||
public void setAccountType(String accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
|
||||
public Long getAgentOrgId() {
|
||||
return agentOrgId;
|
||||
}
|
||||
|
||||
public void setAgentOrgId(Long agentOrgId) {
|
||||
this.agentOrgId = agentOrgId;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,9 @@ public class SysUserVo implements Serializable {
|
||||
|
||||
private String remark;
|
||||
|
||||
public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, String overTime, Integer dayNum, String accountType, String countyName, String lastEntryIp, Integer loginNum, String loginLastTime, Integer vipLevel, Integer receiveSms, String remark) {
|
||||
private Long agentOrgId;
|
||||
|
||||
public SysUserVo(Integer id, String reallyName, String telephone, String countyCode, Integer activeFlag, String addTime, String overTime, Integer dayNum, String accountType, String countyName, String lastEntryIp, Integer loginNum, String loginLastTime, Integer vipLevel, Integer receiveSms, String remark, Long agentOrgId) {
|
||||
this.id = id;
|
||||
this.reallyName = reallyName;
|
||||
this.telephone = telephone;
|
||||
@ -58,6 +60,7 @@ public class SysUserVo implements Serializable {
|
||||
this.vipLevel = vipLevel;
|
||||
this.receiveSms = receiveSms;
|
||||
this.remark = remark;
|
||||
this.agentOrgId = agentOrgId;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
@ -187,4 +190,12 @@ public class SysUserVo implements Serializable {
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Long getAgentOrgId() {
|
||||
return agentOrgId;
|
||||
}
|
||||
|
||||
public void setAgentOrgId(Long agentOrgId) {
|
||||
this.agentOrgId = agentOrgId;
|
||||
}
|
||||
}
|
@ -159,6 +159,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
sysUserEntity.setVipLevel(0);
|
||||
sysUserEntity.setReceiveSms(0);
|
||||
sysUserEntity.setRemark("");//备注
|
||||
sysUserEntity.setAgentOrgId(sysUserQo.getAgentOrgId());
|
||||
sysUserDao.save(sysUserEntity);
|
||||
|
||||
RelUserRoleEntity relUserRoleEntity = new RelUserRoleEntity();
|
||||
|
Loading…
Reference in New Issue
Block a user