Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李丛阳
education
Commits
1ab8e481
Commit
1ab8e481
authored
May 15, 2018
by
李丛阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除用户
parent
25aa2e25
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
16 deletions
+70
-16
BCompanyServiceImpl.java
...t/business/bcompany/service/impl/BCompanyServiceImpl.java
+12
-10
TableUtil.java
src/main/java/org/rcisoft/common/util/TableUtil.java
+28
-0
SysRoleRepository.java
...main/java/org/rcisoft/sys/role/dao/SysRoleRepository.java
+15
-1
SysUserMapper.java
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
+15
-5
No files found.
src/main/java/org/rcisoft/business/bcompany/service/impl/BCompanyServiceImpl.java
View file @
1ab8e481
...
...
@@ -4,6 +4,7 @@ import org.rcisoft.business.bcompany.dao.BCompanyRepository;
import
org.rcisoft.business.bcompany.entity.BCompany
;
import
org.rcisoft.business.bcompany.service.BCompanyService
;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.common.util.TableUtil
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.entity.DataEntity
;
...
...
@@ -11,6 +12,7 @@ import org.rcisoft.core.exception.ServiceException;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.sys.role.dao.SysRoleRepository
;
import
org.rcisoft.sys.user.dao.SysUserMapper
;
import
org.rcisoft.sys.user.entity.SysUser
;
import
org.rcisoft.sys.user.entity.UserRole
;
...
...
@@ -39,6 +41,10 @@ public class BCompanyServiceImpl implements BCompanyService{
@Autowired
private
SysUserService
userService
;
@Autowired
private
SysRoleRepository
sysRoleRepository
;
@Override
public
PersistModel
persist
(
BCompany
model
,
SysUser
user
)
{
int
line
=
0
;
...
...
@@ -85,16 +91,12 @@ public class BCompanyServiceImpl implements BCompanyService{
@Override
public
PersistModel
removeBCompany
(
String
businessId
)
{
BCompany
company
=
bCompanyRepository
.
selectOne
(
new
BCompany
(
businessId
,
"0"
,
"1"
));
sysUserMapper
.
deleteByCode
(
company
.
getCode
());
BCompany
bCompany
=
new
BCompany
();
bCompany
.
setDeleted
();
bCompany
.
setBusinessId
(
businessId
);
UserUtil
.
setCurrentMergeOperation
(
bCompany
);
int
line
=
bCompanyRepository
.
logicalDelete
(
bCompany
);
/*删除关联角色*/
sysRoleRepository
.
deleteUserRoleByChildrenId
(
TableUtil
.
getTableByKey
(
"1"
),
businessId
);
/*删除sys_user*/
sysUserMapper
.
deleteByCompany
(
businessId
);
/*删除b_company*/
int
line
=
bCompanyRepository
.
deleteByPrimaryKey
(
businessId
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
...
...
src/main/java/org/rcisoft/common/util/TableUtil.java
0 → 100644
View file @
1ab8e481
package
org
.
rcisoft
.
common
.
util
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Created by lcy on 18/5/15.
*/
public
class
TableUtil
{
static
Map
<
String
,
String
>
TableMap
;
static
{
TableMap
=
new
HashMap
<>();
TableMap
.
put
(
"1"
,
"b_company"
);
TableMap
.
put
(
"2"
,
"b_teacher"
);
TableMap
.
put
(
"3"
,
"b_student"
);
}
/**
* 获取
* @param key
* @return
*/
public
static
String
getTableByKey
(
String
key
){
return
TableMap
.
get
(
key
);
}
}
src/main/java/org/rcisoft/sys/role/dao/SysRoleRepository.java
View file @
1ab8e481
...
...
@@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Select;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.sys.dept.entity.DeptRole
;
import
org.rcisoft.sys.role.entity.SysRole
;
import
org.rcisoft.sys.user.entity.SysUser
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
...
...
@@ -203,4 +202,19 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
"LEFT JOIN s_role ON s_role_menu.ROLE_ID = s_role.business_id "
+
"WHERE s_menu.MODEL_ID = #{modelId} AND ROLE_ID = #{roleId}"
)
int
queryRoleByRoleCode
(
@Param
(
"modelId"
)
String
modelId
,
@Param
(
"roleId"
)
String
roleId
);
/**
* 根据子表id 删除 s_r_user_role
* @param tableByKey
* @param businessId
* @return
*/
@Delete
(
"DELETE sr "
+
"FROM"
+
"s_r_user_role sr "
+
"LEFT JOIN s_user s on s.business_id = sr.user_id "
+
"LEFT JOIN ${tb} c ON c. CODE = s.login_name "
+
"WHERE"
+
"c.business_id = #{cid}"
)
int
deleteUserRoleByChildrenId
(
@Param
(
"tb"
)
String
tableByKey
,
@Param
(
"cid"
)
String
businessId
);
}
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
View file @
1ab8e481
...
...
@@ -8,14 +8,10 @@ import org.rcisoft.business.bteacher.entity.BTeacher;
import
org.rcisoft.core.base.BaseMapper
;
import
org.rcisoft.sys.user.entity.SysUser
;
import
org.rcisoft.sys.user.entity.UserRole
;
import
org.springframework.security.access.method.P
;
import
org.springframework.stereotype.Repository
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
javafx
.
scene
.
input
.
KeyCode
.
V
;
/**
* Created by lcy on 17/8/9.
*/
...
...
@@ -49,9 +45,23 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Select
(
"SELECT u.business_id from s_user u left join ${tab} s on u.login_name = s.code where s.business_id = #{id} and u.del_flag = 0 and u.flag = 1"
)
String
selectUserIdByStuOrTeaId
(
@Param
(
"id"
)
String
id
,
@Param
(
"tab"
)
String
table
);
@Update
(
"update s_user set del_flag = 1
, flag = 0
where login_name = #{code}"
)
@Update
(
"update s_user set del_flag = 1
where login_name = #{code}"
)
int
deleteByCode
(
String
code
);
/**
* 用户删除 cy 5-15
* @param code
* @return
*/
@Delete
(
"DELETE s "
+
"FROM "
+
" s_user s "
+
"LEFT JOIN b_company c ON c. CODE = s.login_name "
+
"WHERE "
+
" c.business_id = #{code}"
)
int
deleteByCompany
(
String
code
);
@Select
(
"<script>select * from s_user where business_id = #{userId} and password = #{password} limit 1</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
SysUser
checkPassword
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"password"
)
String
password
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment