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
ada5b913
Commit
ada5b913
authored
Nov 14, 2021
by
吴迪
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
febade2d
69f45679
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
393 additions
and
21 deletions
+393
-21
PcategoryController.java
...office/modules/manage/controller/PcategoryController.java
+100
-0
PolicyController.java
...io/office/modules/manage/controller/PolicyController.java
+33
-16
PcategoryDao.java
src/main/java/io/office/modules/manage/dao/PcategoryDao.java
+17
-0
PolicyDao.java
src/main/java/io/office/modules/manage/dao/PolicyDao.java
+7
-0
PcategoryEntity.java
...java/io/office/modules/manage/entity/PcategoryEntity.java
+48
-0
PolicyEntity.java
...in/java/io/office/modules/manage/entity/PolicyEntity.java
+2
-2
PolicyParams.java
...ava/io/office/modules/manage/entity/dto/PolicyParams.java
+27
-0
PcategoryService.java
...va/io/office/modules/manage/service/PcategoryService.java
+25
-0
PolicyService.java
.../java/io/office/modules/manage/service/PolicyService.java
+9
-0
PcategoryServiceImpl.java
...ice/modules/manage/service/impl/PcategoryServiceImpl.java
+57
-0
PolicyServiceImpl.java
...office/modules/manage/service/impl/PolicyServiceImpl.java
+45
-2
PolicyDao.xml
src/main/resources/mapper/manage/PolicyDao.xml
+23
-1
No files found.
src/main/java/io/office/modules/manage/controller/PcategoryController.java
0 → 100644
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
io.office.modules.sys.controller.AbstractController
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.office.modules.manage.entity.PcategoryEntity
;
import
io.office.modules.manage.service.PcategoryService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
/**
* 商品分类
*
* @author rkl
* @email
* @date 2021-11-13 22:13:03
*/
@RestController
@RequestMapping
(
"/pcategory"
)
@Slf4j
public
class
PcategoryController
extends
AbstractController
{
@Autowired
private
PcategoryService
pcategoryService
;
/**
* 列表
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("manage:pcategory:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
pcategoryService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
}
/**
* 信息
*/
@RequestMapping
(
"/info/{categoryid}"
)
// @RequiresPermissions("manage:pcategory:info")
public
R
info
(
@PathVariable
(
"categoryid"
)
Integer
categoryid
){
PcategoryEntity
pcategory
=
pcategoryService
.
getById
(
categoryid
);
return
R
.
ok
().
put
(
"pcategory"
,
pcategory
);
}
/**
* 保存
*/
@RequestMapping
(
"/save"
)
// @RequiresPermissions("manage:pcategory:save")
public
R
save
(
@RequestBody
PcategoryEntity
pcategory
){
try
{
R
r
=
this
.
pcategoryService
.
insertPcategory
(
pcategory
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"save error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 修改
*/
@RequestMapping
(
"/update"
)
// @RequiresPermissions("manage:pcategory:update")
public
R
update
(
@RequestBody
PcategoryEntity
pcategory
){
try
{
R
r
=
this
.
pcategoryService
.
updatePcategory
(
pcategory
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"update error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 删除
*/
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("manage:pcategory:delete")
public
R
delete
(
@RequestBody
Integer
[]
categoryids
){
pcategoryService
.
removeByIds
(
Arrays
.
asList
(
categoryids
));
return
R
.
ok
();
}
}
src/main/java/io/office/modules/manage/controller/PolicyController.java
View file @
ada5b913
...
...
@@ -3,27 +3,25 @@ package io.office.modules.manage.controller;
import
java.util.Arrays
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.PictureEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.entity.dto.PolicyParams
;
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.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
/**
*
${comments}
*
政策法规
*
* @author
chenshun
* @author
rkl
* @email sunlightcs@gmail.com
* @date 2021-11-04 22:13:54
*/
...
...
@@ -39,10 +37,11 @@ public class PolicyController extends AbstractController {
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("generator:policy:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
policyService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
public
R
list
(
@RequestBody
PolicyParams
params
){
Page
<
PictureEntity
>
page
=
this
.
policyService
.
selectPolicyList
(
params
,
new
Page
(
params
.
getPage
(),
params
.
getLimit
()));
PageUtils
pageUtils
=
new
PageUtils
(
page
);
return
R
.
ok
().
put
(
"page"
,
pageUtils
);
}
...
...
@@ -93,9 +92,27 @@ public class PolicyController extends AbstractController {
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("generator:policy:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
policyService
.
removeByIds
(
Arrays
.
asList
(
ids
));
return
R
.
ok
();
try
{
R
r
=
this
.
policyService
.
deletePolicy
(
ids
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"delete error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 审核
*/
@PostMapping
(
"/verifyPolicy"
)
// @RequiresPermissions("manage:news:verify")
public
R
verify
(
@RequestBody
PolicyEntity
policyEntity
)
{
try
{
R
r
=
this
.
policyService
.
verifyTopic
(
policyEntity
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"verifyPolicy error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
src/main/java/io/office/modules/manage/dao/PcategoryDao.java
0 → 100644
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
dao
;
import
io.office.modules.manage.entity.PcategoryEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* ${comments}
*
* @author rkl
* @email
* @date 2021-11-13 22:13:03
*/
@Mapper
public
interface
PcategoryDao
extends
BaseMapper
<
PcategoryEntity
>
{
}
src/main/java/io/office/modules/manage/dao/PolicyDao.java
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
dao
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.office.modules.manage.entity.dto.PolicyParams
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* ${comments}
...
...
@@ -14,4 +20,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public
interface
PolicyDao
extends
BaseMapper
<
PolicyEntity
>
{
List
<
NewsEntity
>
selectPolicyList
(
@Param
(
"newsParams"
)
PolicyParams
params
,
Page
page
);
}
src/main/java/io/office/modules/manage/entity/PcategoryEntity.java
0 → 100644
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* ${comments}
*
* @author rkl
* @email
* @date 2021-11-13 22:13:03
*/
@Data
@TableName
(
"Pcategory"
)
public
class
PcategoryEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* $column.comments
*/
@TableId
private
Integer
categoryid
;
/**
* $column.comments
*/
private
String
category
;
/**
* $column.comments
*/
private
Integer
parentid
;
/**
* $column.comments
*/
private
Integer
childnum
;
/**
* $column.comments
*/
private
Integer
depth
;
/**
* $column.comments
*/
private
String
ppath
;
}
src/main/java/io/office/modules/manage/entity/PolicyEntity.java
View file @
ada5b913
...
...
@@ -89,11 +89,11 @@ public class PolicyEntity implements Serializable {
/**
* $column.comments
*/
private
Date
publicdate
;
private
String
publicdate
;
/**
* $column.comments
*/
private
Date
startdate
;
private
String
startdate
;
/**
* $column.comments
*/
...
...
src/main/java/io/office/modules/manage/entity/dto/PolicyParams.java
0 → 100644
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
entity
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.office.modules.manage.entity.page.PageParams
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author JavaClimber
* @version 1.0
* @date 2021/11/13 21:21
*/
@Data
public
class
PolicyParams
extends
PageParams
{
private
String
title
;
private
String
editor
;
private
String
keyword
;
private
String
status
;
private
String
class1
;
private
String
level
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTimeStart
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTimeEnd
;
}
\ No newline at end of file
src/main/java/io/office/modules/manage/service/PcategoryService.java
0 → 100644
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.PcategoryEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.Map
;
/**
* 商品分类
* @author rkl
* @email
* @date 2021-11-13 22:13:03
*/
public
interface
PcategoryService
extends
IService
<
PcategoryEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
R
insertPcategory
(
PcategoryEntity
pcategory
,
SysUserEntity
user
);
R
updatePcategory
(
PcategoryEntity
pcategory
,
SysUserEntity
user
);
}
src/main/java/io/office/modules/manage/service/PolicyService.java
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.PictureEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.entity.dto.PolicyParams
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.Map
;
...
...
@@ -22,5 +25,11 @@ public interface PolicyService extends IService<PolicyEntity> {
R
inserPolicy
(
PolicyEntity
policy
,
SysUserEntity
user
);
R
updatePolicy
(
PolicyEntity
policy
,
SysUserEntity
user
);
R
deletePolicy
(
Integer
[]
ids
,
SysUserEntity
user
);
R
verifyTopic
(
PolicyEntity
policyEntity
,
SysUserEntity
user
);
Page
<
PictureEntity
>
selectPolicyList
(
PolicyParams
params
,
Page
page
);
}
src/main/java/io/office/modules/manage/service/impl/PcategoryServiceImpl.java
0 → 100644
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.modules.manage.dao.PcategoryDao
;
import
io.office.modules.manage.entity.PcategoryEntity
;
import
io.office.modules.manage.service.PcategoryService
;
@Service
(
"pcategoryService"
)
public
class
PcategoryServiceImpl
extends
ServiceImpl
<
PcategoryDao
,
PcategoryEntity
>
implements
PcategoryService
{
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
PcategoryEntity
>
page
=
this
.
page
(
new
Query
<
PcategoryEntity
>().
getPage
(
params
),
new
QueryWrapper
<
PcategoryEntity
>()
);
return
new
PageUtils
(
page
);
}
@Override
public
R
insertPcategory
(
PcategoryEntity
pcategory
,
SysUserEntity
user
)
{
int
insert
=
baseMapper
.
insert
(
pcategory
);
if
(
insert
>
0
){
return
R
.
ok
(
"新增成功!"
);
}
else
{
return
R
.
error
(
"新增失败!"
);
}
}
@Override
public
R
updatePcategory
(
PcategoryEntity
pcategory
,
SysUserEntity
user
)
{
QueryWrapper
<
PcategoryEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"categoryid"
,
pcategory
.
getCategoryid
());
int
update
=
baseMapper
.
update
(
pcategory
,
newsEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"修改成功!"
);
}
else
{
return
R
.
error
(
"修改失败!"
);
}
}
}
\ No newline at end of file
src/main/java/io/office/modules/manage/service/impl/PolicyServiceImpl.java
View file @
ada5b913
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.DateUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.dao.PolicyDao
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.PictureEntity
;
import
io.office.modules.manage.entity.PolicyEntity
;
import
io.office.modules.manage.entity.dto.PolicyParams
;
import
io.office.modules.manage.service.PolicyService
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
...
@@ -20,6 +26,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
(
"policyService"
)
public
class
PolicyServiceImpl
extends
ServiceImpl
<
PolicyDao
,
PolicyEntity
>
implements
PolicyService
{
@Autowired
private
PolicyDao
policyDao
;
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
PolicyEntity
>
page
=
this
.
page
(
...
...
@@ -34,8 +42,8 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
public
R
inserPolicy
(
PolicyEntity
policy
,
SysUserEntity
user
)
{
policy
.
setEditor
(
user
.
getUsername
());
policy
.
setLasteditor
(
user
.
getUsername
());
policy
.
set
Start
date
(
new
Date
());
policy
.
set
Public
date
(
new
Date
());
policy
.
set
Release
date
(
new
Date
());
policy
.
set
Update
date
(
new
Date
());
//二级栏目不为空时 classid取值二级栏目id值
int
insert
=
baseMapper
.
insert
(
policy
);
if
(
insert
>
0
){
...
...
@@ -54,6 +62,7 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
newsEntityQueryWrapper
.
eq
(
"id"
,
policy
.
getId
());
policy
.
setEditor
(
user
.
getUsername
());
policy
.
setLasteditor
(
user
.
getUsername
());
policy
.
setUpdatedate
(
new
Date
());
int
update
=
baseMapper
.
update
(
policy
,
newsEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"修改成功!"
);
...
...
@@ -62,4 +71,37 @@ public class PolicyServiceImpl extends ServiceImpl<PolicyDao, PolicyEntity> impl
}
}
@Override
public
R
deletePolicy
(
Integer
[]
ids
,
SysUserEntity
user
)
{
PolicyEntity
policyEntity
=
new
PolicyEntity
();
policyEntity
.
setLevels
(
0
);
policyEntity
.
setLasteditor
(
user
.
getUsername
());
policyEntity
.
setUpdatedate
(
new
Date
());
QueryWrapper
<
PolicyEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
in
(
"id"
,
ids
);
int
delete
=
baseMapper
.
update
(
policyEntity
,
newsEntityQueryWrapper
);
if
(
delete
>
0
){
return
R
.
ok
(
"删除成功!"
);
}
else
{
return
R
.
error
(
"删除失败!"
);
}
}
@Override
public
R
verifyTopic
(
PolicyEntity
policyEntity
,
SysUserEntity
user
)
{
policyEntity
.
setAuditor
(
user
.
getUsername
());
policyEntity
.
setLasteditor
(
user
.
getUsername
());
QueryWrapper
<
PolicyEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"id"
,
policyEntity
.
getId
());
baseMapper
.
update
(
policyEntity
,
newsEntityQueryWrapper
);
return
R
.
ok
(
"审核成功!"
);
}
@Override
public
Page
<
PictureEntity
>
selectPolicyList
(
PolicyParams
params
,
Page
page
)
{
List
<
NewsEntity
>
newsList
=
this
.
policyDao
.
selectPolicyList
(
params
,
page
);
page
.
setRecords
(
newsList
);
return
page
;
}
}
\ No newline at end of file
src/main/resources/mapper/manage/PolicyDao.xml
View file @
ada5b913
...
...
@@ -6,7 +6,7 @@
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"io.office.modules.manage.entity.PolicyEntity"
id=
"policyMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"class"
column=
"class"
/>
<result
property=
"class
1
"
column=
"class"
/>
<result
property=
"title"
column=
"title"
/>
<result
property=
"titleOld"
column=
"title_old"
/>
<result
property=
"keyword"
column=
"keyword"
/>
...
...
@@ -26,6 +26,27 @@
<result
property=
"status"
column=
"status"
/>
<result
property=
"auditor"
column=
"auditor"
/>
</resultMap>
<select
id=
"selectPolicyList"
resultMap=
"policyMap"
parameterType=
"io.office.modules.manage.entity.dto.PolicyParams"
>
select class,title,editor,lasteditor,releasedate,updatedate,auditor,status from Policy
where 1=1
<if
test=
"newsParams.updateTimeStart !=null and newsParams.updateTimeEnd !=null"
>
and updatedate BETWEEN #{newsParams.updateTimeStart} AND #{newsParams.updateTimeEnd}
</if>
<if
test=
"newsParams.keyword !=null and newsParams.keyword !=''"
>
and keyword like concat('%',#{newsParams.keyword},'%')
</if>
<if
test=
"newsParams.title !=null and newsParams.title !=''"
>
and title like concat('%',#{newsParams.title},'%')
</if>
<if
test=
"newsParams.status !=null"
>
and status =#{newsParams.status}
</if>
<if
test=
"newsParams.editor !=null and newsParams.editor !=''"
>
and editor =#{newsParams.editor}
</if>
ORDER BY
id DESC
</select>
</mapper>
\ 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