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
69f45679
Commit
69f45679
authored
Nov 13, 2021
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】商品分类新增修改删除
parent
34c05225
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
247 additions
and
0 deletions
+247
-0
PcategoryController.java
...office/modules/manage/controller/PcategoryController.java
+100
-0
PcategoryDao.java
src/main/java/io/office/modules/manage/dao/PcategoryDao.java
+17
-0
PcategoryEntity.java
...java/io/office/modules/manage/entity/PcategoryEntity.java
+48
-0
PcategoryService.java
...va/io/office/modules/manage/service/PcategoryService.java
+25
-0
PcategoryServiceImpl.java
...ice/modules/manage/service/impl/PcategoryServiceImpl.java
+57
-0
No files found.
src/main/java/io/office/modules/manage/controller/PcategoryController.java
0 → 100644
View file @
69f45679
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/dao/PcategoryDao.java
0 → 100644
View file @
69f45679
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/entity/PcategoryEntity.java
0 → 100644
View file @
69f45679
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/service/PcategoryService.java
0 → 100644
View file @
69f45679
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/impl/PcategoryServiceImpl.java
0 → 100644
View file @
69f45679
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
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