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
f23e2d38
Commit
f23e2d38
authored
Feb 14, 2022
by
吴迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】新增零售后端接口
parent
3c9955cd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
537 additions
and
0 deletions
+537
-0
sqlserver.sql
db/sqlserver.sql
+28
-0
RetailpictureController.java
...ce/modules/manage/controller/RetailpictureController.java
+118
-0
RetailpictureDao.java
...n/java/io/office/modules/manage/dao/RetailpictureDao.java
+29
-0
RetailpictureEntity.java
.../io/office/modules/manage/entity/RetailpictureEntity.java
+88
-0
RetailPictureParams.java
...office/modules/manage/entity/dto/RetailPictureParams.java
+26
-0
RetailpictureService.java
...o/office/modules/manage/service/RetailpictureService.java
+40
-0
RetailpictureServiceImpl.java
...modules/manage/service/impl/RetailpictureServiceImpl.java
+122
-0
RetailpictureDao.xml
src/main/resources/mapper/manage/RetailpictureDao.xml
+86
-0
No files found.
db/sqlserver.sql
View file @
f23e2d38
...
...
@@ -592,3 +592,31 @@ GO
update
index_carousel_manage
set
directpath
=
'http://www.chinatrace.org/trace/clientDownload.html'
where
id
=
7
;
update
index_carousel_manage
set
directpath
=
'/Service/Book'
where
id
=
9
;
update
index_carousel_manage
set
directpath
=
'/Service/Book'
where
id
=
10
;
CREATE
TABLE
[
dbo
].[
retailPicture
]
(
[
pictureID
]
int
NOT
NULL
IDENTITY
(
1
,
1
)
,
[
Title
]
varchar
(
200
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
Picture_type
]
varchar
(
50
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
Pic_file
]
varchar
(
200
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
Min_Pic_file
]
varchar
(
50
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
Editor
]
varchar
(
50
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
inputDate
]
datetime
NOT
NULL
,
[
PicLevel
]
int
NULL
,
[
Status
]
int
NULL
,
[
keyword
]
nvarchar
(
50
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
JumpPath
]
nvarchar
(
200
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
content
]
varchar
(
5000
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
article_id
]
int
NULL
,
[
showtime
]
varchar
(
50
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
auditor
]
varchar
(
50
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
[
lasteditor
]
varchar
(
50
)
COLLATE
Chinese_PRC_CI_AS
NULL
,
CONSTRAINT
[
PK_retailPicture_1
]
PRIMARY
KEY
NONCLUSTERED
([
pictureID
])
)
ON
[
PRIMARY
]
GO
CREATE
CLUSTERED
INDEX
[
PK_retailPicture
]
ON
[
dbo
].[
retailPicture
]
([
pictureID
]
ASC
)
ON
[
PRIMARY
]
GO
src/main/java/io/office/modules/manage/controller/RetailpictureController.java
0 → 100644
View file @
f23e2d38
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.modules.manage.entity.dto.PictureParams
;
import
io.office.modules.manage.entity.dto.RetailPictureParams
;
import
io.office.modules.sys.controller.AbstractController
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
io.office.modules.manage.entity.RetailpictureEntity
;
import
io.office.modules.manage.service.RetailpictureService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2022-02-13 17:36:09
*/
@RestController
@RequestMapping
(
"/retailpicture"
)
@Slf4j
public
class
RetailpictureController
extends
AbstractController
{
@Autowired
private
RetailpictureService
retailpictureService
;
/**
* 列表
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("generator:picture:list")
public
R
list
(
@RequestBody
RetailPictureParams
params
){
Page
<
RetailpictureEntity
>
page
=
this
.
retailpictureService
.
selectPictureList
(
params
,
new
Page
(
params
.
getPage
(),
params
.
getLimit
()));
PageUtils
pageUtils
=
new
PageUtils
(
page
);
return
R
.
ok
().
put
(
"page"
,
pageUtils
);
}
/**
* 信息
*/
@RequestMapping
(
"/info/{pictureid}"
)
// @RequiresPermissions("generator:picture:info")
public
R
info
(
@PathVariable
(
"pictureid"
)
Integer
pictureid
){
RetailpictureEntity
picture
=
retailpictureService
.
getById
(
pictureid
);
return
R
.
ok
().
put
(
"picture"
,
picture
);
}
/**
* 保存
*/
@RequestMapping
(
"/save"
)
// @RequiresPermissions("generator:picture:save")
public
R
save
(
@RequestBody
RetailpictureEntity
picture
){
try
{
R
r
=
this
.
retailpictureService
.
insertPicture
(
picture
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"picture save error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 修改
*/
@RequestMapping
(
"/update"
)
// @RequiresPermissions("generator:picture:update")
public
R
update
(
@RequestBody
RetailpictureEntity
picture
){
try
{
R
r
=
this
.
retailpictureService
.
updatePicture
(
picture
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"update error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 删除
*/
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("generator:picture:delete")
public
R
delete
(
@RequestBody
List
<
Long
>
ids
){
try
{
R
r
=
this
.
retailpictureService
.
deletePicture
(
ids
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"delete error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 审核
*/
@PostMapping
(
"/verifyPicture"
)
// @RequiresPermissions("manage:news:verify")
public
R
verify
(
@RequestBody
RetailpictureEntity
picture
)
{
try
{
R
r
=
this
.
retailpictureService
.
verifyPicture
(
picture
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"delete error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
src/main/java/io/office/modules/manage/dao/RetailpictureDao.java
0 → 100644
View file @
f23e2d38
package
io
.
office
.
modules
.
manage
.
dao
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.modules.manage.entity.PictureEntity
;
import
io.office.modules.manage.entity.RetailpictureEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.manage.entity.dto.PictureParams
;
import
io.office.modules.manage.entity.dto.RetailPictureParams
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2022-02-13 17:36:09
*/
@Mapper
public
interface
RetailpictureDao
extends
BaseMapper
<
RetailpictureEntity
>
{
List
<
RetailpictureEntity
>
selectPictureList
(
@Param
(
"params"
)
RetailPictureParams
params
,
Page
page
);
List
<
RetailpictureEntity
>
selectPictureNewList
(
@Param
(
"params"
)
NewsParams
params
,
Page
page
);
}
src/main/java/io/office/modules/manage/entity/RetailpictureEntity.java
0 → 100644
View file @
f23e2d38
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 wudi
* @email
* @date 2022-02-13 17:36:09
*/
@Data
@TableName
(
"retailPicture"
)
public
class
RetailpictureEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* $column.comments
*/
@TableId
private
Integer
pictureid
;
/**
* $column.comments
*/
private
String
title
;
/**
* $column.comments
*/
private
String
pictureType
;
/**
* $column.comments
*/
private
String
picFile
;
/**
* $column.comments
*/
private
String
minPicFile
;
/**
* $column.comments
*/
private
String
editor
;
/**
* $column.comments
*/
private
Date
inputdate
;
/**
* $column.comments
*/
private
Integer
piclevel
;
/**
* $column.comments
*/
private
Integer
status
;
/**
* $column.comments
*/
private
String
keyword
;
/**
* $column.comments
*/
private
String
jumppath
;
/**
* $column.comments
*/
private
String
content
;
/**
* $column.comments
*/
private
Integer
articleId
;
/**
* $column.comments
*/
private
String
showtime
;
/**
* $column.comments
*/
private
String
auditor
;
/**
* $column.comments
*/
private
String
lasteditor
;
}
src/main/java/io/office/modules/manage/entity/dto/RetailPictureParams.java
0 → 100644
View file @
f23e2d38
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
RetailPictureParams
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/service/RetailpictureService.java
0 → 100644
View file @
f23e2d38
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.RetailpictureEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.manage.entity.dto.PictureParams
;
import
io.office.modules.manage.entity.dto.RetailPictureParams
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.List
;
import
java.util.Map
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2022-02-13 17:36:09
*/
public
interface
RetailpictureService
extends
IService
<
RetailpictureEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
R
insertPicture
(
RetailpictureEntity
picture
,
SysUserEntity
user
);
R
updatePicture
(
RetailpictureEntity
picture
,
SysUserEntity
user
);
R
deletePicture
(
List
ids
,
SysUserEntity
user
);
R
verifyPicture
(
RetailpictureEntity
picture
,
SysUserEntity
user
);
Page
<
RetailpictureEntity
>
selectPictureList
(
RetailPictureParams
params
,
Page
page
);
/* Page<RetailpictureEntity> selectPictureNewList(NewsParams params, Page page);*/
}
src/main/java/io/office/modules/manage/service/impl/RetailpictureServiceImpl.java
0 → 100644
View file @
f23e2d38
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.PictureEntity
;
import
io.office.modules.manage.entity.dto.NewsParams
;
import
io.office.modules.manage.entity.dto.RetailPictureParams
;
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
;
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.RetailpictureDao
;
import
io.office.modules.manage.entity.RetailpictureEntity
;
import
io.office.modules.manage.service.RetailpictureService
;
@Service
(
"retailpictureService"
)
public
class
RetailpictureServiceImpl
extends
ServiceImpl
<
RetailpictureDao
,
RetailpictureEntity
>
implements
RetailpictureService
{
@Autowired
RetailpictureDao
retailpictureDao
;
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
RetailpictureEntity
>
page
=
this
.
page
(
new
Query
<
RetailpictureEntity
>().
getPage
(
params
),
new
QueryWrapper
<
RetailpictureEntity
>()
);
return
new
PageUtils
(
page
);
}
@Override
public
R
insertPicture
(
RetailpictureEntity
picture
,
SysUserEntity
user
)
{
if
(
picture
.
getPictureid
()
==
null
){
return
R
.
error
(
"id不能为空!"
);
}
QueryWrapper
<
RetailpictureEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"pictureid"
,
picture
.
getPictureid
());
picture
.
setEditor
(
user
.
getUsername
());
picture
.
setLasteditor
(
user
.
getUsername
());
int
update
=
baseMapper
.
update
(
picture
,
newsEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"修改成功!"
);
}
else
{
return
R
.
error
(
"修改失败!"
);
}
}
@Override
public
R
updatePicture
(
RetailpictureEntity
picture
,
SysUserEntity
user
)
{
if
(
picture
.
getPictureid
()
==
null
){
return
R
.
error
(
"id不能为空!"
);
}
QueryWrapper
<
RetailpictureEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"pictureid"
,
picture
.
getPictureid
());
picture
.
setEditor
(
user
.
getUsername
());
picture
.
setLasteditor
(
user
.
getUsername
());
int
update
=
baseMapper
.
update
(
picture
,
newsEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"修改成功!"
);
}
else
{
return
R
.
error
(
"修改失败!"
);
}
}
@Override
public
R
deletePicture
(
List
ids
,
SysUserEntity
user
)
{
RetailpictureEntity
pictureEntity
=
new
RetailpictureEntity
();
pictureEntity
.
setPiclevel
(
0
);
pictureEntity
.
setLasteditor
(
user
.
getUsername
());
pictureEntity
.
setEditor
(
user
.
getUsername
());
QueryWrapper
<
RetailpictureEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
in
(
"pictureid"
,
ids
);
int
delete
=
baseMapper
.
update
(
pictureEntity
,
newsEntityQueryWrapper
);
if
(
delete
>
0
){
return
R
.
ok
(
"删除成功!"
);
}
else
{
return
R
.
error
(
"删除失败!"
);
}
}
@Override
public
R
verifyPicture
(
RetailpictureEntity
picture
,
SysUserEntity
user
)
{
picture
.
setAuditor
(
user
.
getUsername
());
picture
.
setInputdate
(
new
Date
());
picture
.
setLasteditor
(
user
.
getUsername
());
QueryWrapper
<
RetailpictureEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
eq
(
"pictureid"
,
picture
.
getPictureid
());
int
verify
=
baseMapper
.
update
(
picture
,
newsEntityQueryWrapper
);
if
(
verify
>
0
){
return
R
.
ok
(
"审核成功!"
);
}
else
{
return
R
.
error
(
"审核失败!"
);
}
}
@Override
public
Page
<
RetailpictureEntity
>
selectPictureList
(
RetailPictureParams
params
,
Page
page
)
{
List
<
RetailpictureEntity
>
newsList
=
this
.
retailpictureDao
.
selectPictureList
(
params
,
page
);
page
.
setRecords
(
newsList
);
return
page
;
}
/* @Override
public Page<RetailpictureEntity> selectPictureNewList(NewsParams params, Page page) {
List<PictureEntity> list = this.newsDao.pictureTop4();
params.setList(list);
List<PictureEntity> newsList = this.pictureDao.selectPictureNewList(params, page);
page.setRecords(newsList);
return page;
}*/
}
\ No newline at end of file
src/main/resources/mapper/manage/RetailpictureDao.xml
0 → 100644
View file @
f23e2d38
<?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.RetailpictureDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"io.office.modules.manage.entity.RetailpictureEntity"
id=
"retailpictureMap"
>
<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=
"retailpictureMap"
parameterType=
"io.office.modules.manage.entity.dto.RetailPictureParams"
>
SELECT
t.pictureID,
t.title,
t.Picture_type,
t.showtime,
t.inputDate,
t.keyword,
t.Editor,
t.lasteditor,
t.auditor,
t.Status,
t.PicLevel,
t.jumppath
FROM
retailPicture 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 params.status !=null"
>
and t.Status =#{params.status}
</if>
<if
test=
"params.pictureType !='' and params.pictureType !=null"
>
and t.Picture_type =#{params.pictureType}
</if>
<if
test=
"params.inputDateStart !=null and params.inputDateEnd !=null"
>
and inputDate BETWEEN #{params.inputDateStart} AND #{params.inputDateEnd}
</if>
<choose>
<when
test=
"params.pictureLevel !=null "
>
AND PicLevel = #{params.pictureLevel}
</when>
<otherwise>
AND PicLevel > 0
</otherwise>
</choose>
ORDER BY
pictureID DESC
</select>
<select
id=
"selectPictureNewList"
resultMap=
"retailpictureMap"
parameterType=
"io.office.modules.manage.entity.dto.NewsParams"
>
SELECT *
FROM retailPicture
WHERE status = 1
AND PicLevel > 0
AND pictureid NOT IN
<foreach
collection=
"params.list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item.pictureid}
</foreach>
ORDER BY PicLevel DESC,
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