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
8e024710
Commit
8e024710
authored
Jan 15, 2022
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】案例管理功能
parent
7dc5a3e6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
17 deletions
+110
-17
CasesController.java
.../io/office/modules/manage/controller/CasesController.java
+37
-16
CasesDao.java
src/main/java/io/office/modules/manage/dao/CasesDao.java
+1
-1
CasesService.java
...n/java/io/office/modules/manage/service/CasesService.java
+6
-0
CasesServiceImpl.java
.../office/modules/manage/service/impl/CasesServiceImpl.java
+34
-0
CasesDao.xml
src/main/resources/mapper/manage/CasesDao.xml
+32
-0
No files found.
src/main/java/io/office/modules/manage/controller/CasesController.java
View file @
8e024710
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -8,13 +9,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
io.office.modules.app.annotation.Login
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
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.*
;
import
io.office.modules.manage.entity.CasesEntity
;
import
io.office.modules.manage.service.CasesService
;
...
...
@@ -32,7 +31,8 @@ import io.office.common.utils.R;
*/
@RestController
@RequestMapping
(
"/cases"
)
public
class
CasesController
{
@Slf4j
public
class
CasesController
extends
AbstractController
{
@Autowired
private
CasesService
casesService
;
...
...
@@ -71,7 +71,6 @@ public class CasesController {
// @RequiresPermissions("manage:cases:info")
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
){
CasesEntity
cases
=
casesService
.
getById
(
id
);
return
R
.
ok
().
put
(
"cases"
,
cases
);
}
...
...
@@ -81,9 +80,12 @@ public class CasesController {
@RequestMapping
(
"/save"
)
// @RequiresPermissions("manage:cases:save")
public
R
save
(
@RequestBody
CasesEntity
cases
){
cases
.
setEditor
(
getUser
().
getUsername
());
cases
.
setLasteditor
(
getUser
().
getUsername
());
cases
.
setRegisterdate
(
new
Date
());
cases
.
setUpdatedate
(
new
Date
());
casesService
.
save
(
cases
);
return
R
.
ok
();
return
R
.
ok
(
"新增成功!"
);
}
/**
...
...
@@ -92,9 +94,11 @@ public class CasesController {
@RequestMapping
(
"/update"
)
// @RequiresPermissions("manage:cases:update")
public
R
update
(
@RequestBody
CasesEntity
cases
){
cases
.
setEditor
(
getUser
().
getUsername
());
cases
.
setLasteditor
(
getUser
().
getUsername
());
cases
.
setUpdatedate
(
new
Date
());
casesService
.
updateById
(
cases
);
return
R
.
ok
();
return
R
.
ok
(
"修改成功!"
);
}
/**
...
...
@@ -102,12 +106,29 @@ public class CasesController {
*/
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("manage:cases:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
casesService
.
removeByIds
(
Arrays
.
asList
(
ids
));
return
R
.
ok
();
public
R
delete
(
@RequestBody
List
<
Long
>
ids
){
try
{
R
r
=
this
.
casesService
.
delete
(
ids
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"delete error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 审核
*/
@PostMapping
(
"/verify"
)
// @RequiresPermissions("manage:partners:delete")
public
R
verify
(
@RequestBody
CasesEntity
casesEntity
){
try
{
R
r
=
this
.
casesService
.
verify
(
casesEntity
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"verifyPartners error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 信息
*/
...
...
src/main/java/io/office/modules/manage/dao/CasesDao.java
View file @
8e024710
...
...
@@ -22,5 +22,5 @@ public interface CasesDao extends BaseMapper<CasesEntity> {
@Select
(
"select * from Cases where status=#{status} and levels>#{levels} order by id desc"
)
List
<
CasesEntity
>
selectByStatusAndLevels
(
@Param
(
"status"
)
String
status
,
@Param
(
"levels"
)
String
levels
,
Page
page
);
List
<
CasesEntity
>
selectCaseList
(
NewsParams
params
,
Page
page
);
List
<
CasesEntity
>
selectCaseList
(
@Param
(
"newsParams"
)
NewsParams
params
,
Page
page
);
}
src/main/java/io/office/modules/manage/service/CasesService.java
View file @
8e024710
...
...
@@ -3,9 +3,11 @@ 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.CasesEntity
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -26,5 +28,9 @@ public interface CasesService extends IService<CasesEntity> {
Page
<
CasesEntity
>
selectCaseList
(
NewsParams
params
,
Page
page
);
R
delete
(
List
<
Long
>
ids
,
SysUserEntity
user
);
R
verify
(
CasesEntity
casesEntity
,
SysUserEntity
user
);
}
src/main/java/io/office/modules/manage/service/impl/CasesServiceImpl.java
View file @
8e024710
...
...
@@ -2,12 +2,15 @@ package io.office.modules.manage.service.impl;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -64,6 +67,37 @@ public class CasesServiceImpl extends ServiceImpl<CasesDao, CasesEntity> impleme
return
page
;
}
@Override
public
R
delete
(
List
<
Long
>
ids
,
SysUserEntity
user
)
{
CasesEntity
casesEntity
=
new
CasesEntity
();
casesEntity
.
setUpdatedate
(
new
Date
());
casesEntity
.
setEditor
(
user
.
getUsername
());
casesEntity
.
setLasteditor
(
user
.
getUsername
());
casesEntity
.
setLevels
(
0
);
QueryWrapper
<
CasesEntity
>
partnersEntityQueryWrapper
=
new
QueryWrapper
<>();
partnersEntityQueryWrapper
.
in
(
"id"
,
ids
);
int
update
=
this
.
baseMapper
.
update
(
casesEntity
,
partnersEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"删除成功!"
);
}
else
{
return
R
.
error
(
"删除失败!"
);
}
}
@Override
public
R
verify
(
CasesEntity
casesEntity
,
SysUserEntity
user
)
{
QueryWrapper
<
CasesEntity
>
partnersEntityQueryWrapper
=
new
QueryWrapper
<>();
partnersEntityQueryWrapper
.
in
(
"id"
,
casesEntity
.
getId
());
casesEntity
.
setAuditor
(
user
.
getUsername
());
casesEntity
.
setCheckdate
(
new
Date
());
int
update
=
this
.
baseMapper
.
update
(
casesEntity
,
partnersEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"审核成功!"
);
}
else
{
return
R
.
error
(
"审核失败!"
);
}
}
/* public List<CasesEntity> frontList() {
String status="1";//代表审核状态,编辑从后台提交专题后,默认初始状态为status=0,审核成功status=1,审核失败status=-1
String levels="0";//levels代表级别,取值从0到9。其中,0代表隐藏,1级以上可以显示,9级为最高级
...
...
src/main/resources/mapper/manage/CasesDao.xml
View file @
8e024710
...
...
@@ -21,5 +21,36 @@
</resultMap>
<select
id=
"selectCaseList"
resultMap=
"casesMap"
>
SELECT * from Cases t
WHERE
1=1
<choose>
<when
test=
"newsParams.levels !=null"
>
AND t.levels = #{newsParams.levels}
</when>
<otherwise>
AND t.levels > 0
</otherwise>
</choose>
<if
test=
"newsParams.releaseTimeStart !=null and newsParams.releaseTimeEnd !=null"
>
and t.registerdate BETWEEN #{newsParams.releaseTimeStart} AND #{newsParams.releaseTimeEnd}
</if>
<if
test=
"newsParams.updateTimeStart !=null and newsParams.updateTimeEnd !=null"
>
and t.updatedate BETWEEN #{newsParams.updateTimeStart} AND #{newsParams.updateTimeEnd}
</if>
<if
test=
"newsParams.title !=null and newsParams.title !=''"
>
and t.title like concat('%',#{newsParams.title},'%')
</if>
<if
test=
"newsParams.status !=null and newsParams.status !=''"
>
and t.status =#{newsParams.status}
</if>
<if
test=
"newsParams.editor !=null and newsParams.editor !=''"
>
and t.editor =#{newsParams.editor}
</if>
<if
test=
"newsParams.service !=null and newsParams.service !=''"
>
and t.service = #{newsParams.service}
</if>
ORDER BY
t.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