Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
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
吴迪
gs1-office-web-sit
Commits
2057f79e
Commit
2057f79e
authored
Nov 04, 2021
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】政策法规管理新增修改
parent
dd6491f9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
15 deletions
+70
-15
PolicyController.java
...io/office/modules/manage/controller/PolicyController.java
+24
-13
PolicyEntity.java
...in/java/io/office/modules/manage/entity/PolicyEntity.java
+2
-2
PolicyService.java
.../java/io/office/modules/manage/service/PolicyService.java
+6
-0
PolicyServiceImpl.java
...office/modules/manage/service/impl/PolicyServiceImpl.java
+38
-0
No files found.
src/main/java/io/office/modules/manage/controller/PolicyController.java
View file @
2057f79e
...
@@ -7,6 +7,8 @@ import io.office.common.utils.PageUtils;
...
@@ -7,6 +7,8 @@ import io.office.common.utils.PageUtils;
import
io.office.common.utils.R
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.service.PolicyService
;
import
io.office.modules.manage.service.PolicyService
;
import
io.office.modules.sys.controller.AbstractController
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
@@ -26,8 +28,9 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -26,8 +28,9 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2021-11-04 22:13:54
* @date 2021-11-04 22:13:54
*/
*/
@RestController
@RestController
@RequestMapping
(
"generator/policy"
)
@RequestMapping
(
"/policy"
)
public
class
PolicyController
{
@Slf4j
public
class
PolicyController
extends
AbstractController
{
@Autowired
@Autowired
private
PolicyService
policyService
;
private
PolicyService
policyService
;
...
@@ -35,7 +38,7 @@ public class PolicyController {
...
@@ -35,7 +38,7 @@ public class PolicyController {
* 列表
* 列表
*/
*/
@RequestMapping
(
"/list"
)
@RequestMapping
(
"/list"
)
@RequiresPermissions
(
"generator:policy:list"
)
//
@RequiresPermissions("generator:policy:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
policyService
.
queryPage
(
params
);
PageUtils
page
=
policyService
.
queryPage
(
params
);
...
@@ -47,7 +50,7 @@ public class PolicyController {
...
@@ -47,7 +50,7 @@ public class PolicyController {
* 信息
* 信息
*/
*/
@RequestMapping
(
"/info/{id}"
)
@RequestMapping
(
"/info/{id}"
)
@RequiresPermissions
(
"generator:policy:info"
)
//
@RequiresPermissions("generator:policy:info")
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
){
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
){
PolicyEntity
policy
=
policyService
.
getById
(
id
);
PolicyEntity
policy
=
policyService
.
getById
(
id
);
...
@@ -58,29 +61,37 @@ public class PolicyController {
...
@@ -58,29 +61,37 @@ public class PolicyController {
* 保存
* 保存
*/
*/
@RequestMapping
(
"/save"
)
@RequestMapping
(
"/save"
)
@RequiresPermissions
(
"generator:policy:save"
)
//
@RequiresPermissions("generator:policy:save")
public
R
save
(
@RequestBody
PolicyEntity
policy
){
public
R
save
(
@RequestBody
PolicyEntity
policy
){
policyService
.
save
(
policy
);
try
{
R
r
=
this
.
policyService
.
inserPolicy
(
policy
,
getUser
());
return
R
.
ok
();
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"save error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
/**
/**
* 修改
* 修改
*/
*/
@RequestMapping
(
"/update"
)
@RequestMapping
(
"/update"
)
@RequiresPermissions
(
"generator:policy:update"
)
//
@RequiresPermissions("generator:policy:update")
public
R
update
(
@RequestBody
PolicyEntity
policy
){
public
R
update
(
@RequestBody
PolicyEntity
policy
){
policyService
.
updateById
(
policy
);
try
{
R
r
=
this
.
policyService
.
updatePolicy
(
policy
,
getUser
());
return
R
.
ok
();
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"save error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
/**
/**
* 删除
* 删除
*/
*/
@RequestMapping
(
"/delete"
)
@RequestMapping
(
"/delete"
)
@RequiresPermissions
(
"generator:policy:delete"
)
//
@RequiresPermissions("generator:policy:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
public
R
delete
(
@RequestBody
Integer
[]
ids
){
policyService
.
removeByIds
(
Arrays
.
asList
(
ids
));
policyService
.
removeByIds
(
Arrays
.
asList
(
ids
));
...
...
src/main/java/io/office/modules/manage/entity/PolicyEntity.java
View file @
2057f79e
...
@@ -89,11 +89,11 @@ public class PolicyEntity implements Serializable {
...
@@ -89,11 +89,11 @@ public class PolicyEntity implements Serializable {
/**
/**
* $column.comments
* $column.comments
*/
*/
private
String
publicdate
;
private
Date
publicdate
;
/**
/**
* $column.comments
* $column.comments
*/
*/
private
String
startdate
;
private
Date
startdate
;
/**
/**
* $column.comments
* $column.comments
*/
*/
...
...
src/main/java/io/office/modules/manage/service/PolicyService.java
View file @
2057f79e
...
@@ -2,7 +2,9 @@ package io.office.modules.manage.service;
...
@@ -2,7 +2,9 @@ package io.office.modules.manage.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -16,5 +18,9 @@ import java.util.Map;
...
@@ -16,5 +18,9 @@ import java.util.Map;
public
interface
PolicyService
extends
IService
<
PolicyEntity
>
{
public
interface
PolicyService
extends
IService
<
PolicyEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
R
inserPolicy
(
PolicyEntity
policy
,
SysUserEntity
user
);
R
updatePolicy
(
PolicyEntity
policy
,
SysUserEntity
user
);
}
}
src/main/java/io/office/modules/manage/service/impl/PolicyServiceImpl.java
View file @
2057f79e
...
@@ -2,10 +2,15 @@ package io.office.modules.manage.service.impl;
...
@@ -2,10 +2,15 @@ package io.office.modules.manage.service.impl;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.common.utils.Query
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.dao.PolicyDao
;
import
io.office.modules.manage.dao.PolicyDao
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.service.PolicyService
;
import
io.office.modules.manage.service.PolicyService
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
@@ -25,4 +30,36 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
...
@@ -25,4 +30,36 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
return
new
PageUtils
(
page
);
return
new
PageUtils
(
page
);
}
}
@Override
public
R
inserPolicy
(
PolicyEntity
policy
,
SysUserEntity
user
)
{
policy
.
setEditor
(
user
.
getUsername
());
policy
.
setLasteditor
(
user
.
getUsername
());
policy
.
setStartdate
(
new
Date
());
policy
.
setPublicdate
(
new
Date
());
//二级栏目不为空时 classid取值二级栏目id值
int
insert
=
baseMapper
.
insert
(
policy
);
if
(
insert
>
0
){
return
R
.
ok
(
"新增成功!"
);
}
else
{
return
R
.
error
(
"新增失败!"
);
}
}
@Override
public
R
updatePolicy
(
PolicyEntity
policy
,
SysUserEntity
user
)
{
if
(
policy
.
getId
()
==
null
){
return
R
.
error
(
"id不能为空!"
);
}
QueryWrapper
<
PolicyEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"id"
,
policy
.
getId
());
policy
.
setEditor
(
user
.
getUsername
());
policy
.
setLasteditor
(
user
.
getUsername
());
int
update
=
baseMapper
.
update
(
policy
,
newsEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"修改成功!"
);
}
else
{
return
R
.
error
(
"修改失败!"
);
}
}
}
}
\ No newline at end of file
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