Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
Overview
Overview
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
黄营
datax-cloud
Commits
0d1c3ea8
Commit
0d1c3ea8
authored
Nov 03, 2019
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
a9114029
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
135 additions
and
3 deletions
+135
-3
DeptController.java
...va/cn/datax/service/system/controller/DeptController.java
+17
-0
MenuController.java
...va/cn/datax/service/system/controller/MenuController.java
+17
-0
PostController.java
...va/cn/datax/service/system/controller/PostController.java
+23
-1
RoleController.java
...va/cn/datax/service/system/controller/RoleController.java
+23
-1
UserController.java
...va/cn/datax/service/system/controller/UserController.java
+27
-0
UserDao.java
...ce/src/main/java/cn/datax/service/system/dao/UserDao.java
+2
-0
DeptServiceImpl.java
...cn/datax/service/system/service/impl/DeptServiceImpl.java
+4
-0
PostServiceImpl.java
...cn/datax/service/system/service/impl/PostServiceImpl.java
+6
-0
RoleServiceImpl.java
...cn/datax/service/system/service/impl/RoleServiceImpl.java
+6
-0
UserServiceImpl.java
...cn/datax/service/system/service/impl/UserServiceImpl.java
+6
-1
UserDao.xml
...rent/system-service/src/main/resources/mapper/UserDao.xml
+4
-0
No files found.
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/DeptController.java
View file @
0d1c3ea8
...
...
@@ -8,6 +8,10 @@ import cn.datax.service.system.api.entity.DeptEntity;
import
cn.datax.service.system.mapstruct.DeptMapper
;
import
cn.datax.service.system.service.DeptService
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -22,6 +26,7 @@ import cn.datax.common.base.BaseController;
* @author yuwei
* @since 2019-09-04
*/
@Api
(
tags
=
{
"系统管理"
})
@RestController
@RequestMapping
(
"/depts"
)
public
class
DeptController
extends
BaseController
{
...
...
@@ -32,29 +37,41 @@ public class DeptController extends BaseController {
@Autowired
private
DeptMapper
deptMapper
;
@ApiOperation
(
value
=
"获取部门详细信息"
,
notes
=
"根据url的id来获取部门详细信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"部门ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/{id}"
)
public
R
getDeptById
(
@PathVariable
String
id
)
{
DeptEntity
deptEntity
=
deptService
.
getById
(
id
);
return
R
.
ok
().
setData
(
deptMapper
.
toVO
(
deptEntity
));
}
@ApiOperation
(
value
=
"获取部门列表"
,
notes
=
""
)
@GetMapping
()
public
R
getDeptList
()
{
return
R
.
ok
().
setData
(
deptService
.
list
(
Wrappers
.
emptyWrapper
()));
}
@ApiOperation
(
value
=
"创建部门"
,
notes
=
"根据dept对象创建部门"
)
@ApiImplicitParam
(
name
=
"dept"
,
value
=
"部门详细实体dept"
,
required
=
true
,
dataType
=
"DeptDto"
)
@PostMapping
()
public
R
saveDept
(
@RequestBody
@Validated
({
ValidateGroupForSave
.
class
})
DeptDto
dept
)
{
deptService
.
saveDept
(
dept
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"更新部门详细信息"
,
notes
=
"根据url的id来指定更新对象,并根据传过来的dept信息来更新部门详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"部门ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"dept"
,
value
=
"部门详细实体dept"
,
required
=
true
,
dataType
=
"DeptDto"
)
})
@PutMapping
(
"/{id}"
)
public
R
updateDept
(
@PathVariable
String
id
,
@RequestBody
@Validated
({
ValidateGroupForUpdate
.
class
})
DeptDto
dept
)
{
deptService
.
updateDept
(
dept
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"删除部门"
,
notes
=
"根据url的id来指定删除对象"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"部门ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{id}"
)
public
R
deleteDept
(
@PathVariable
String
id
)
{
deptService
.
deleteDeptById
(
id
);
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/MenuController.java
View file @
0d1c3ea8
...
...
@@ -8,6 +8,10 @@ import cn.datax.service.system.api.entity.MenuEntity;
import
cn.datax.service.system.mapstruct.MenuMapper
;
import
cn.datax.service.system.service.MenuService
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -22,6 +26,7 @@ import cn.datax.common.base.BaseController;
* @author yuwei
* @since 2019-09-11
*/
@Api
(
tags
=
{
"系统管理"
})
@RestController
@RequestMapping
(
"/menus"
)
public
class
MenuController
extends
BaseController
{
...
...
@@ -32,29 +37,41 @@ public class MenuController extends BaseController {
@Autowired
private
MenuMapper
menuMapper
;
@ApiOperation
(
value
=
"获取菜单详细信息"
,
notes
=
"根据url的id来获取菜单详细信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"菜单ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/{id}"
)
public
R
getMenuById
(
@PathVariable
String
id
)
{
MenuEntity
menuEntity
=
menuService
.
getById
(
id
);
return
R
.
ok
().
setData
(
menuMapper
.
toVO
(
menuEntity
));
}
@ApiOperation
(
value
=
"获取菜单列表"
,
notes
=
""
)
@GetMapping
()
public
R
getMenuList
()
{
return
R
.
ok
().
setData
(
menuService
.
list
(
Wrappers
.
emptyWrapper
()));
}
@ApiOperation
(
value
=
"创建菜单"
,
notes
=
"根据menu对象创建菜单"
)
@ApiImplicitParam
(
name
=
"menu"
,
value
=
"菜单详细实体menu"
,
required
=
true
,
dataType
=
"MenuDto"
)
@PostMapping
()
public
R
saveMenu
(
@RequestBody
@Validated
({
ValidateGroupForSave
.
class
})
MenuDto
menu
)
{
menuService
.
saveMenu
(
menu
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"更新菜单详细信息"
,
notes
=
"根据url的id来指定更新对象,并根据传过来的menu信息来更新菜单详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"菜单ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"menu"
,
value
=
"菜单详细实体menu"
,
required
=
true
,
dataType
=
"MenuDto"
)
})
@PutMapping
(
"/{id}"
)
public
R
updateMenu
(
@PathVariable
String
id
,
@RequestBody
@Validated
({
ValidateGroupForUpdate
.
class
})
MenuDto
menu
)
{
menuService
.
updateMenu
(
menu
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"删除菜单"
,
notes
=
"根据url的id来指定删除对象"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"菜单ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{id}"
)
public
R
deleteMenu
(
@PathVariable
String
id
)
{
menuService
.
deleteMenuById
(
id
);
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/PostController.java
View file @
0d1c3ea8
...
...
@@ -12,6 +12,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -26,6 +30,7 @@ import cn.datax.common.base.BaseController;
* @author yuwei
* @since 2019-09-11
*/
@Api
(
tags
=
{
"系统管理"
})
@RestController
@RequestMapping
(
"/posts"
)
public
class
PostController
extends
BaseController
{
...
...
@@ -36,34 +41,51 @@ public class PostController extends BaseController {
@Autowired
private
PostMapper
postMapper
;
@ApiOperation
(
value
=
"获取岗位详细信息"
,
notes
=
"根据url的id来获取岗位详细信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"岗位ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/{id}"
)
public
R
getPostById
(
@PathVariable
String
id
)
{
PostEntity
postEntity
=
postService
.
getById
(
id
);
return
R
.
ok
().
setData
(
postMapper
.
toVO
(
postEntity
));
}
@ApiOperation
(
value
=
"岗位分页查询"
,
notes
=
""
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"当前页码"
,
required
=
true
,
dataType
=
"int"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"分页条数"
,
required
=
true
,
dataType
=
"int"
,
example
=
"20"
),
@ApiImplicitParam
(
name
=
"post"
,
value
=
"岗位详细实体post"
,
required
=
false
,
dataTypeClass
=
PostDto
.
class
)
})
@GetMapping
(
"/page"
)
public
R
getPostPage
(
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
pageSize
,
Post
Entity
post
)
{
Post
Dto
post
)
{
QueryWrapper
<
PostEntity
>
queryWrapper
=
Wrappers
.
emptyWrapper
();
queryWrapper
.
like
(
StrUtil
.
isNotBlank
(
post
.
getPostName
()),
"post_name"
,
post
.
getPostName
());
IPage
<
PostEntity
>
page
=
postService
.
page
(
new
Page
<>(
pageNum
,
pageSize
),
queryWrapper
);
return
R
.
ok
().
setData
(
page
);
}
@ApiOperation
(
value
=
"创建岗位"
,
notes
=
"根据post对象创建岗位"
)
@ApiImplicitParam
(
name
=
"post"
,
value
=
"岗位详细实体post"
,
required
=
true
,
dataType
=
"PostDto"
)
@PostMapping
()
public
R
savePost
(
@RequestBody
@Validated
({
ValidateGroupForSave
.
class
})
PostDto
post
)
{
postService
.
savePost
(
post
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"更新岗位详细信息"
,
notes
=
"根据url的id来指定更新对象,并根据传过来的post信息来更新岗位详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"岗位ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"post"
,
value
=
"岗位详细实体post"
,
required
=
true
,
dataType
=
"PostDto"
)
})
@PutMapping
(
"/{id}"
)
public
R
updatePost
(
@PathVariable
String
id
,
@RequestBody
@Validated
({
ValidateGroupForUpdate
.
class
})
PostDto
post
)
{
postService
.
updatePost
(
post
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"删除岗位"
,
notes
=
"根据url的id来指定删除对象"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"岗位ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{id}"
)
public
R
deletePost
(
@PathVariable
String
id
)
{
postService
.
deletePostById
(
id
);
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/RoleController.java
View file @
0d1c3ea8
...
...
@@ -12,6 +12,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -26,6 +30,7 @@ import cn.datax.common.base.BaseController;
* @author yuwei
* @since 2019-09-04
*/
@Api
(
tags
=
{
"系统管理"
})
@RestController
@RequestMapping
(
"/roles"
)
public
class
RoleController
extends
BaseController
{
...
...
@@ -41,6 +46,8 @@ public class RoleController extends BaseController {
* @param id
* @return
*/
@ApiOperation
(
value
=
"获取角色详细信息"
,
notes
=
"根据url的id来获取角色详细信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"角色ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/{id}"
)
public
R
getRoleById
(
@PathVariable
String
id
)
{
RoleEntity
roleEntity
=
roleService
.
getById
(
id
);
...
...
@@ -54,10 +61,16 @@ public class RoleController extends BaseController {
* @param role
* @return
*/
@ApiOperation
(
value
=
"角色分页查询"
,
notes
=
""
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"当前页码"
,
required
=
true
,
dataType
=
"int"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"分页条数"
,
required
=
true
,
dataType
=
"int"
,
example
=
"20"
),
@ApiImplicitParam
(
name
=
"role"
,
value
=
"角色详细实体role"
,
required
=
false
,
dataTypeClass
=
RoleDto
.
class
)
})
@GetMapping
(
"/page"
)
public
R
getRolePage
(
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
pageSize
,
Role
Entity
role
)
{
Role
Dto
role
)
{
QueryWrapper
<
RoleEntity
>
queryWrapper
=
Wrappers
.
emptyWrapper
();
queryWrapper
.
like
(
StrUtil
.
isNotBlank
(
role
.
getRoleName
()),
"role_name"
,
role
.
getRoleName
());
IPage
<
RoleEntity
>
page
=
roleService
.
page
(
new
Page
<>(
pageNum
,
pageSize
),
queryWrapper
);
...
...
@@ -69,6 +82,8 @@ public class RoleController extends BaseController {
* @param role
* @return
*/
@ApiOperation
(
value
=
"创建角色"
,
notes
=
"根据role对象创建角色"
)
@ApiImplicitParam
(
name
=
"role"
,
value
=
"角色详细实体role"
,
required
=
true
,
dataType
=
"RoleDto"
)
@PostMapping
()
public
R
saveRole
(
@RequestBody
@Validated
({
ValidateGroupForSave
.
class
})
RoleDto
role
)
{
roleService
.
saveRole
(
role
);
...
...
@@ -80,6 +95,11 @@ public class RoleController extends BaseController {
* @param role
* @return
*/
@ApiOperation
(
value
=
"更新角色详细信息"
,
notes
=
"根据url的id来指定更新对象,并根据传过来的role信息来更新角色详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"角色ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"role"
,
value
=
"角色详细实体role"
,
required
=
true
,
dataType
=
"RoleDto"
)
})
@PutMapping
(
"/{id}"
)
public
R
updateRole
(
@PathVariable
String
id
,
@RequestBody
@Validated
({
ValidateGroupForUpdate
.
class
})
RoleDto
role
)
{
roleService
.
updateRole
(
role
);
...
...
@@ -91,6 +111,8 @@ public class RoleController extends BaseController {
* @param id
* @return
*/
@ApiOperation
(
value
=
"删除角色"
,
notes
=
"根据url的id来指定删除对象"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"角色ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{id}"
)
public
R
deleteRole
(
@PathVariable
String
id
)
{
roleService
.
deleteRoleById
(
id
);
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/UserController.java
View file @
0d1c3ea8
...
...
@@ -13,6 +13,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -27,6 +31,7 @@ import cn.datax.common.base.BaseController;
* @author yuwei
* @since 2019-09-04
*/
@Api
(
tags
=
{
"系统管理"
})
@RestController
@RequestMapping
(
"/users"
)
public
class
UserController
extends
BaseController
{
...
...
@@ -37,12 +42,20 @@ public class UserController extends BaseController {
@Autowired
private
UserMapper
userMapper
;
@ApiOperation
(
value
=
"获取用户详细信息"
,
notes
=
"根据url的id来获取用户详细信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"用户ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/{id}"
)
public
R
getUserById
(
@PathVariable
String
id
)
{
UserEntity
userEntity
=
userService
.
getById
(
id
);
return
R
.
ok
().
setData
(
userMapper
.
toVO
(
userEntity
));
}
@ApiOperation
(
value
=
"用户分页查询"
,
notes
=
""
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"pageNum"
,
value
=
"当前页码"
,
required
=
true
,
dataType
=
"int"
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"pageSize"
,
value
=
"分页条数"
,
required
=
true
,
dataType
=
"int"
,
example
=
"20"
),
@ApiImplicitParam
(
name
=
"user"
,
value
=
"用户详细实体user"
,
required
=
false
,
dataTypeClass
=
UserDto
.
class
)
})
@GetMapping
(
"/page"
)
public
R
getUserPage
(
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"20"
)
Integer
pageSize
,
...
...
@@ -54,24 +67,38 @@ public class UserController extends BaseController {
return
R
.
ok
().
setData
(
page
);
}
@ApiOperation
(
value
=
"创建用户"
,
notes
=
"根据user对象创建用户"
)
@ApiImplicitParam
(
name
=
"user"
,
value
=
"用户详细实体user"
,
required
=
true
,
dataTypeClass
=
UserDto
.
class
)
@PostMapping
()
public
R
saveUser
(
@RequestBody
@Validated
({
ValidateGroupForSave
.
class
})
UserDto
user
)
{
userService
.
saveUser
(
user
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"更新用户详细信息"
,
notes
=
"根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"用户ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"user"
,
value
=
"用户详细实体user"
,
required
=
true
,
dataTypeClass
=
UserDto
.
class
)
})
@PutMapping
(
"/{id}"
)
public
R
updateUser
(
@PathVariable
String
id
,
@RequestBody
@Validated
({
ValidateGroupForUpdate
.
class
})
UserDto
user
)
{
userService
.
updateUser
(
user
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"更新用户密码"
,
notes
=
"根据url的id来指定更新对象,并根据传过来的user信息来更新用户密码"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"用户ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"user"
,
value
=
"用户详细实体user"
,
required
=
true
,
dataTypeClass
=
UserPasswordDto
.
class
)
})
@PutMapping
(
"/{id}/password"
)
public
R
updateUserPassword
(
@PathVariable
String
id
,
@RequestBody
@Validated
UserPasswordDto
user
)
{
userService
.
updateUserPassword
(
user
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"删除用户"
,
notes
=
"根据url的id来指定删除对象"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"用户ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{id}"
)
public
R
deleteUser
(
@PathVariable
String
id
)
{
userService
.
deleteUserById
(
id
);
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/dao/UserDao.java
View file @
0d1c3ea8
...
...
@@ -2,6 +2,7 @@ package cn.datax.service.system.dao;
import
cn.datax.common.base.BaseDao
;
import
cn.datax.service.system.api.entity.UserEntity
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>
...
...
@@ -13,4 +14,5 @@ import cn.datax.service.system.api.entity.UserEntity;
*/
public
interface
UserDao
extends
BaseDao
<
UserEntity
>
{
void
updateUserPassword
(
@Param
(
"password"
)
String
passwordEncode
,
@Param
(
"id"
)
String
id
);
}
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/service/impl/DeptServiceImpl.java
View file @
0d1c3ea8
...
...
@@ -32,6 +32,10 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptDao, DeptEntity> implem
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveDept
(
DeptDto
deptDto
)
{
DeptEntity
dept
=
deptMapper
.
toEntity
(
deptDto
);
int
n
=
baseMapper
.
selectCount
(
Wrappers
.<
DeptEntity
>
lambdaQuery
().
eq
(
DeptEntity:
:
getDeptName
,
dept
.
getDeptName
()));
if
(
n
>
0
){
throw
new
DataException
(
"该部门名已存在"
);
}
baseMapper
.
insert
(
dept
);
}
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/service/impl/PostServiceImpl.java
View file @
0d1c3ea8
package
cn
.
datax
.
service
.
system
.
service
.
impl
;
import
cn.datax.common.exception.DataException
;
import
cn.datax.service.system.api.dto.PostDto
;
import
cn.datax.service.system.api.entity.PostEntity
;
import
cn.datax.service.system.dao.PostDao
;
import
cn.datax.service.system.mapstruct.PostMapper
;
import
cn.datax.service.system.service.PostService
;
import
cn.datax.common.base.BaseServiceImpl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -30,6 +32,10 @@ public class PostServiceImpl extends BaseServiceImpl<PostDao, PostEntity> implem
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
savePost
(
PostDto
postDto
)
{
PostEntity
post
=
postMapper
.
toEntity
(
postDto
);
int
n
=
baseMapper
.
selectCount
(
Wrappers
.<
PostEntity
>
lambdaQuery
().
eq
(
PostEntity:
:
getPostName
,
post
.
getPostName
()));
if
(
n
>
0
){
throw
new
DataException
(
"该岗位名已存在"
);
}
baseMapper
.
insert
(
post
);
}
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/service/impl/RoleServiceImpl.java
View file @
0d1c3ea8
package
cn
.
datax
.
service
.
system
.
service
.
impl
;
import
cn.datax.common.exception.DataException
;
import
cn.datax.service.system.api.dto.RoleDto
;
import
cn.datax.service.system.api.entity.RoleEntity
;
import
cn.datax.service.system.dao.RoleDao
;
import
cn.datax.service.system.mapstruct.RoleMapper
;
import
cn.datax.service.system.service.RoleService
;
import
cn.datax.common.base.BaseServiceImpl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -30,6 +32,10 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleDao, RoleEntity> implem
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveRole
(
RoleDto
roleDto
)
{
RoleEntity
role
=
roleMapper
.
toEntity
(
roleDto
);
int
n
=
baseMapper
.
selectCount
(
Wrappers
.<
RoleEntity
>
lambdaQuery
().
eq
(
RoleEntity:
:
getRoleName
,
role
.
getRoleName
()));
if
(
n
>
0
){
throw
new
DataException
(
"该角色名已存在"
);
}
baseMapper
.
insert
(
role
);
}
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/service/impl/UserServiceImpl.java
View file @
0d1c3ea8
...
...
@@ -50,6 +50,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveUser
(
UserDto
userDto
)
{
UserEntity
user
=
userMapper
.
toEntity
(
userDto
);
int
n
=
baseMapper
.
selectCount
(
Wrappers
.<
UserEntity
>
lambdaQuery
().
eq
(
UserEntity:
:
getUsername
,
user
.
getUsername
()));
if
(
n
>
0
){
throw
new
DataException
(
"该用户名已存在"
);
}
String
passwordEncode
=
new
BCryptPasswordEncoder
().
encode
(
user
.
getPassword
());
user
.
setPassword
(
passwordEncode
);
baseMapper
.
insert
(
user
);
...
...
@@ -120,7 +124,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
if
(!
StrUtil
.
equals
(
userEntity
.
getPassword
(),
new
BCryptPasswordEncoder
().
encode
(
userPasswordDto
.
getOldPassword
()))){
throw
new
DataException
(
"旧密码不正确"
);
}
// todo xml写更新密码sql
String
passwordEncode
=
new
BCryptPasswordEncoder
().
encode
(
userPasswordDto
.
getPassword
());
baseMapper
.
updateUserPassword
(
passwordEncode
,
userPasswordDto
.
getId
());
}
}
datax-modules/system-service-parent/system-service/src/main/resources/mapper/UserDao.xml
View file @
0d1c3ea8
...
...
@@ -30,4 +30,8 @@
username, nickname, password, email, phone, birthday, status
</sql>
<update
id=
"updateUserPassword"
>
update sys_user set password = #{password} where id = #{id}
</update>
</mapper>
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