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
f80999e3
Commit
f80999e3
authored
Nov 14, 2021
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】商品分类下拉列表;商品管理新增、修改、删除接口
parent
7ce1d5eb
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
463 additions
and
6 deletions
+463
-6
PcategoryController.java
...office/modules/manage/controller/PcategoryController.java
+9
-6
ProductController.java
...o/office/modules/manage/controller/ProductController.java
+100
-0
ProductDao.java
src/main/java/io/office/modules/manage/dao/ProductDao.java
+17
-0
ProductEntity.java
...n/java/io/office/modules/manage/entity/ProductEntity.java
+185
-0
PcategoryService.java
...va/io/office/modules/manage/service/PcategoryService.java
+3
-0
ProductService.java
...java/io/office/modules/manage/service/ProductService.java
+27
-0
PcategoryServiceImpl.java
...ice/modules/manage/service/impl/PcategoryServiceImpl.java
+9
-0
ProductServiceImpl.java
...ffice/modules/manage/service/impl/ProductServiceImpl.java
+61
-0
ProductDao.xml
src/main/resources/mapper/manage/ProductDao.xml
+52
-0
No files found.
src/main/java/io/office/modules/manage/controller/PcategoryController.java
View file @
f80999e3
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.List
;
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
org.springframework.web.bind.annotation.*
;
import
io.office.modules.manage.entity.PcategoryEntity
;
import
io.office.modules.manage.service.PcategoryService
;
...
...
@@ -41,7 +38,6 @@ public class PcategoryController extends AbstractController {
// @RequiresPermissions("manage:pcategory:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
pcategoryService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
}
...
...
@@ -97,4 +93,11 @@ public class PcategoryController extends AbstractController {
return
R
.
ok
();
}
@GetMapping
(
"/getCategoryList"
)
public
R
getCategoryList
(
@RequestParam
Map
<
String
,
Object
>
params
){
List
<
PcategoryEntity
>
list
=
this
.
pcategoryService
.
getCategoryList
(
params
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
}
src/main/java/io/office/modules/manage/controller/ProductController.java
0 → 100644
View file @
f80999e3
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.List
;
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.ProductEntity
;
import
io.office.modules.manage.service.ProductService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
/**
* 商品管理
*
* @author rkl
* @email
* @date 2021-11-14 22:56:51
*/
@RestController
@RequestMapping
(
"/product"
)
@Slf4j
public
class
ProductController
extends
AbstractController
{
@Autowired
private
ProductService
productService
;
/**
* 列表
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("manage:product:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
productService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
}
/**
* 信息
*/
@RequestMapping
(
"/info/{id}"
)
// @RequiresPermissions("manage:product:info")
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
){
ProductEntity
product
=
productService
.
getById
(
id
);
return
R
.
ok
().
put
(
"product"
,
product
);
}
/**
* 保存
*/
@RequestMapping
(
"/save"
)
// @RequiresPermissions("manage:product:save")
public
R
save
(
@RequestBody
ProductEntity
product
){
try
{
R
r
=
this
.
productService
.
insertProduct
(
product
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"save error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
/**
* 修改
*/
@RequestMapping
(
"/update"
)
// @RequiresPermissions("manage:product:update")
public
R
update
(
@RequestBody
ProductEntity
product
){
productService
.
updateById
(
product
);
return
R
.
ok
(
"修改成功!"
);
}
/**
* 删除
*/
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("manage:product:delete")
public
R
delete
(
@RequestBody
List
<
Long
>
ids
){
try
{
R
r
=
this
.
productService
.
deleteProduct
(
ids
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"delete error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
src/main/java/io/office/modules/manage/dao/ProductDao.java
0 → 100644
View file @
f80999e3
package
io
.
office
.
modules
.
manage
.
dao
;
import
io.office.modules.manage.entity.ProductEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* ${comments}
*
* @author rkl
* @email
* @date 2021-11-14 22:56:51
*/
@Mapper
public
interface
ProductDao
extends
BaseMapper
<
ProductEntity
>
{
}
src/main/java/io/office/modules/manage/entity/ProductEntity.java
0 → 100644
View file @
f80999e3
package
io
.
office
.
modules
.
manage
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.math.BigDecimal
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 商品管理
*
* @author rkl
* @email
* @date 2021-11-14 22:56:51
*/
@Data
@TableName
(
"product"
)
public
class
ProductEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* $column.comments
*/
@TableId
private
Integer
id
;
/**
* $column.comments
*/
private
String
prename
;
/**
* $column.comments
*/
private
String
company
;
/**
* $column.comments
*/
private
String
intro
;
/**
* $column.comments
*/
private
String
predate
;
/**
* $column.comments
*/
private
BigDecimal
price
;
/**
* $column.comments
*/
private
String
pretype
;
/**
* $column.comments
*/
private
String
other
;
/**
* $column.comments
*/
private
String
graph2
;
/**
* $column.comments
*/
private
String
addlink
;
/**
* $column.comments
*/
private
String
prestock
;
/**
* $column.comments
*/
private
String
graph
;
/**
* $column.comments
*/
private
String
description
;
/**
* $column.comments
*/
private
String
remarks
;
/**
* $column.comments
*/
private
String
name
;
/**
* $column.comments
*/
private
String
introduce
;
/**
* $column.comments
*/
private
String
productdate
;
/**
* $column.comments
*/
private
Integer
score
;
/**
* $column.comments
*/
private
String
grade
;
/**
* $column.comments
*/
private
String
photo
;
/**
* $column.comments
*/
private
Integer
recommend
;
/**
* $column.comments
*/
private
Integer
solded
;
/**
* $column.comments
*/
private
Integer
viewnum
;
/**
* $column.comments
*/
private
float
discount
;
/**
* $column.comments
*/
private
Integer
sortsid
;
/**
* $column.comments
*/
private
Integer
categoryid
;
/**
* $column.comments
*/
private
String
pic
;
/**
* $column.comments
*/
private
String
makein
;
/**
* $column.comments
*/
private
Date
adddate
;
/**
* $column.comments
*/
private
Integer
ranknum
;
/**
* $column.comments
*/
private
Float
vipprice
;
/**
* $column.comments
*/
private
String
amount
;
/**
* $column.comments
*/
private
String
stock
;
/**
* $column.comments
*/
private
String
link
;
/**
* $column.comments
*/
private
String
mark
;
/**
* $column.comments
*/
private
String
type
;
/**
* $column.comments
*/
private
Integer
levels
;
/**
* $column.comments
*/
private
String
author
;
/**
* $column.comments
*/
private
Integer
status
;
/**
* $column.comments
*/
private
String
auditor
;
}
src/main/java/io/office/modules/manage/service/PcategoryService.java
View file @
f80999e3
...
...
@@ -6,6 +6,7 @@ import io.office.common.utils.R;
import
io.office.modules.manage.entity.PcategoryEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -21,5 +22,7 @@ public interface PcategoryService extends IService<PcategoryEntity> {
R
insertPcategory
(
PcategoryEntity
pcategory
,
SysUserEntity
user
);
R
updatePcategory
(
PcategoryEntity
pcategory
,
SysUserEntity
user
);
List
<
PcategoryEntity
>
getCategoryList
(
Map
<
String
,
Object
>
params
);
}
src/main/java/io/office/modules/manage/service/ProductService.java
0 → 100644
View file @
f80999e3
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.ProductEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.List
;
import
java.util.Map
;
/**
* ${comments}
*
* @author rkl
* @email
* @date 2021-11-14 22:56:51
*/
public
interface
ProductService
extends
IService
<
ProductEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
R
insertProduct
(
ProductEntity
product
,
SysUserEntity
user
);
R
deleteProduct
(
List
<
Long
>
ids
,
SysUserEntity
user
);
}
src/main/java/io/office/modules/manage/service/impl/PcategoryServiceImpl.java
View file @
f80999e3
...
...
@@ -6,6 +6,7 @@ import io.office.modules.sys.entity.SysUserEntity;
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
;
...
...
@@ -53,4 +54,11 @@ public class PcategoryServiceImpl extends ServiceImpl<PcategoryDao, PcategoryEnt
}
}
@Override
public
List
<
PcategoryEntity
>
getCategoryList
(
Map
<
String
,
Object
>
params
)
{
QueryWrapper
<
PcategoryEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
List
<
PcategoryEntity
>
list
=
this
.
baseMapper
.
selectList
(
newsEntityQueryWrapper
);
return
list
;
}
}
\ No newline at end of file
src/main/java/io/office/modules/manage/service/impl/ProductServiceImpl.java
0 → 100644
View file @
f80999e3
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.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.ProductDao
;
import
io.office.modules.manage.entity.ProductEntity
;
import
io.office.modules.manage.service.ProductService
;
@Service
(
"productService"
)
public
class
ProductServiceImpl
extends
ServiceImpl
<
ProductDao
,
ProductEntity
>
implements
ProductService
{
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
ProductEntity
>
page
=
this
.
page
(
new
Query
<
ProductEntity
>().
getPage
(
params
),
new
QueryWrapper
<
ProductEntity
>()
);
return
new
PageUtils
(
page
);
}
@Override
public
R
insertProduct
(
ProductEntity
product
,
SysUserEntity
user
)
{
product
.
setAdddate
(
new
Date
());
int
insert
=
baseMapper
.
insert
(
product
);
if
(
insert
>
0
){
return
R
.
ok
(
"新增成功!"
);
}
else
{
return
R
.
error
(
"新增失败!"
);
}
}
@Override
public
R
deleteProduct
(
List
<
Long
>
ids
,
SysUserEntity
user
)
{
ProductEntity
product
=
new
ProductEntity
();
product
.
setLevels
(
0
);
QueryWrapper
<
ProductEntity
>
newsEntityQueryWrapper
=
new
QueryWrapper
<>();
newsEntityQueryWrapper
.
in
(
"id"
,
ids
);
int
delete
=
baseMapper
.
update
(
product
,
newsEntityQueryWrapper
);
if
(
delete
>
0
){
return
R
.
ok
(
"删除成功!"
);
}
else
{
return
R
.
error
(
"删除失败!"
);
}
}
}
\ No newline at end of file
src/main/resources/mapper/manage/ProductDao.xml
0 → 100644
View file @
f80999e3
<?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.ProductDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"io.office.modules.manage.entity.ProductEntity"
id=
"productMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"prename"
column=
"prename"
/>
<result
property=
"company"
column=
"company"
/>
<result
property=
"intro"
column=
"intro"
/>
<result
property=
"predate"
column=
"predate"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"pretype"
column=
"pretype"
/>
<result
property=
"other"
column=
"other"
/>
<result
property=
"graph2"
column=
"graph2"
/>
<result
property=
"addlink"
column=
"addlink"
/>
<result
property=
"prestock"
column=
"prestock"
/>
<result
property=
"graph"
column=
"graph"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"remarks"
column=
"remarks"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"introduce"
column=
"introduce"
/>
<result
property=
"productdate"
column=
"productdate"
/>
<result
property=
"score"
column=
"score"
/>
<result
property=
"grade"
column=
"grade"
/>
<result
property=
"photo"
column=
"photo"
/>
<result
property=
"recommend"
column=
"recommend"
/>
<result
property=
"solded"
column=
"solded"
/>
<result
property=
"viewnum"
column=
"viewnum"
/>
<result
property=
"discount"
column=
"discount"
/>
<result
property=
"sortsid"
column=
"sortsid"
/>
<result
property=
"categoryid"
column=
"categoryid"
/>
<result
property=
"pic"
column=
"pic"
/>
<result
property=
"makein"
column=
"makein"
/>
<result
property=
"adddate"
column=
"adddate"
/>
<result
property=
"ranknum"
column=
"ranknum"
/>
<result
property=
"vipprice"
column=
"vipprice"
/>
<result
property=
"amount"
column=
"amount"
/>
<result
property=
"stock"
column=
"stock"
/>
<result
property=
"link"
column=
"link"
/>
<result
property=
"mark"
column=
"mark"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"levels"
column=
"levels"
/>
<result
property=
"author"
column=
"author"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"auditor"
column=
"auditor"
/>
</resultMap>
</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