Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
Project
Project
Details
Activity
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
竹天卫
tianjin-cement
Commits
6edb4c6c
Commit
6edb4c6c
authored
Nov 04, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员信息不允许删除
parent
84ed6ad9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
0 deletions
+36
-0
SysGroupController.java
...ise/sc/cement/business/controller/SysGroupController.java
+11
-0
SysPostController.java
...wise/sc/cement/business/controller/SysPostController.java
+11
-0
SysGroupMapper.java
...ava/cn/wise/sc/cement/business/mapper/SysGroupMapper.java
+2
-0
SysRoleServiceImpl.java
...e/sc/cement/business/service/impl/SysRoleServiceImpl.java
+6
-0
UserServiceImpl.java
...wise/sc/cement/business/service/impl/UserServiceImpl.java
+6
-0
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/controller/SysGroupController.java
View file @
6edb4c6c
...
@@ -7,6 +7,9 @@ import cn.wise.sc.cement.business.model.BaseResponse;
...
@@ -7,6 +7,9 @@ import cn.wise.sc.cement.business.model.BaseResponse;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.query.RoleQuery
;
import
cn.wise.sc.cement.business.model.query.RoleQuery
;
import
cn.wise.sc.cement.business.service.ISysGroupService
;
import
cn.wise.sc.cement.business.service.ISysGroupService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
cn.wise.sc.cement.business.wrapper.page.Query
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
...
@@ -35,6 +38,8 @@ public class SysGroupController {
...
@@ -35,6 +38,8 @@ public class SysGroupController {
@Autowired
@Autowired
private
ISysGroupService
groupService
;
private
ISysGroupService
groupService
;
@Autowired
private
ISysUserService
userService
;
@ApiOperation
(
value
=
"工作组分页列表"
)
@ApiOperation
(
value
=
"工作组分页列表"
)
@GetMapping
(
"/getPage"
)
@GetMapping
(
"/getPage"
)
...
@@ -100,6 +105,12 @@ public class SysGroupController {
...
@@ -100,6 +105,12 @@ public class SysGroupController {
@PostMapping
(
"/delete/{id}"
)
@PostMapping
(
"/delete/{id}"
)
public
BaseResponse
delete
(
@PathVariable
Integer
id
)
{
public
BaseResponse
delete
(
@PathVariable
Integer
id
)
{
try
{
try
{
QueryWrapper
<
SysUser
>
sysUserQueryWrapper
=
new
QueryWrapper
<>();
sysUserQueryWrapper
.
eq
(
"group_id"
,
id
);
Integer
conunts
=
userService
.
count
(
sysUserQueryWrapper
);
if
(
conunts
!=
0
&&
conunts
>
0
)
{
return
BaseResponse
.
errorMsg
(
conunts
+
"个用户正在使用!"
);
}
groupService
.
removeById
(
id
);
groupService
.
removeById
(
id
);
return
BaseResponse
.
okData
(
"删除成功"
);
return
BaseResponse
.
okData
(
"删除成功"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/controller/SysPostController.java
View file @
6edb4c6c
...
@@ -2,10 +2,13 @@ package cn.wise.sc.cement.business.controller;
...
@@ -2,10 +2,13 @@ package cn.wise.sc.cement.business.controller;
import
cn.wise.sc.cement.business.entity.SysGroup
;
import
cn.wise.sc.cement.business.entity.SysGroup
;
import
cn.wise.sc.cement.business.entity.SysPost
;
import
cn.wise.sc.cement.business.entity.SysPost
;
import
cn.wise.sc.cement.business.entity.SysUser
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.BaseResponse
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.PageQuery
;
import
cn.wise.sc.cement.business.model.query.PostQuery
;
import
cn.wise.sc.cement.business.model.query.PostQuery
;
import
cn.wise.sc.cement.business.service.ISysPostService
;
import
cn.wise.sc.cement.business.service.ISysPostService
;
import
cn.wise.sc.cement.business.service.ISysUserService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
...
@@ -34,6 +37,8 @@ public class SysPostController {
...
@@ -34,6 +37,8 @@ public class SysPostController {
@Autowired
@Autowired
private
ISysPostService
postService
;
private
ISysPostService
postService
;
@Autowired
private
ISysUserService
userService
;
@ApiOperation
(
value
=
"职务分页列表"
)
@ApiOperation
(
value
=
"职务分页列表"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParams
(
value
=
{
...
@@ -102,6 +107,12 @@ public class SysPostController {
...
@@ -102,6 +107,12 @@ public class SysPostController {
@PostMapping
(
"/delete/{id}"
)
@PostMapping
(
"/delete/{id}"
)
public
BaseResponse
delete
(
@PathVariable
Integer
id
)
{
public
BaseResponse
delete
(
@PathVariable
Integer
id
)
{
try
{
try
{
QueryWrapper
<
SysUser
>
sysUserQueryWrapper
=
new
QueryWrapper
<>();
sysUserQueryWrapper
.
eq
(
"post_id"
,
id
);
Integer
conunts
=
userService
.
count
(
sysUserQueryWrapper
);
if
(
conunts
!=
0
&&
conunts
>
0
)
{
return
BaseResponse
.
errorMsg
(
conunts
+
"个用户正在使用!"
);
}
postService
.
removeById
(
id
);
postService
.
removeById
(
id
);
return
BaseResponse
.
okData
(
"删除成功"
);
return
BaseResponse
.
okData
(
"删除成功"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/mapper/SysGroupMapper.java
View file @
6edb4c6c
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -21,4 +22,5 @@ public interface SysGroupMapper extends BaseMapper<SysGroup> {
...
@@ -21,4 +22,5 @@ public interface SysGroupMapper extends BaseMapper<SysGroup> {
IPage
<
GroupVo
>
getPage
(
@Param
(
"page"
)
Page
page
);
IPage
<
GroupVo
>
getPage
(
@Param
(
"page"
)
Page
page
);
}
}
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/SysRoleServiceImpl.java
View file @
6edb4c6c
...
@@ -93,6 +93,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
...
@@ -93,6 +93,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
@Override
@Override
@Transactional
@Transactional
public
BaseResponse
<
SysRole
>
update
(
RoleQuery
query
)
{
public
BaseResponse
<
SysRole
>
update
(
RoleQuery
query
)
{
if
(
query
.
getId
()
==
1
){
return
BaseResponse
.
errorMsg
(
"系统管理员角色不允许修改!"
);
}
if
(
StringUtils
.
isEmpty
(
query
.
getName
()))
{
if
(
StringUtils
.
isEmpty
(
query
.
getName
()))
{
return
BaseResponse
.
errorMsg
(
"角色名称不能为空!"
);
return
BaseResponse
.
errorMsg
(
"角色名称不能为空!"
);
}
}
...
@@ -138,6 +141,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
...
@@ -138,6 +141,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
@Override
@Override
@Transactional
@Transactional
public
BaseResponse
<
String
>
delete
(
Integer
id
)
{
public
BaseResponse
<
String
>
delete
(
Integer
id
)
{
if
(
id
==
1
){
return
BaseResponse
.
errorMsg
(
"系统管理员角色不允许删除!"
);
}
SysRole
role
=
roleMapper
.
selectById
(
id
);
SysRole
role
=
roleMapper
.
selectById
(
id
);
if
(
role
==
null
)
{
if
(
role
==
null
)
{
return
BaseResponse
.
errorMsg
(
"角色不存在!"
);
return
BaseResponse
.
errorMsg
(
"角色不存在!"
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/UserServiceImpl.java
View file @
6edb4c6c
...
@@ -147,6 +147,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
...
@@ -147,6 +147,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
@Override
@Override
@Transactional
@Transactional
public
BaseResponse
<
SysUser
>
update
(
UserQuery
query
)
{
public
BaseResponse
<
SysUser
>
update
(
UserQuery
query
)
{
if
(
query
.
getId
()
==
1
){
return
BaseResponse
.
errorMsg
(
"不允许更改系统管理员信息!"
);
}
if
(
StringUtils
.
isEmpty
(
query
.
getPhone
()))
{
if
(
StringUtils
.
isEmpty
(
query
.
getPhone
()))
{
return
BaseResponse
.
errorMsg
(
"手机号码不可为空!"
);
return
BaseResponse
.
errorMsg
(
"手机号码不可为空!"
);
}
}
...
@@ -193,6 +196,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
...
@@ -193,6 +196,9 @@ public class UserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impleme
@Override
@Override
@Transactional
@Transactional
public
BaseResponse
<
String
>
status
(
Integer
status
,
Integer
id
)
{
public
BaseResponse
<
String
>
status
(
Integer
status
,
Integer
id
)
{
if
(
id
==
1
){
return
BaseResponse
.
errorMsg
(
"不允许更改系统管理员状态!"
);
}
if
(
status
==
null
||
id
==
null
)
{
if
(
status
==
null
||
id
==
null
)
{
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
return
BaseResponse
.
errorMsg
(
"参数错误!"
);
}
}
...
...
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