From 36da0dfb4b5e037ef1da13408b0b7b20e849298d Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 6 Jul 2022 16:15:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E7=B3=BB=E7=BB=9F=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=97=B6=E4=B8=BA=E7=B3=BB=E7=BB=9F=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=89=80=E5=B1=9E=E7=9A=84=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xkrs/dao/SysUserDao.java | 60 +------------------ .../java/com/xkrs/model/qo/SysUserQo.java | 13 ++++ .../java/com/xkrs/model/vo/SysUserVo.java | 13 +++- .../xkrs/service/impl/SysUserServiceImpl.java | 1 + 4 files changed, 28 insertions(+), 59 deletions(-) diff --git a/src/main/java/com/xkrs/dao/SysUserDao.java b/src/main/java/com/xkrs/dao/SysUserDao.java index 1e938e8..97756ee 100644 --- a/src/main/java/com/xkrs/dao/SysUserDao.java +++ b/src/main/java/com/xkrs/dao/SysUserDao.java @@ -30,56 +30,30 @@ public interface SysUserDao extends JpaRepository { /** * 检查系统用户名是否存在 - * - * @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 { /** * 删除系统用户(危险操作!) - * - * @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 { /** * 查询用户信息 - * - * @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 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 { /** * 禁用 - * - * @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 { /** * 用户修改密码 - * - * @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 { /** * 根据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 { /** * 将账户的期限修改为永久有效 - * - * @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 { /** * 记录用户登录次数 - * - * @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 { /** * 修改登陆时间 - * - * @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); - } diff --git a/src/main/java/com/xkrs/model/qo/SysUserQo.java b/src/main/java/com/xkrs/model/qo/SysUserQo.java index 553be29..fa54f2b 100644 --- a/src/main/java/com/xkrs/model/qo/SysUserQo.java +++ b/src/main/java/com/xkrs/model/qo/SysUserQo.java @@ -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; + } } diff --git a/src/main/java/com/xkrs/model/vo/SysUserVo.java b/src/main/java/com/xkrs/model/vo/SysUserVo.java index 4ff3cd8..0f92bf5 100644 --- a/src/main/java/com/xkrs/model/vo/SysUserVo.java +++ b/src/main/java/com/xkrs/model/vo/SysUserVo.java @@ -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; + } } \ No newline at end of file diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index c4feca4..ff5b35d 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -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();