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
5262a232
Commit
5262a232
authored
Apr 20, 2019
by
macro
Browse files
mall-admin代码改造
parent
b5800856
Changes
37
Show whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/controller/SmsFlashPromotionProductRelationController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.SmsFlashPromotionProduct
;
import
com.macro.mall.dto.SmsFlashPromotionProduct
;
import
com.macro.mall.model.SmsFlashPromotionProductRelation
;
import
com.macro.mall.model.SmsFlashPromotionProductRelation
;
import
com.macro.mall.service.SmsFlashPromotionProductRelationService
;
import
com.macro.mall.service.SmsFlashPromotionProductRelationService
;
...
@@ -22,55 +23,56 @@ import java.util.List;
...
@@ -22,55 +23,56 @@ import java.util.List;
public
class
SmsFlashPromotionProductRelationController
{
public
class
SmsFlashPromotionProductRelationController
{
@Autowired
@Autowired
private
SmsFlashPromotionProductRelationService
relationService
;
private
SmsFlashPromotionProductRelationService
relationService
;
@ApiOperation
(
"批量选择商品添加关联"
)
@ApiOperation
(
"批量选择商品添加关联"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
List
<
SmsFlashPromotionProductRelation
>
relationList
)
{
public
CommonResul
t
create
(
@RequestBody
List
<
SmsFlashPromotionProductRelation
>
relationList
)
{
int
count
=
relationService
.
create
(
relationList
);
int
count
=
relationService
.
create
(
relationList
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改关联相关信息"
)
@ApiOperation
(
"修改关联相关信息"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsFlashPromotionProductRelation
relation
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsFlashPromotionProductRelation
relation
)
{
int
count
=
relationService
.
update
(
id
,
relation
);
int
count
=
relationService
.
update
(
id
,
relation
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"删除关联"
)
@ApiOperation
(
"删除关联"
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@PathVariable
Long
id
)
{
public
CommonResul
t
delete
(
@PathVariable
Long
id
)
{
int
count
=
relationService
.
delete
(
id
);
int
count
=
relationService
.
delete
(
id
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取管理商品促销信息"
)
@ApiOperation
(
"获取管理商品促销信息"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
SmsFlashPromotionProductRelation
>
getItem
(
@PathVariable
Long
id
)
{
SmsFlashPromotionProductRelation
relation
=
relationService
.
getItem
(
id
);
SmsFlashPromotionProductRelation
relation
=
relationService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
relation
);
return
CommonResult
.
success
(
relation
);
}
}
@ApiOperation
(
"分页查询不同场次关联及商品信息"
)
@ApiOperation
(
"分页查询不同场次关联及商品信息"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"flashPromotionId"
)
Long
flashPromotionId
,
public
CommonResult
<
CommonPage
<
SmsFlashPromotionProduct
>>
list
(
@RequestParam
(
value
=
"flashPromotionId"
)
Long
flashPromotionId
,
@RequestParam
(
value
=
"flashPromotionSessionId"
)
Long
flashPromotionSessionId
,
@RequestParam
(
value
=
"flashPromotionSessionId"
)
Long
flashPromotionSessionId
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsFlashPromotionProduct
>
flashPromotionProductList
=
relationService
.
list
(
flashPromotionId
,
flashPromotionSessionId
,
pageSize
,
pageNum
);
List
<
SmsFlashPromotionProduct
>
flashPromotionProductList
=
relationService
.
list
(
flashPromotionId
,
flashPromotionSessionId
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
flashPromotionProductList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
flashPromotionProductList
)
)
;
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsFlashPromotionSessionController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.dto.SmsFlashPromotionSessionDetail
;
import
com.macro.mall.dto.SmsFlashPromotionSessionDetail
;
import
com.macro.mall.model.SmsFlashPromotionSession
;
import
com.macro.mall.model.SmsFlashPromotionSession
;
import
com.macro.mall.service.SmsFlashPromotionSessionService
;
import
com.macro.mall.service.SmsFlashPromotionSessionService
;
...
@@ -22,71 +22,72 @@ import java.util.List;
...
@@ -22,71 +22,72 @@ import java.util.List;
public
class
SmsFlashPromotionSessionController
{
public
class
SmsFlashPromotionSessionController
{
@Autowired
@Autowired
private
SmsFlashPromotionSessionService
flashPromotionSessionService
;
private
SmsFlashPromotionSessionService
flashPromotionSessionService
;
@ApiOperation
(
"添加场次"
)
@ApiOperation
(
"添加场次"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
SmsFlashPromotionSession
promotionSession
)
{
public
CommonResul
t
create
(
@RequestBody
SmsFlashPromotionSession
promotionSession
)
{
int
count
=
flashPromotionSessionService
.
create
(
promotionSession
);
int
count
=
flashPromotionSessionService
.
create
(
promotionSession
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改场次"
)
@ApiOperation
(
"修改场次"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsFlashPromotionSession
promotionSession
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsFlashPromotionSession
promotionSession
)
{
int
count
=
flashPromotionSessionService
.
update
(
id
,
promotionSession
);
int
count
=
flashPromotionSessionService
.
update
(
id
,
promotionSession
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改启用状态"
)
@ApiOperation
(
"修改启用状态"
)
@RequestMapping
(
value
=
"/update/status/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/status/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateStatus
(
@PathVariable
Long
id
,
Integer
status
)
{
public
CommonResul
t
updateStatus
(
@PathVariable
Long
id
,
Integer
status
)
{
int
count
=
flashPromotionSessionService
.
updateStatus
(
id
,
status
);
int
count
=
flashPromotionSessionService
.
updateStatus
(
id
,
status
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"删除场次"
)
@ApiOperation
(
"删除场次"
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@PathVariable
Long
id
)
{
public
CommonResul
t
delete
(
@PathVariable
Long
id
)
{
int
count
=
flashPromotionSessionService
.
delete
(
id
);
int
count
=
flashPromotionSessionService
.
delete
(
id
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取场次详情"
)
@ApiOperation
(
"获取场次详情"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
SmsFlashPromotionSession
>
getItem
(
@PathVariable
Long
id
)
{
SmsFlashPromotionSession
promotionSession
=
flashPromotionSessionService
.
getItem
(
id
);
SmsFlashPromotionSession
promotionSession
=
flashPromotionSessionService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
promotionSession
);
return
CommonResult
.
success
(
promotionSession
);
}
}
@ApiOperation
(
"获取全部场次"
)
@ApiOperation
(
"获取全部场次"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
()
{
public
CommonResult
<
List
<
SmsFlashPromotionSession
>>
list
()
{
List
<
SmsFlashPromotionSession
>
promotionSessionList
=
flashPromotionSessionService
.
list
();
List
<
SmsFlashPromotionSession
>
promotionSessionList
=
flashPromotionSessionService
.
list
();
return
new
CommonResult
()
.
success
(
promotionSessionList
);
return
CommonResult
.
success
(
promotionSessionList
);
}
}
@ApiOperation
(
"获取全部可选场次及其数量"
)
@ApiOperation
(
"获取全部可选场次及其数量"
)
@RequestMapping
(
value
=
"/selectList"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/selectList"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
selectList
(
Long
flashPromotionId
)
{
public
CommonResult
<
List
<
SmsFlashPromotionSessionDetail
>>
selectList
(
Long
flashPromotionId
)
{
List
<
SmsFlashPromotionSessionDetail
>
promotionSessionList
=
flashPromotionSessionService
.
selectList
(
flashPromotionId
);
List
<
SmsFlashPromotionSessionDetail
>
promotionSessionList
=
flashPromotionSessionService
.
selectList
(
flashPromotionId
);
return
new
CommonResult
()
.
success
(
promotionSessionList
);
return
CommonResult
.
success
(
promotionSessionList
);
}
}
}
}
\ No newline at end of file
mall-admin/src/main/java/com/macro/mall/controller/SmsHomeAdvertiseController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.SmsHomeAdvertise
;
import
com.macro.mall.model.SmsHomeAdvertise
;
import
com.macro.mall.service.SmsHomeAdvertiseService
;
import
com.macro.mall.service.SmsHomeAdvertiseService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -25,60 +26,60 @@ public class SmsHomeAdvertiseController {
...
@@ -25,60 +26,60 @@ public class SmsHomeAdvertiseController {
@ApiOperation
(
"添加广告"
)
@ApiOperation
(
"添加广告"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
SmsHomeAdvertise
advertise
)
{
public
CommonResul
t
create
(
@RequestBody
SmsHomeAdvertise
advertise
)
{
int
count
=
advertiseService
.
create
(
advertise
);
int
count
=
advertiseService
.
create
(
advertise
);
if
(
count
>
0
)
if
(
count
>
0
)
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"删除广告"
)
@ApiOperation
(
"删除广告"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
advertiseService
.
delete
(
ids
);
int
count
=
advertiseService
.
delete
(
ids
);
if
(
count
>
0
)
if
(
count
>
0
)
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改上下线状态"
)
@ApiOperation
(
"修改上下线状态"
)
@RequestMapping
(
value
=
"/update/status/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/status/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateStatus
(
@PathVariable
Long
id
,
Integer
status
)
{
public
CommonResul
t
updateStatus
(
@PathVariable
Long
id
,
Integer
status
)
{
int
count
=
advertiseService
.
updateStatus
(
id
,
status
);
int
count
=
advertiseService
.
updateStatus
(
id
,
status
);
if
(
count
>
0
)
if
(
count
>
0
)
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取广告详情"
)
@ApiOperation
(
"获取广告详情"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
)
{
public
CommonResult
<
SmsHomeAdvertise
>
getItem
(
@PathVariable
Long
id
)
{
SmsHomeAdvertise
advertise
=
advertiseService
.
getItem
(
id
);
SmsHomeAdvertise
advertise
=
advertiseService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
advertise
);
return
CommonResult
.
success
(
advertise
);
}
}
@ApiOperation
(
"修改广告"
)
@ApiOperation
(
"修改广告"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsHomeAdvertise
advertise
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
SmsHomeAdvertise
advertise
)
{
int
count
=
advertiseService
.
update
(
id
,
advertise
);
int
count
=
advertiseService
.
update
(
id
,
advertise
);
if
(
count
>
0
)
if
(
count
>
0
)
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"分页查询广告"
)
@ApiOperation
(
"分页查询广告"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
public
CommonResult
<
CommonPage
<
SmsHomeAdvertise
>>
list
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
Integer
type
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
,
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsHomeAdvertise
>
advertiseList
=
advertiseService
.
list
(
name
,
type
,
endTime
,
pageSize
,
pageNum
);
List
<
SmsHomeAdvertise
>
advertiseList
=
advertiseService
.
list
(
name
,
type
,
endTime
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
advertiseList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
advertiseList
)
)
;
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsHomeBrandController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.SmsHomeBrand
;
import
com.macro.mall.model.SmsHomeBrand
;
import
com.macro.mall.service.SmsHomeBrandService
;
import
com.macro.mall.service.SmsHomeBrandService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -21,58 +22,59 @@ import java.util.List;
...
@@ -21,58 +22,59 @@ import java.util.List;
public
class
SmsHomeBrandController
{
public
class
SmsHomeBrandController
{
@Autowired
@Autowired
private
SmsHomeBrandService
homeBrandService
;
private
SmsHomeBrandService
homeBrandService
;
@ApiOperation
(
"添加首页推荐品牌"
)
@ApiOperation
(
"添加首页推荐品牌"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
List
<
SmsHomeBrand
>
homeBrandList
)
{
public
CommonResul
t
create
(
@RequestBody
List
<
SmsHomeBrand
>
homeBrandList
)
{
int
count
=
homeBrandService
.
create
(
homeBrandList
);
int
count
=
homeBrandService
.
create
(
homeBrandList
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改品牌排序"
)
@ApiOperation
(
"修改品牌排序"
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
public
CommonResul
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
int
count
=
homeBrandService
.
updateSort
(
id
,
sort
);
int
count
=
homeBrandService
.
updateSort
(
id
,
sort
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量删除推荐品牌"
)
@ApiOperation
(
"批量删除推荐品牌"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
homeBrandService
.
delete
(
ids
);
int
count
=
homeBrandService
.
delete
(
ids
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量修改推荐状态"
)
@ApiOperation
(
"批量修改推荐状态"
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
public
CommonResul
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
int
count
=
homeBrandService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
int
count
=
homeBrandService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"分页查询推荐品牌"
)
@ApiOperation
(
"分页查询推荐品牌"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"brandName"
,
required
=
false
)
String
brandName
,
public
CommonResult
<
CommonPage
<
SmsHomeBrand
>>
list
(
@RequestParam
(
value
=
"brandName"
,
required
=
false
)
String
brandName
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsHomeBrand
>
homeBrandList
=
homeBrandService
.
list
(
brandName
,
recommendStatus
,
pageSize
,
pageNum
);
List
<
SmsHomeBrand
>
homeBrandList
=
homeBrandService
.
list
(
brandName
,
recommendStatus
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
homeBrandList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
homeBrandList
)
)
;
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsHomeNewProductController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.SmsHomeNewProduct
;
import
com.macro.mall.model.SmsHomeNewProduct
;
import
com.macro.mall.service.SmsHomeNewProductService
;
import
com.macro.mall.service.SmsHomeNewProductService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -21,58 +22,59 @@ import java.util.List;
...
@@ -21,58 +22,59 @@ import java.util.List;
public
class
SmsHomeNewProductController
{
public
class
SmsHomeNewProductController
{
@Autowired
@Autowired
private
SmsHomeNewProductService
homeNewProductService
;
private
SmsHomeNewProductService
homeNewProductService
;
@ApiOperation
(
"添加首页推荐品牌"
)
@ApiOperation
(
"添加首页推荐品牌"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
List
<
SmsHomeNewProduct
>
homeBrandList
)
{
public
CommonResul
t
create
(
@RequestBody
List
<
SmsHomeNewProduct
>
homeBrandList
)
{
int
count
=
homeNewProductService
.
create
(
homeBrandList
);
int
count
=
homeNewProductService
.
create
(
homeBrandList
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改推荐排序"
)
@ApiOperation
(
"修改推荐排序"
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
public
CommonResul
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
int
count
=
homeNewProductService
.
updateSort
(
id
,
sort
);
int
count
=
homeNewProductService
.
updateSort
(
id
,
sort
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量删除推荐"
)
@ApiOperation
(
"批量删除推荐"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
homeNewProductService
.
delete
(
ids
);
int
count
=
homeNewProductService
.
delete
(
ids
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量修改推荐状态"
)
@ApiOperation
(
"批量修改推荐状态"
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
public
CommonResul
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
int
count
=
homeNewProductService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
int
count
=
homeNewProductService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"分页查询推荐"
)
@ApiOperation
(
"分页查询推荐"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"productName"
,
required
=
false
)
String
productName
,
public
CommonResult
<
CommonPage
<
SmsHomeNewProduct
>>
list
(
@RequestParam
(
value
=
"productName"
,
required
=
false
)
String
productName
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsHomeNewProduct
>
homeBrandList
=
homeNewProductService
.
list
(
productName
,
recommendStatus
,
pageSize
,
pageNum
);
List
<
SmsHomeNewProduct
>
homeBrandList
=
homeNewProductService
.
list
(
productName
,
recommendStatus
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
homeBrandList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
homeBrandList
)
)
;
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsHomeRecommendProductController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.SmsHomeRecommendProduct
;
import
com.macro.mall.model.SmsHomeRecommendProduct
;
import
com.macro.mall.service.SmsHomeRecommendProductService
;
import
com.macro.mall.service.SmsHomeRecommendProductService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -21,58 +22,59 @@ import java.util.List;
...
@@ -21,58 +22,59 @@ import java.util.List;
public
class
SmsHomeRecommendProductController
{
public
class
SmsHomeRecommendProductController
{
@Autowired
@Autowired
private
SmsHomeRecommendProductService
recommendProductService
;
private
SmsHomeRecommendProductService
recommendProductService
;
@ApiOperation
(
"添加首页推荐"
)
@ApiOperation
(
"添加首页推荐"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
List
<
SmsHomeRecommendProduct
>
homeBrandList
)
{
public
CommonResul
t
create
(
@RequestBody
List
<
SmsHomeRecommendProduct
>
homeBrandList
)
{
int
count
=
recommendProductService
.
create
(
homeBrandList
);
int
count
=
recommendProductService
.
create
(
homeBrandList
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改推荐排序"
)
@ApiOperation
(
"修改推荐排序"
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
public
CommonResul
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
int
count
=
recommendProductService
.
updateSort
(
id
,
sort
);
int
count
=
recommendProductService
.
updateSort
(
id
,
sort
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量删除推荐"
)
@ApiOperation
(
"批量删除推荐"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
recommendProductService
.
delete
(
ids
);
int
count
=
recommendProductService
.
delete
(
ids
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量修改推荐状态"
)
@ApiOperation
(
"批量修改推荐状态"
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
public
CommonResul
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
int
count
=
recommendProductService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
int
count
=
recommendProductService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"分页查询推荐"
)
@ApiOperation
(
"分页查询推荐"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"productName"
,
required
=
false
)
String
productName
,
public
CommonResult
<
CommonPage
<
SmsHomeRecommendProduct
>>
list
(
@RequestParam
(
value
=
"productName"
,
required
=
false
)
String
productName
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsHomeRecommendProduct
>
homeBrandList
=
recommendProductService
.
list
(
productName
,
recommendStatus
,
pageSize
,
pageNum
);
List
<
SmsHomeRecommendProduct
>
homeBrandList
=
recommendProductService
.
list
(
productName
,
recommendStatus
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
homeBrandList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
homeBrandList
)
)
;
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/SmsHomeRecommendSubjectController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.model.SmsHomeRecommendSubject
;
import
com.macro.mall.model.SmsHomeRecommendSubject
;
import
com.macro.mall.service.SmsHomeRecommendSubjectService
;
import
com.macro.mall.service.SmsHomeRecommendSubjectService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -21,58 +22,59 @@ import java.util.List;
...
@@ -21,58 +22,59 @@ import java.util.List;
public
class
SmsHomeRecommendSubjectController
{
public
class
SmsHomeRecommendSubjectController
{
@Autowired
@Autowired
private
SmsHomeRecommendSubjectService
recommendSubjectService
;
private
SmsHomeRecommendSubjectService
recommendSubjectService
;
@ApiOperation
(
"添加首页推荐专题"
)
@ApiOperation
(
"添加首页推荐专题"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
List
<
SmsHomeRecommendSubject
>
homeBrandList
)
{
public
CommonResul
t
create
(
@RequestBody
List
<
SmsHomeRecommendSubject
>
homeBrandList
)
{
int
count
=
recommendSubjectService
.
create
(
homeBrandList
);
int
count
=
recommendSubjectService
.
create
(
homeBrandList
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改推荐排序"
)
@ApiOperation
(
"修改推荐排序"
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/sort/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
public
CommonResul
t
updateSort
(
@PathVariable
Long
id
,
Integer
sort
)
{
int
count
=
recommendSubjectService
.
updateSort
(
id
,
sort
);
int
count
=
recommendSubjectService
.
updateSort
(
id
,
sort
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量删除推荐"
)
@ApiOperation
(
"批量删除推荐"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
recommendSubjectService
.
delete
(
ids
);
int
count
=
recommendSubjectService
.
delete
(
ids
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量修改推荐状态"
)
@ApiOperation
(
"批量修改推荐状态"
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/recommendStatus"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
public
CommonResul
t
updateRecommendStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
Integer
recommendStatus
)
{
int
count
=
recommendSubjectService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
int
count
=
recommendSubjectService
.
updateRecommendStatus
(
ids
,
recommendStatus
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"分页查询推荐"
)
@ApiOperation
(
"分页查询推荐"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
O
bject
list
(
@RequestParam
(
value
=
"subjectName"
,
required
=
false
)
String
subjectName
,
public
CommonResult
<
CommonPage
<
SmsHomeRecommendSu
bject
>>
list
(
@RequestParam
(
value
=
"subjectName"
,
required
=
false
)
String
subjectName
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"recommendStatus"
,
required
=
false
)
Integer
recommendStatus
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
SmsHomeRecommendSubject
>
homeBrandList
=
recommendSubjectService
.
list
(
subjectName
,
recommendStatus
,
pageSize
,
pageNum
);
List
<
SmsHomeRecommendSubject
>
homeBrandList
=
recommendSubjectService
.
list
(
subjectName
,
recommendStatus
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
homeBrandList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
homeBrandList
)
)
;
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/UmsAdminController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.common.api.CommonPage
;
import
com.macro.mall.common.api.CommonResult
;
import
com.macro.mall.dto.UmsAdminLoginParam
;
import
com.macro.mall.dto.UmsAdminLoginParam
;
import
com.macro.mall.dto.UmsAdminParam
;
import
com.macro.mall.dto.UmsAdminParam
;
import
com.macro.mall.model.UmsAdmin
;
import
com.macro.mall.model.UmsAdmin
;
...
@@ -39,140 +40,140 @@ public class UmsAdminController {
...
@@ -39,140 +40,140 @@ public class UmsAdminController {
@ApiOperation
(
value
=
"用户注册"
)
@ApiOperation
(
value
=
"用户注册"
)
@RequestMapping
(
value
=
"/register"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/register"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Object
register
(
@RequestBody
UmsAdminParam
umsAdminParam
,
BindingResult
result
)
{
public
CommonResult
<
UmsAdmin
>
register
(
@RequestBody
UmsAdminParam
umsAdminParam
,
BindingResult
result
)
{
UmsAdmin
umsAdmin
=
adminService
.
register
(
umsAdminParam
);
UmsAdmin
umsAdmin
=
adminService
.
register
(
umsAdminParam
);
if
(
umsAdmin
==
null
)
{
if
(
umsAdmin
==
null
)
{
new
CommonResult
()
.
failed
();
CommonResult
.
failed
();
}
}
return
new
CommonResult
()
.
success
(
umsAdmin
);
return
CommonResult
.
success
(
umsAdmin
);
}
}
@ApiOperation
(
value
=
"登录以后返回token"
)
@ApiOperation
(
value
=
"登录以后返回token"
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
login
(
@RequestBody
UmsAdminLoginParam
umsAdminLoginParam
,
BindingResult
result
)
{
public
CommonResul
t
login
(
@RequestBody
UmsAdminLoginParam
umsAdminLoginParam
,
BindingResult
result
)
{
String
token
=
adminService
.
login
(
umsAdminLoginParam
.
getUsername
(),
umsAdminLoginParam
.
getPassword
());
String
token
=
adminService
.
login
(
umsAdminLoginParam
.
getUsername
(),
umsAdminLoginParam
.
getPassword
());
if
(
token
==
null
)
{
if
(
token
==
null
)
{
return
new
CommonResult
()
.
validateFailed
(
"用户名或密码错误"
);
return
CommonResult
.
validateFailed
(
"用户名或密码错误"
);
}
}
Map
<
String
,
String
>
tokenMap
=
new
HashMap
<>();
Map
<
String
,
String
>
tokenMap
=
new
HashMap
<>();
tokenMap
.
put
(
"token"
,
token
);
tokenMap
.
put
(
"token"
,
token
);
tokenMap
.
put
(
"tokenHead"
,
tokenHead
);
tokenMap
.
put
(
"tokenHead"
,
tokenHead
);
return
new
CommonResult
()
.
success
(
tokenMap
);
return
CommonResult
.
success
(
tokenMap
);
}
}
@ApiOperation
(
value
=
"刷新token"
)
@ApiOperation
(
value
=
"刷新token"
)
@RequestMapping
(
value
=
"/token/refresh"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/token/refresh"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Objec
t
refreshToken
(
HttpServletRequest
request
)
{
public
CommonResul
t
refreshToken
(
HttpServletRequest
request
)
{
String
token
=
request
.
getHeader
(
tokenHeader
);
String
token
=
request
.
getHeader
(
tokenHeader
);
String
refreshToken
=
adminService
.
refreshToken
(
token
);
String
refreshToken
=
adminService
.
refreshToken
(
token
);
if
(
refreshToken
==
null
)
{
if
(
refreshToken
==
null
)
{
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
Map
<
String
,
String
>
tokenMap
=
new
HashMap
<>();
Map
<
String
,
String
>
tokenMap
=
new
HashMap
<>();
tokenMap
.
put
(
"token"
,
refreshToken
);
tokenMap
.
put
(
"token"
,
refreshToken
);
tokenMap
.
put
(
"tokenHead"
,
tokenHead
);
tokenMap
.
put
(
"tokenHead"
,
tokenHead
);
return
new
CommonResult
()
.
success
(
tokenMap
);
return
CommonResult
.
success
(
tokenMap
);
}
}
@ApiOperation
(
value
=
"获取当前登录用户信息"
)
@ApiOperation
(
value
=
"获取当前登录用户信息"
)
@RequestMapping
(
value
=
"/info"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/info"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Objec
t
getAdminInfo
(
Principal
principal
)
{
public
CommonResul
t
getAdminInfo
(
Principal
principal
)
{
String
username
=
principal
.
getName
();
String
username
=
principal
.
getName
();
UmsAdmin
umsAdmin
=
adminService
.
getAdminByUsername
(
username
);
UmsAdmin
umsAdmin
=
adminService
.
getAdminByUsername
(
username
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"username"
,
umsAdmin
.
getUsername
());
data
.
put
(
"username"
,
umsAdmin
.
getUsername
());
data
.
put
(
"roles"
,
new
String
[]{
"TEST"
});
data
.
put
(
"roles"
,
new
String
[]{
"TEST"
});
data
.
put
(
"icon"
,
umsAdmin
.
getIcon
());
data
.
put
(
"icon"
,
umsAdmin
.
getIcon
());
return
new
CommonResult
()
.
success
(
data
);
return
CommonResult
.
success
(
data
);
}
}
@ApiOperation
(
value
=
"登出功能"
)
@ApiOperation
(
value
=
"登出功能"
)
@RequestMapping
(
value
=
"/logout"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/logout"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
logout
()
{
public
CommonResul
t
logout
()
{
return
new
CommonResult
()
.
success
(
null
);
return
CommonResult
.
success
(
null
);
}
}
@ApiOperation
(
"根据用户名或姓名分页获取用户列表"
)
@ApiOperation
(
"根据用户名或姓名分页获取用户列表"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
public
CommonResult
<
CommonPage
<
UmsAdmin
>>
list
(
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
){
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
)
{
List
<
UmsAdmin
>
adminList
=
adminService
.
list
(
name
,
pageSize
,
pageNum
);
List
<
UmsAdmin
>
adminList
=
adminService
.
list
(
name
,
pageSize
,
pageNum
);
return
new
CommonResult
().
pageSuccess
(
adminList
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
adminList
)
)
;
}
}
@ApiOperation
(
"获取指定用户信息"
)
@ApiOperation
(
"获取指定用户信息"
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
getItem
(
@PathVariable
Long
id
){
public
CommonResult
<
UmsAdmin
>
getItem
(
@PathVariable
Long
id
)
{
UmsAdmin
admin
=
adminService
.
getItem
(
id
);
UmsAdmin
admin
=
adminService
.
getItem
(
id
);
return
new
CommonResult
()
.
success
(
admin
);
return
CommonResult
.
success
(
admin
);
}
}
@ApiOperation
(
"修改指定用户信息"
)
@ApiOperation
(
"修改指定用户信息"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
UmsAdmin
admin
){
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
UmsAdmin
admin
)
{
int
count
=
adminService
.
update
(
id
,
admin
);
int
count
=
adminService
.
update
(
id
,
admin
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"删除指定用户信息"
)
@ApiOperation
(
"删除指定用户信息"
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@PathVariable
Long
id
){
public
CommonResul
t
delete
(
@PathVariable
Long
id
)
{
int
count
=
adminService
.
delete
(
id
);
int
count
=
adminService
.
delete
(
id
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"给用户分配角色"
)
@ApiOperation
(
"给用户分配角色"
)
@RequestMapping
(
value
=
"/role/update"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/role/update"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updateRole
(
@RequestParam
(
"adminId"
)
Long
adminId
,
public
CommonResul
t
updateRole
(
@RequestParam
(
"adminId"
)
Long
adminId
,
@RequestParam
(
"roleIds"
)
List
<
Long
>
roleIds
){
@RequestParam
(
"roleIds"
)
List
<
Long
>
roleIds
)
{
int
count
=
adminService
.
updateRole
(
adminId
,
roleIds
);
int
count
=
adminService
.
updateRole
(
adminId
,
roleIds
);
if
(
count
>=
0
){
if
(
count
>=
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取指定用户的角色"
)
@ApiOperation
(
"获取指定用户的角色"
)
@RequestMapping
(
value
=
"/role/{adminId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/role/{adminId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
getRoleList
(
@PathVariable
Long
adminId
){
public
CommonResult
<
List
<
UmsRole
>>
getRoleList
(
@PathVariable
Long
adminId
)
{
List
<
UmsRole
>
roleList
=
adminService
.
getRoleList
(
adminId
);
List
<
UmsRole
>
roleList
=
adminService
.
getRoleList
(
adminId
);
return
new
CommonResult
()
.
success
(
roleList
);
return
CommonResult
.
success
(
roleList
);
}
}
@ApiOperation
(
"给用户分配+-权限"
)
@ApiOperation
(
"给用户分配+-权限"
)
@RequestMapping
(
value
=
"/permission/update"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/permission/update"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updatePermission
(
@RequestParam
Long
adminId
,
public
CommonResul
t
updatePermission
(
@RequestParam
Long
adminId
,
@RequestParam
(
"permissionIds"
)
List
<
Long
>
permissionIds
){
@RequestParam
(
"permissionIds"
)
List
<
Long
>
permissionIds
)
{
int
count
=
adminService
.
updatePermission
(
adminId
,
permissionIds
);
int
count
=
adminService
.
updatePermission
(
adminId
,
permissionIds
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取用户所有权限(包括+-权限)"
)
@ApiOperation
(
"获取用户所有权限(包括+-权限)"
)
@RequestMapping
(
value
=
"/permission/{adminId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/permission/{adminId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
getPermissionList
(
@PathVariable
Long
adminId
){
public
CommonResult
<
List
<
UmsPermission
>>
getPermissionList
(
@PathVariable
Long
adminId
)
{
List
<
UmsPermission
>
permissionList
=
adminService
.
getPermissionList
(
adminId
);
List
<
UmsPermission
>
permissionList
=
adminService
.
getPermissionList
(
adminId
);
return
new
CommonResult
()
.
success
(
permissionList
);
return
CommonResult
.
success
(
permissionList
);
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/UmsMemberLevelController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.model.UmsMemberLevel
;
import
com.macro.mall.model.UmsMemberLevel
;
import
com.macro.mall.service.UmsMemberLevelService
;
import
com.macro.mall.service.UmsMemberLevelService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -19,16 +19,17 @@ import java.util.List;
...
@@ -19,16 +19,17 @@ import java.util.List;
* Created by macro on 2018/4/26.
* Created by macro on 2018/4/26.
*/
*/
@Controller
@Controller
@Api
(
tags
=
"UmsMemberLevelController"
,
description
=
"会员等级管理"
)
@Api
(
tags
=
"UmsMemberLevelController"
,
description
=
"会员等级管理"
)
@RequestMapping
(
"/memberLevel"
)
@RequestMapping
(
"/memberLevel"
)
public
class
UmsMemberLevelController
{
public
class
UmsMemberLevelController
{
@Autowired
@Autowired
private
UmsMemberLevelService
memberLevelService
;
private
UmsMemberLevelService
memberLevelService
;
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
"查询所有会员等级"
)
@ApiOperation
(
"查询所有会员等级"
)
@ResponseBody
@ResponseBody
public
Object
list
(
@RequestParam
(
"defaultStatus"
)
Integer
defaultStatus
){
public
CommonResult
<
List
<
UmsMemberLevel
>>
list
(
@RequestParam
(
"defaultStatus"
)
Integer
defaultStatus
)
{
List
<
UmsMemberLevel
>
memberLevelList
=
memberLevelService
.
list
(
defaultStatus
);
List
<
UmsMemberLevel
>
memberLevelList
=
memberLevelService
.
list
(
defaultStatus
);
return
new
CommonResult
()
.
success
(
memberLevelList
);
return
CommonResult
.
success
(
memberLevelList
);
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/UmsPermissionController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.dto.UmsPermissionNode
;
import
com.macro.mall.dto.UmsPermissionNode
;
import
com.macro.mall.model.UmsPermission
;
import
com.macro.mall.model.UmsPermission
;
import
com.macro.mall.service.UmsPermissionService
;
import
com.macro.mall.service.UmsPermissionService
;
...
@@ -25,49 +25,49 @@ public class UmsPermissionController {
...
@@ -25,49 +25,49 @@ public class UmsPermissionController {
@ApiOperation
(
"添加权限"
)
@ApiOperation
(
"添加权限"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
UmsPermission
permission
)
{
public
CommonResul
t
create
(
@RequestBody
UmsPermission
permission
)
{
int
count
=
permissionService
.
create
(
permission
);
int
count
=
permissionService
.
create
(
permission
);
if
(
count
>
0
){
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改权限"
)
@ApiOperation
(
"修改权限"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
UmsPermission
permission
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
UmsPermission
permission
)
{
int
count
=
permissionService
.
update
(
id
,
permission
);
int
count
=
permissionService
.
update
(
id
,
permission
);
if
(
count
>
0
){
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"根据id批量删除权限"
)
@ApiOperation
(
"根据id批量删除权限"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
permissionService
.
delete
(
ids
);
int
count
=
permissionService
.
delete
(
ids
);
if
(
count
>
0
){
if
(
count
>
0
){
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"以层级结构返回所有权限"
)
@ApiOperation
(
"以层级结构返回所有权限"
)
@RequestMapping
(
value
=
"/treeList"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/treeList"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
treeList
()
{
public
CommonResult
<
List
<
UmsPermissionNode
>>
treeList
()
{
List
<
UmsPermissionNode
>
permissionNodeList
=
permissionService
.
treeList
();
List
<
UmsPermissionNode
>
permissionNodeList
=
permissionService
.
treeList
();
return
new
CommonResult
()
.
success
(
permissionNodeList
);
return
CommonResult
.
success
(
permissionNodeList
);
}
}
@ApiOperation
(
"获取所有权限列表"
)
@ApiOperation
(
"获取所有权限列表"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
()
{
public
CommonResult
<
List
<
UmsPermission
>>
list
()
{
List
<
UmsPermission
>
permissionList
=
permissionService
.
list
();
List
<
UmsPermission
>
permissionList
=
permissionService
.
list
();
return
new
CommonResult
()
.
success
(
permissionList
);
return
CommonResult
.
success
(
permissionList
);
}
}
}
}
mall-admin/src/main/java/com/macro/mall/controller/UmsRoleController.java
View file @
5262a232
package
com.macro.mall.controller
;
package
com.macro.mall.controller
;
import
com.macro.mall.
dto
.CommonResult
;
import
com.macro.mall.
common.api
.CommonResult
;
import
com.macro.mall.model.UmsPermission
;
import
com.macro.mall.model.UmsPermission
;
import
com.macro.mall.model.UmsRole
;
import
com.macro.mall.model.UmsRole
;
import
com.macro.mall.service.UmsRoleService
;
import
com.macro.mall.service.UmsRoleService
;
...
@@ -26,62 +26,62 @@ public class UmsRoleController {
...
@@ -26,62 +26,62 @@ public class UmsRoleController {
@ApiOperation
(
"添加角色"
)
@ApiOperation
(
"添加角色"
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
create
(
@RequestBody
UmsRole
role
)
{
public
CommonResul
t
create
(
@RequestBody
UmsRole
role
)
{
int
count
=
roleService
.
create
(
role
);
int
count
=
roleService
.
create
(
role
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"修改角色"
)
@ApiOperation
(
"修改角色"
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
update
(
@PathVariable
Long
id
,
@RequestBody
UmsRole
role
)
{
public
CommonResul
t
update
(
@PathVariable
Long
id
,
@RequestBody
UmsRole
role
)
{
int
count
=
roleService
.
update
(
id
,
role
);
int
count
=
roleService
.
update
(
id
,
role
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"批量删除角色"
)
@ApiOperation
(
"批量删除角色"
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
public
CommonResul
t
delete
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
int
count
=
roleService
.
delete
(
ids
);
int
count
=
roleService
.
delete
(
ids
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取相应角色权限"
)
@ApiOperation
(
"获取相应角色权限"
)
@RequestMapping
(
value
=
"/permission/{roleId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/permission/{roleId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
getPermissionList
(
@PathVariable
Long
roleId
)
{
public
CommonResult
<
List
<
UmsPermission
>>
getPermissionList
(
@PathVariable
Long
roleId
)
{
List
<
UmsPermission
>
permissionList
=
roleService
.
getPermissionList
(
roleId
);
List
<
UmsPermission
>
permissionList
=
roleService
.
getPermissionList
(
roleId
);
return
new
CommonResult
()
.
success
(
permissionList
);
return
CommonResult
.
success
(
permissionList
);
}
}
@ApiOperation
(
"修改角色权限"
)
@ApiOperation
(
"修改角色权限"
)
@RequestMapping
(
value
=
"/permission/update"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/permission/update"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
Objec
t
updatePermission
(
@RequestParam
Long
roleId
,
public
CommonResul
t
updatePermission
(
@RequestParam
Long
roleId
,
@RequestParam
(
"permissionIds"
)
List
<
Long
>
permissionIds
)
{
@RequestParam
(
"permissionIds"
)
List
<
Long
>
permissionIds
)
{
int
count
=
roleService
.
updatePermission
(
roleId
,
permissionIds
);
int
count
=
roleService
.
updatePermission
(
roleId
,
permissionIds
);
if
(
count
>
0
){
if
(
count
>
0
)
{
return
new
CommonResult
()
.
success
(
count
);
return
CommonResult
.
success
(
count
);
}
}
return
new
CommonResult
()
.
failed
();
return
CommonResult
.
failed
();
}
}
@ApiOperation
(
"获取所有角色"
)
@ApiOperation
(
"获取所有角色"
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
Object
list
(){
public
Object
list
()
{
List
<
UmsRole
>
roleList
=
roleService
.
list
();
List
<
UmsRole
>
roleList
=
roleService
.
list
();
return
new
CommonResult
()
.
success
(
roleList
);
return
CommonResult
.
success
(
roleList
);
}
}
}
}
mall-admin/src/main/java/com/macro/mall/dto/CommonResult.java
deleted
100644 → 0
View file @
b5800856
package
com.macro.mall.dto
;
import
com.github.pagehelper.PageInfo
;
import
com.macro.mall.util.JsonUtil
;
import
org.springframework.validation.BindingResult
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 通用返回对象
* Created by macro on 2018/4/26.
*/
public
class
CommonResult
{
//操作成功
public
static
final
int
SUCCESS
=
200
;
//操作失败
public
static
final
int
FAILED
=
500
;
//参数校验失败
public
static
final
int
VALIDATE_FAILED
=
404
;
//未认证
public
static
final
int
UNAUTHORIZED
=
401
;
//未授权
public
static
final
int
FORBIDDEN
=
403
;
private
int
code
;
private
String
message
;
private
Object
data
;
/**
* 普通成功返回
*
* @param data 获取的数据
*/
public
CommonResult
success
(
Object
data
)
{
this
.
code
=
SUCCESS
;
this
.
message
=
"操作成功"
;
this
.
data
=
data
;
return
this
;
}
/**
* 返回分页成功数据
*/
public
CommonResult
pageSuccess
(
List
data
)
{
PageInfo
pageInfo
=
new
PageInfo
(
data
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"pageSize"
,
pageInfo
.
getPageSize
());
result
.
put
(
"totalPage"
,
pageInfo
.
getPages
());
result
.
put
(
"total"
,
pageInfo
.
getTotal
());
result
.
put
(
"pageNum"
,
pageInfo
.
getPageNum
());
result
.
put
(
"list"
,
pageInfo
.
getList
());
this
.
code
=
SUCCESS
;
this
.
message
=
"操作成功"
;
this
.
data
=
result
;
return
this
;
}
/**
* 普通失败提示信息
*/
public
CommonResult
failed
()
{
this
.
code
=
FAILED
;
this
.
message
=
"操作失败"
;
return
this
;
}
/**
* 参数验证失败使用
*
* @param message 错误信息
*/
public
CommonResult
validateFailed
(
String
message
)
{
this
.
code
=
VALIDATE_FAILED
;
this
.
message
=
message
;
return
this
;
}
/**
* 未登录时使用
*
* @param message 错误信息
*/
public
CommonResult
unauthorized
(
String
message
)
{
this
.
code
=
UNAUTHORIZED
;
this
.
message
=
"暂未登录或token已经过期"
;
this
.
data
=
message
;
return
this
;
}
/**
* 未授权时使用
*
* @param message 错误信息
*/
public
CommonResult
forbidden
(
String
message
)
{
this
.
code
=
FORBIDDEN
;
this
.
message
=
"没有相关权限"
;
this
.
data
=
message
;
return
this
;
}
/**
* 参数验证失败使用
* @param result 错误信息
*/
public
CommonResult
validateFailed
(
BindingResult
result
)
{
validateFailed
(
result
.
getFieldError
().
getDefaultMessage
());
return
this
;
}
@Override
public
String
toString
()
{
return
JsonUtil
.
objectToJson
(
this
);
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
Object
getData
()
{
return
data
;
}
public
void
setData
(
Object
data
)
{
this
.
data
=
data
;
}
}
mall-common/pom.xml
View file @
5262a232
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
<groupId>
org.springframework.data
</groupId>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-commons
</artifactId>
<artifactId>
spring-data-commons
</artifactId>
<version>
2.1.5.RELEASE
</version>
<version>
2.1.5.RELEASE
</version>
<scope>
compile
</scope>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
mall-common/src/main/java/com/macro/mall/common/api/CommonPage.java
View file @
5262a232
...
@@ -11,7 +11,8 @@ import java.util.List;
...
@@ -11,7 +11,8 @@ import java.util.List;
public
class
CommonPage
<
T
>
{
public
class
CommonPage
<
T
>
{
private
Integer
pageNum
;
private
Integer
pageNum
;
private
Integer
pageSize
;
private
Integer
pageSize
;
private
Long
totalPage
;
private
Integer
totalPage
;
private
Long
total
;
private
List
<
T
>
list
;
private
List
<
T
>
list
;
/**
/**
...
@@ -20,9 +21,10 @@ public class CommonPage<T> {
...
@@ -20,9 +21,10 @@ public class CommonPage<T> {
public
static
<
T
>
CommonPage
<
T
>
restPage
(
List
<
T
>
list
)
{
public
static
<
T
>
CommonPage
<
T
>
restPage
(
List
<
T
>
list
)
{
CommonPage
<
T
>
result
=
new
CommonPage
<
T
>();
CommonPage
<
T
>
result
=
new
CommonPage
<
T
>();
PageInfo
<
T
>
pageInfo
=
new
PageInfo
<
T
>(
list
);
PageInfo
<
T
>
pageInfo
=
new
PageInfo
<
T
>(
list
);
result
.
setTotalPage
(
pageInfo
.
get
Total
()
/
pageInfo
.
getPageSize
());
result
.
setTotalPage
(
pageInfo
.
get
Pages
());
result
.
setPageNum
(
pageInfo
.
getPageNum
());
result
.
setPageNum
(
pageInfo
.
getPageNum
());
result
.
setPageSize
(
pageInfo
.
getPageSize
());
result
.
setPageSize
(
pageInfo
.
getPageSize
());
result
.
setTotal
(
pageInfo
.
getTotal
());
result
.
setList
(
pageInfo
.
getList
());
result
.
setList
(
pageInfo
.
getList
());
return
result
;
return
result
;
}
}
...
@@ -32,9 +34,10 @@ public class CommonPage<T> {
...
@@ -32,9 +34,10 @@ public class CommonPage<T> {
*/
*/
public
static
<
T
>
CommonPage
<
T
>
restPage
(
Page
<
T
>
pageInfo
)
{
public
static
<
T
>
CommonPage
<
T
>
restPage
(
Page
<
T
>
pageInfo
)
{
CommonPage
<
T
>
result
=
new
CommonPage
<
T
>();
CommonPage
<
T
>
result
=
new
CommonPage
<
T
>();
result
.
setTotalPage
(
(
long
)
pageInfo
.
getTotalPages
());
result
.
setTotalPage
(
pageInfo
.
getTotalPages
());
result
.
setPageNum
(
pageInfo
.
getNumber
());
result
.
setPageNum
(
pageInfo
.
getNumber
());
result
.
setPageSize
(
pageInfo
.
getSize
());
result
.
setPageSize
(
pageInfo
.
getSize
());
result
.
setTotal
(
pageInfo
.
getTotalElements
());
result
.
setList
(
pageInfo
.
getContent
());
result
.
setList
(
pageInfo
.
getContent
());
return
result
;
return
result
;
}
}
...
@@ -55,11 +58,11 @@ public class CommonPage<T> {
...
@@ -55,11 +58,11 @@ public class CommonPage<T> {
this
.
pageSize
=
pageSize
;
this
.
pageSize
=
pageSize
;
}
}
public
Long
getTotalPage
()
{
public
Integer
getTotalPage
()
{
return
totalPage
;
return
totalPage
;
}
}
public
void
setTotalPage
(
Long
totalPage
)
{
public
void
setTotalPage
(
Integer
totalPage
)
{
this
.
totalPage
=
totalPage
;
this
.
totalPage
=
totalPage
;
}
}
...
@@ -70,4 +73,12 @@ public class CommonPage<T> {
...
@@ -70,4 +73,12 @@ public class CommonPage<T> {
public
void
setList
(
List
<
T
>
list
)
{
public
void
setList
(
List
<
T
>
list
)
{
this
.
list
=
list
;
this
.
list
=
list
;
}
}
public
Long
getTotal
()
{
return
total
;
}
public
void
setTotal
(
Long
total
)
{
this
.
total
=
total
;
}
}
}
mall-common/src/main/java/com/macro/mall/common/api/CommonResult.java
View file @
5262a232
...
@@ -8,88 +8,84 @@ public class CommonResult<T> {
...
@@ -8,88 +8,84 @@ public class CommonResult<T> {
private
String
message
;
private
String
message
;
private
T
data
;
private
T
data
;
protected
CommonResult
()
{
}
protected
CommonResult
(
long
code
,
String
message
,
T
data
)
{
this
.
code
=
code
;
this
.
message
=
message
;
this
.
data
=
data
;
}
/**
/**
*
普通
成功返回
* 成功返回
结果
*
*
* @param data 获取的数据
* @param data 获取的数据
*/
*/
public
static
<
T
>
CommonResult
<
T
>
success
(
T
data
)
{
public
static
<
T
>
CommonResult
<
T
>
success
(
T
data
)
{
CommonResult
<
T
>
result
=
new
CommonResult
<
T
>();
return
new
CommonResult
<
T
>(
ResultCode
.
SUCCESS
.
getCode
(),
ResultCode
.
SUCCESS
.
getMessage
(),
data
);
result
.
setCode
(
ResultCode
.
SUCCESS
.
getCode
());
result
.
setMessage
(
ResultCode
.
SUCCESS
.
getMsg
());
result
.
setData
(
data
);
return
result
;
}
}
/**
/**
*
普通
成功返回
* 成功返回
结果
*
*
* @param data 获取的数据
* @param data 获取的数据
* @param message 提示信息
*/
*/
public
static
<
T
>
CommonResult
<
T
>
success
(
T
data
,
String
message
)
{
public
static
<
T
>
CommonResult
<
T
>
success
(
T
data
,
String
message
)
{
CommonResult
<
T
>
result
=
new
CommonResult
<
T
>();
return
new
CommonResult
<
T
>(
ResultCode
.
SUCCESS
.
getCode
(),
message
,
data
);
result
.
setCode
(
ResultCode
.
SUCCESS
.
getCode
());
result
.
setMessage
(
message
);
result
.
setData
(
data
);
return
result
;
}
}
/**
/**
* 通过错误码对象构造返回结果
* 失败返回结果
* @param errorCode 错误码
*/
*/
public
static
<
T
>
CommonResult
<
T
>
failed
(
IErrorCode
errorCode
)
{
public
static
<
T
>
CommonResult
<
T
>
failed
(
IErrorCode
errorCode
)
{
CommonResult
<
T
>
result
=
new
CommonResult
<
T
>();
return
new
CommonResult
<
T
>(
errorCode
.
getCode
(),
errorCode
.
getMessage
(),
null
);
result
.
setCode
(
errorCode
.
getCode
());
result
.
setMessage
(
errorCode
.
getMsg
());
return
result
;
}
}
/**
/**
* 普通失败提示信息
* 失败返回结果
* @param message 提示信息
*/
*/
public
static
<
T
>
CommonResult
<
T
>
failed
(
String
message
)
{
public
static
<
T
>
CommonResult
<
T
>
failed
(
String
message
)
{
CommonResult
<
T
>
result
=
new
CommonResult
<
T
>();
return
new
CommonResult
<
T
>(
ResultCode
.
FAILED
.
getCode
(),
message
,
null
);
result
.
setCode
(
ResultCode
.
FAILED
.
getCode
());
result
.
setMessage
(
message
);
return
result
;
}
}
/**
/**
*
普通操作失败
*
失败返回结果
*/
*/
public
static
<
T
>
CommonResult
<
T
>
failed
()
{
public
static
<
T
>
CommonResult
<
T
>
failed
()
{
return
failed
(
ResultCode
.
FAILED
);
return
failed
(
ResultCode
.
FAILED
);
}
}
/**
/**
* 参数验证失败
使用
* 参数验证失败
返回结果
*/
*/
public
static
<
T
>
CommonResult
<
T
>
validateFailed
()
{
public
static
<
T
>
CommonResult
<
T
>
validateFailed
()
{
return
failed
(
ResultCode
.
VALIDATE_FAILED
);
return
failed
(
ResultCode
.
VALIDATE_FAILED
);
}
}
/**
/**
* 参数验证失败使用
* 参数验证失败返回结果
* @param message 提示信息
*/
*/
public
static
<
T
>
CommonResult
<
T
>
validateFailed
(
String
message
)
{
public
static
<
T
>
CommonResult
<
T
>
validateFailed
(
String
message
)
{
CommonResult
<
T
>
result
=
new
CommonResult
<
T
>();
return
new
CommonResult
<
T
>(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
message
,
null
);
result
.
setCode
(
ResultCode
.
FAILED
.
getCode
());
result
.
setMessage
(
message
);
return
result
;
}
}
/**
/**
*
用户没有登录
*
未登录返回结果
*/
*/
public
static
<
T
>
CommonResult
<
T
>
unauthorized
()
{
public
static
<
T
>
CommonResult
<
T
>
unauthorized
(
T
data
)
{
return
failed
(
ResultCode
.
UNAUTHORIZED
);
return
new
CommonResult
<
T
>(
ResultCode
.
UNAUTHORIZED
.
getCode
(),
ResultCode
.
UNAUTHORIZED
.
getMessage
(),
data
);
}
}
/**
/**
*
用户没有相应权限
*
未授权返回结果
*/
*/
public
static
<
T
>
CommonResult
<
T
>
forbidden
()
{
public
static
<
T
>
CommonResult
<
T
>
forbidden
(
T
data
)
{
return
failed
(
ResultCode
.
UNAUTHORIZED
);
return
new
CommonResult
<
T
>(
ResultCode
.
FORBIDDEN
.
getCode
(),
ResultCode
.
FORBIDDEN
.
getMessage
(),
data
);
}
}
public
long
getCode
()
{
public
long
getCode
()
{
...
...
mall-common/src/main/java/com/macro/mall/common/api/IErrorCode.java
View file @
5262a232
...
@@ -7,5 +7,5 @@ package com.macro.mall.common.api;
...
@@ -7,5 +7,5 @@ package com.macro.mall.common.api;
public
interface
IErrorCode
{
public
interface
IErrorCode
{
long
getCode
();
long
getCode
();
String
getM
sg
();
String
getM
essage
();
}
}
mall-common/src/main/java/com/macro/mall/common/api/ResultCode.java
View file @
5262a232
...
@@ -11,18 +11,18 @@ public enum ResultCode implements IErrorCode {
...
@@ -11,18 +11,18 @@ public enum ResultCode implements IErrorCode {
UNAUTHORIZED
(
401
,
"暂未登录或token已经过期"
),
UNAUTHORIZED
(
401
,
"暂未登录或token已经过期"
),
FORBIDDEN
(
403
,
"没有相关权限"
);
FORBIDDEN
(
403
,
"没有相关权限"
);
private
long
code
;
private
long
code
;
private
String
m
sg
;
private
String
m
essage
;
private
ResultCode
(
long
code
,
String
m
sg
)
{
private
ResultCode
(
long
code
,
String
m
essage
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
m
sg
=
msg
;
this
.
m
essage
=
message
;
}
}
public
long
getCode
()
{
public
long
getCode
()
{
return
code
;
return
code
;
}
}
public
String
getM
sg
()
{
public
String
getM
essage
()
{
return
m
sg
;
return
m
essage
;
}
}
}
}
Prev
1
2
Next
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