Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
53092ef9
Commit
53092ef9
authored
Oct 17, 2018
by
zhh
Browse files
添加退货原因管理接口
parent
9523e3ac
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
document/pdm/mall.pdb
View file @
53092ef9
This diff is collapsed.
Click to expand it.
document/pdm/mall.pdm
View file @
53092ef9
This diff is collapsed.
Click to expand it.
mall-admin/src/main/java/com/macro/mall/controller/OmsOrderReturnReasonController.java
0 → 100644
View file @
53092ef9
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.model.OmsOrderReturnReason
;
import
com.macro.mall.service.OmsOrderReturnReasonService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* 退货原因管理Controller
* Created by macro on 2018/10/17.
*/
@Controller
@Api
(
tags
=
"OmsOrderReturnReasonController"
,
description
=
"退货原因管理"
)
@RequestMapping
(
"/returnReason"
)
public
class
OmsOrderReturnReasonController
{
@Autowired
private
OmsOrderReturnReasonService
orderReturnReasonService
;
@ApiOperation
(
"添加退货原因"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
create
(
@RequestBody
OmsOrderReturnReason
returnReason
)
{
int
count
=
orderReturnReasonService
.
create
(
returnReason
);
if
(
count
>
0
){
return
new
CommonResult
().
success
(
count
);
}
return
new
CommonResult
().
failed
();
}
@ApiOperation
(
"修改退货原因"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
update
(
@PathVariable
Long
id
,
@RequestBody
OmsOrderReturnReason
returnReason
)
{
int
count
=
orderReturnReasonService
.
update
(
id
,
returnReason
);
if
(
count
>
0
){
return
new
CommonResult
().
success
(
count
);
}
return
new
CommonResult
().
failed
();
}
@ApiOperation
(
"批量删除退货原因"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
orderReturnReasonService
.
delete
(
ids
);
if
(
count
>
0
){
return
new
CommonResult
().
success
(
count
);
}
return
new
CommonResult
().
failed
();
}
@ApiOperation
(
"分页查询全部退货原因"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
OmsOrderReturnReason
>
reasonList
=
orderReturnReasonService
.
list
(
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
reasonList
);
}
@ApiOperation
(
"获取单个退货原因详情信息"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
OmsOrderReturnReason
reason
=
orderReturnReasonService
.
getItem
(
id
);
return
new
CommonResult
().
success
(
reason
);
}
@ApiOperation
(
"修改退货原因启用状态"
)
@RequestMapping
(
value
=
"/update/status"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
updateStatus
(
@RequestParam
(
value
=
"status"
)
Integer
status
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
orderReturnReasonService
.
updateStatus
(
ids
,
status
);
if
(
count
>
0
){
return
new
CommonResult
().
success
(
count
);
}
return
new
CommonResult
().
failed
();
}
}
mall-admin/src/main/java/com/macro/mall/service/OmsOrderReturnReasonService.java
0 → 100644
View file @
53092ef9
package
com.macro.mall.service
;
import
com.macro.mall.model.OmsOrderReturnReason
;
import
java.util.List
;
/**
* 订单原因管理Service
* Created by macro on 2018/10/17.
*/
public
interface
OmsOrderReturnReasonService
{
/**
* 添加订单原因
*/
int
create
(
OmsOrderReturnReason
returnReason
);
/**
* 修改退货原因
*/
int
update
(
Long
id
,
OmsOrderReturnReason
returnReason
);
/**
* 批量删除退货原因
*/
int
delete
(
List
<
Long
>
ids
);
/**
* 分页获取退货原因
*/
List
<
OmsOrderReturnReason
>
list
(
Integer
pageSize
,
Integer
pageNum
);
/**
* 批量修改退货原因状态
*/
int
updateStatus
(
List
<
Long
>
ids
,
Integer
status
);
/**
* 获取单个退货原因详情信息
*/
OmsOrderReturnReason
getItem
(
Long
id
);
}
mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderReturnReasonServiceImpl.java
0 → 100644
View file @
53092ef9
package
com.macro.mall.service.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.macro.mall.mapper.OmsOrderReturnReasonMapper
;
import
com.macro.mall.model.OmsOrderReturnReason
;
import
com.macro.mall.model.OmsOrderReturnReasonExample
;
import
com.macro.mall.service.OmsOrderReturnReasonService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单原因管理Service实现类
* Created by macro on 2018/10/17.
*/
@Service
public
class
OmsOrderReturnReasonServiceImpl
implements
OmsOrderReturnReasonService
{
@Autowired
private
OmsOrderReturnReasonMapper
returnReasonMapper
;
@Override
public
int
create
(
OmsOrderReturnReason
returnReason
)
{
returnReason
.
setCreateTime
(
new
Date
());
return
returnReasonMapper
.
insert
(
returnReason
);
}
@Override
public
int
update
(
Long
id
,
OmsOrderReturnReason
returnReason
)
{
returnReason
.
setId
(
id
);
return
returnReasonMapper
.
updateByPrimaryKey
(
returnReason
);
}
@Override
public
int
delete
(
List
<
Long
>
ids
)
{
OmsOrderReturnReasonExample
example
=
new
OmsOrderReturnReasonExample
();
example
.
createCriteria
().
andIdIn
(
ids
);
return
returnReasonMapper
.
deleteByExample
(
example
);
}
@Override
public
List
<
OmsOrderReturnReason
>
list
(
Integer
pageSize
,
Integer
pageNum
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
OmsOrderReturnReasonExample
example
=
new
OmsOrderReturnReasonExample
();
example
.
setOrderByClause
(
"sort desc"
);
return
returnReasonMapper
.
selectByExample
(
example
);
}
@Override
public
int
updateStatus
(
List
<
Long
>
ids
,
Integer
status
)
{
if
(!
status
.
equals
(
0
)&&!
status
.
equals
(
1
)){
return
0
;
}
OmsOrderReturnReason
record
=
new
OmsOrderReturnReason
();
record
.
setStatus
(
status
);
OmsOrderReturnReasonExample
example
=
new
OmsOrderReturnReasonExample
();
example
.
createCriteria
().
andIdIn
(
ids
);
return
returnReasonMapper
.
updateByExampleSelective
(
record
,
example
);
}
@Override
public
OmsOrderReturnReason
getItem
(
Long
id
)
{
return
returnReasonMapper
.
selectByPrimaryKey
(
id
);
}
}
Write
Preview
Supports
Markdown
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