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
6304c8c2
Commit
6304c8c2
authored
Oct 18, 2021
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】图片资讯功能新增
parent
f9f826b1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
153 additions
and
12 deletions
+153
-12
NewsController.java
...a/io/office/modules/manage/controller/NewsController.java
+2
-1
PictureController.java
...o/office/modules/manage/controller/PictureController.java
+8
-4
PictureDao.java
src/main/java/io/office/modules/manage/dao/PictureDao.java
+7
-1
NewsParams.java
.../java/io/office/modules/manage/entity/dto/NewsParams.java
+2
-3
PictureParams.java
...va/io/office/modules/manage/entity/dto/PictureParams.java
+26
-0
PageParams.java
...java/io/office/modules/manage/entity/page/PageParams.java
+14
-0
PictureService.java
...java/io/office/modules/manage/service/PictureService.java
+4
-0
PictureServiceImpl.java
...ffice/modules/manage/service/impl/PictureServiceImpl.java
+22
-3
PictureDao.xml
src/main/resources/mapper/manage/PictureDao.xml
+68
-0
No files found.
src/main/java/io/office/modules/manage/controller/NewsController.java
View file @
6304c8c2
...
...
@@ -43,7 +43,8 @@ public class NewsController extends AbstractController {
public
R
list
(
@RequestBody
NewsParams
newsParams
)
{
Page
<
NewsEntity
>
page
=
this
.
newsService
.
selectNewsList
(
newsParams
,
new
Page
(
newsParams
.
getPage
(),
newsParams
.
getLimit
()));
return
R
.
ok
().
put
(
"page"
,
page
);
PageUtils
pageUtils
=
new
PageUtils
(
page
);
return
R
.
ok
().
put
(
"page"
,
pageUtils
);
}
...
...
src/main/java/io/office/modules/manage/controller/PictureController.java
View file @
6304c8c2
...
...
@@ -4,10 +4,12 @@ import java.util.Arrays;
import
java.util.List
;
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.dto.PictureParams
;
import
io.office.modules.manage.service.PictureService
;
import
io.office.modules.sys.controller.AbstractController
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -34,9 +36,11 @@ public class PictureController extends AbstractController {
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("generator:picture:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
pictureService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
public
R
list
(
@RequestBody
PictureParams
params
){
Page
<
PictureEntity
>
page
=
this
.
pictureService
.
selectPictureList
(
params
,
new
Page
(
params
.
getPage
(),
params
.
getLimit
()));
PageUtils
pageUtils
=
new
PageUtils
(
page
);
return
R
.
ok
().
put
(
"page"
,
pageUtils
);
}
...
...
@@ -86,7 +90,7 @@ public class PictureController extends AbstractController {
*/
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("generator:picture:delete")
public
R
delete
(
@RequestBody
List
ids
){
public
R
delete
(
@RequestBody
List
<
Long
>
ids
){
try
{
R
r
=
this
.
pictureService
.
deletePicture
(
ids
,
getUser
());
return
r
;
...
...
src/main/java/io/office/modules/manage/dao/PictureDao.java
View file @
6304c8c2
package
io
.
office
.
modules
.
manage
.
dao
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.modules.manage.entity.PictureEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.office.modules.manage.entity.dto.PictureParams
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* ${comments}
...
...
@@ -13,5 +18,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public
interface
PictureDao
extends
BaseMapper
<
PictureEntity
>
{
List
<
PictureEntity
>
selectPictureList
(
@Param
(
"params"
)
PictureParams
params
,
Page
page
);
}
src/main/java/io/office/modules/manage/entity/dto/NewsParams.java
View file @
6304c8c2
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.*
;
...
...
@@ -11,9 +12,7 @@ import java.util.*;
* @date 2021/10/14
*/
@Data
public
class
NewsParams
{
private
int
page
;
private
int
limit
;
public
class
NewsParams
extends
PageParams
{
private
String
title
;
private
int
levels
;
private
String
author
;
...
...
src/main/java/io/office/modules/manage/entity/dto/PictureParams.java
0 → 100644
View file @
6304c8c2
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 rkl
* @description 图片资讯入参
* @date 2021/10/18
*/
@Data
public
class
PictureParams
extends
PageParams
{
private
String
title
;
private
String
status
;
private
String
pictureType
;
private
String
pictureLevel
;
private
String
editor
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
inputDateStart
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
inputDateEnd
;
private
String
keyword
;
}
src/main/java/io/office/modules/manage/entity/page/PageParams.java
0 → 100644
View file @
6304c8c2
package
io
.
office
.
modules
.
manage
.
entity
.
page
;
import
lombok.Data
;
/**
* @author rkl
* @description
* @date 2021/10/18
*/
@Data
public
class
PageParams
{
private
int
page
;
private
int
limit
;
}
src/main/java/io/office/modules/manage/service/PictureService.java
View file @
6304c8c2
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.dto.PictureParams
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.List
;
...
...
@@ -27,5 +29,7 @@ public interface PictureService extends IService<PictureEntity> {
R
deletePicture
(
List
ids
,
SysUserEntity
user
);
R
verifyPicture
(
PictureEntity
picture
,
SysUserEntity
user
);
Page
<
PictureEntity
>
selectPictureList
(
PictureParams
params
,
Page
page
);
}
src/main/java/io/office/modules/manage/service/impl/PictureServiceImpl.java
View file @
6304c8c2
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.dao.PictureDao
;
import
io.office.modules.manage.entity.NewsEntity
;
import
io.office.modules.manage.entity.PictureEntity
;
import
io.office.modules.manage.entity.dto.PictureParams
;
import
io.office.modules.manage.service.PictureService
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
...
...
@@ -21,6 +24,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
(
"pictureService"
)
public
class
PictureServiceImpl
extends
ServiceImpl
<
PictureDao
,
PictureEntity
>
implements
PictureService
{
@Autowired
PictureDao
pictureDao
;
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
PictureEntity
>
page
=
this
.
page
(
...
...
@@ -35,6 +42,8 @@ public class PictureServiceImpl extends ServiceImpl<PictureDao, PictureEntity> i
public
R
insertPicture
(
PictureEntity
picture
,
SysUserEntity
user
)
{
picture
.
setEditor
(
user
.
getUsername
());
picture
.
setLasteditor
(
user
.
getUsername
());
picture
.
setInputdate
(
new
Date
());
picture
.
setStatus
(
0
);
int
insert
=
baseMapper
.
insert
(
picture
);
if
(
insert
>
0
){
return
R
.
ok
(
"新增成功!"
);
...
...
@@ -49,7 +58,7 @@ public class PictureServiceImpl extends ServiceImpl<PictureDao, PictureEntity> i
return
R
.
error
(
"id不能为空!"
);
}
QueryWrapper
<
PictureEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"id"
,
picture
.
getPictureid
());
newsEntityQueryWrapper
.
eq
(
"
picture
id"
,
picture
.
getPictureid
());
picture
.
setEditor
(
user
.
getUsername
());
picture
.
setLasteditor
(
user
.
getUsername
());
int
update
=
baseMapper
.
update
(
picture
,
newsEntityQueryWrapper
);
...
...
@@ -64,8 +73,10 @@ public class PictureServiceImpl extends ServiceImpl<PictureDao, PictureEntity> i
public
R
deletePicture
(
List
ids
,
SysUserEntity
user
)
{
PictureEntity
pictureEntity
=
new
PictureEntity
();
pictureEntity
.
setPiclevel
(
0
);
pictureEntity
.
setLasteditor
(
user
.
getUsername
());
pictureEntity
.
setEditor
(
user
.
getUsername
());
QueryWrapper
<
PictureEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
in
(
"id"
,
ids
);
newsEntityQueryWrapper
.
in
(
"
picture
id"
,
ids
);
int
delete
=
baseMapper
.
update
(
pictureEntity
,
newsEntityQueryWrapper
);
if
(
delete
>
0
){
return
R
.
ok
(
"删除成功!"
);
...
...
@@ -80,7 +91,7 @@ public class PictureServiceImpl extends ServiceImpl<PictureDao, PictureEntity> i
picture
.
setInputdate
(
new
Date
());
picture
.
setLasteditor
(
user
.
getUsername
());
QueryWrapper
<
PictureEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"id"
,
picture
.
getPictureid
());
newsEntityQueryWrapper
.
eq
(
"
picture
id"
,
picture
.
getPictureid
());
int
verify
=
baseMapper
.
update
(
picture
,
newsEntityQueryWrapper
);
if
(
verify
>
0
){
return
R
.
ok
(
"审核成功!"
);
...
...
@@ -89,4 +100,11 @@ public class PictureServiceImpl extends ServiceImpl<PictureDao, PictureEntity> i
}
}
@Override
public
Page
<
PictureEntity
>
selectPictureList
(
PictureParams
params
,
Page
page
)
{
List
<
PictureEntity
>
newsList
=
this
.
pictureDao
.
selectPictureList
(
params
,
page
);
page
.
setRecords
(
newsList
);
return
page
;
}
}
\ No newline at end of file
src/main/resources/mapper/manage/PictureDao.xml
0 → 100644
View file @
6304c8c2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"io.office.modules.manage.dao.PictureDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"io.office.modules.manage.entity.PictureEntity"
id=
"pictureMap"
>
<result
property=
"pictureid"
column=
"pictureID"
/>
<result
property=
"title"
column=
"Title"
/>
<result
property=
"pictureType"
column=
"Picture_type"
/>
<result
property=
"picFile"
column=
"Pic_file"
/>
<result
property=
"minPicFile"
column=
"Min_Pic_file"
/>
<result
property=
"editor"
column=
"Editor"
/>
<result
property=
"inputdate"
column=
"inputDate"
/>
<result
property=
"piclevel"
column=
"PicLevel"
/>
<result
property=
"status"
column=
"Status"
/>
<result
property=
"keyword"
column=
"keyword"
/>
<result
property=
"jumppath"
column=
"JumpPath"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"articleId"
column=
"article_id"
/>
<result
property=
"showtime"
column=
"showtime"
/>
<result
property=
"auditor"
column=
"auditor"
/>
<result
property=
"lasteditor"
column=
"lasteditor"
/>
</resultMap>
<select
id=
"selectPictureList"
resultMap=
"pictureMap"
parameterType=
"io.office.modules.manage.entity.dto.PictureParams"
>
SELECT
t.title,
t.Picture_type,
t.showtime,
t.inputDate,
t.keyword,
t.Editor,
t.lasteditor,
t.auditor,
t.Status,
t.PicLevel
FROM
picture t
where 1=1
<if
test=
"params.title !='' and params.title !=null"
>
and t.title like concat('%',#{params.title},'%')
</if>
<if
test=
"params.editor !='' and params.editor !=null"
>
and t.Editor like concat('%',#{params.editor},'%')
</if>
<if
test=
"params.keyword !='' and params.keyword !=null"
>
and t.keyword like concat('%',#{params.keyword},'%')
</if>
<if
test=
"params.status !=''"
>
and t.Status =#{params.status}
</if>
<if
test=
"params.pictureType !='' and params.pictureType !=null"
>
and t.Picture_type =#{params.pictureType}
</if>
<choose>
<when
test=
"params.pictureLevel != 0"
>
AND PicLevel = #{params.pictureLevel}
</when>
<otherwise>
AND PicLevel = 0
</otherwise>
</choose>
ORDER BY
pictureID 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