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
109a95d3
Commit
109a95d3
authored
Apr 16, 2018
by
zhh
Browse files
结构调整
parent
6c918f20
Changes
6
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/controller/PmsBrandController.java
View file @
109a95d3
package
com.macro.mall.controller
;
import
com.macro.mall.dto.CommonResult
;
import
com.macro.mall.dto.PmsBrand
Dto
;
import
com.macro.mall.dto.PmsBrand
Param
;
import
com.macro.mall.service.PmsBrandService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
* 品牌功能Controller
*/
@Controller
@RequestMapping
(
"/brand"
)
public
class
PmsBrandController
{
@Autowired
private
PmsBrandService
brandService
;
...
...
@@ -23,16 +25,16 @@ public class PmsBrandController {
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PmsBrandController
.
class
);
@ApiOperation
(
value
=
"获取全部品牌列表"
)
@RequestMapping
(
value
=
"/
brand/
listAll"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/listAll"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getBrandList
()
{
return
new
CommonResult
().
success
(
brandService
.
listAllBrand
());
}
@ApiOperation
(
value
=
"添加品牌"
)
@RequestMapping
(
value
=
"/
brand/
create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
createBrand
(
@Validated
@RequestBody
PmsBrand
Dto
pmsBrand
,
BindingResult
result
)
{
public
Object
createBrand
(
@Validated
@RequestBody
PmsBrand
Param
pmsBrand
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
return
new
CommonResult
().
validateFailed
(
result
.
getFieldError
().
getDefaultMessage
());
}
...
...
@@ -49,26 +51,26 @@ public class PmsBrandController {
}
@ApiOperation
(
value
=
"更新品牌"
)
@RequestMapping
(
value
=
"/
brand/
update/{id}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/update/{id}"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
updateBrand
(
@PathVariable
(
"id"
)
Long
id
,
@Validated
@RequestBody
PmsBrand
Dto
pmsBrand
Dto
,
BindingResult
result
)
{
public
Object
updateBrand
(
@PathVariable
(
"id"
)
Long
id
,
@Validated
@RequestBody
PmsBrand
Param
pmsBrand
Param
,
BindingResult
result
)
{
if
(
result
.
hasErrors
()){
return
new
CommonResult
().
validateFailed
(
result
.
getFieldError
().
getDefaultMessage
());
}
CommonResult
commonResult
;
int
count
=
brandService
.
updateBrand
(
id
,
pmsBrand
Dto
);
int
count
=
brandService
.
updateBrand
(
id
,
pmsBrand
Param
);
if
(
count
==
1
)
{
commonResult
=
new
CommonResult
().
success
(
pmsBrand
Dto
);
LOGGER
.
debug
(
"updateBrand success:{}"
,
pmsBrand
Dto
);
commonResult
=
new
CommonResult
().
success
(
pmsBrand
Param
);
LOGGER
.
debug
(
"updateBrand success:{}"
,
pmsBrand
Param
);
}
else
{
commonResult
=
new
CommonResult
().
failed
();
LOGGER
.
debug
(
"updateBrand failed:{}"
,
pmsBrand
Dto
);
LOGGER
.
debug
(
"updateBrand failed:{}"
,
pmsBrand
Param
);
}
return
commonResult
;
}
@ApiOperation
(
value
=
"删除品牌"
)
@RequestMapping
(
value
=
"/
brand/
delete/{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
deleteBrand
(
@PathVariable
(
"id"
)
Long
id
)
{
int
count
=
brandService
.
deleteBrand
(
id
);
...
...
@@ -82,7 +84,7 @@ public class PmsBrandController {
}
@ApiOperation
(
value
=
"分页获取品牌列表"
)
@RequestMapping
(
value
=
"/
brand/
list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
listBrand
(
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"3"
)
Integer
pageSize
)
{
...
...
@@ -90,7 +92,7 @@ public class PmsBrandController {
}
@ApiOperation
(
value
=
"根据编号查询品牌信息"
)
@RequestMapping
(
value
=
"/
brand/
{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
getBrand
(
@PathVariable
(
"id"
)
Long
id
)
{
return
new
CommonResult
().
success
(
brandService
.
getBrand
(
id
));
...
...
mall-admin/src/main/java/com/macro/mall/dto/PmsBrand
Dto
.java
→
mall-admin/src/main/java/com/macro/mall/dto/PmsBrand
Param
.java
View file @
109a95d3
...
...
@@ -10,8 +10,8 @@ import javax.validation.constraints.NotNull;
/**
* 品牌传递参数
*/
@ApiModel
(
value
=
"PmsBrand
Dto
"
)
public
class
PmsBrand
Dto
{
@ApiModel
(
value
=
"PmsBrand
Param
"
)
public
class
PmsBrand
Param
{
@ApiModelProperty
(
value
=
"品牌名称"
,
required
=
true
)
@NotNull
(
message
=
"名称不能为空"
)
private
String
name
;
...
...
mall-admin/src/main/java/com/macro/mall/service/PmsBrandService.java
View file @
109a95d3
package
com.macro.mall.service
;
import
com.macro.mall.dto.PmsBrand
Dto
;
import
com.macro.mall.dto.PmsBrand
Param
;
import
com.macro.mall.model.PmsBrand
;
import
java.util.List
;
...
...
@@ -11,9 +11,9 @@ import java.util.List;
public
interface
PmsBrandService
{
List
<
PmsBrand
>
listAllBrand
();
int
createBrand
(
PmsBrand
Dto
pmsBrand
Dto
);
int
createBrand
(
PmsBrand
Param
pmsBrand
Param
);
int
updateBrand
(
Long
id
,
PmsBrand
Dto
pmsBrand
Dto
);
int
updateBrand
(
Long
id
,
PmsBrand
Param
pmsBrand
Param
);
int
deleteBrand
(
Long
id
);
...
...
mall-admin/src/main/java/com/macro/mall/service/impl/PmsBrandServiceImpl.java
View file @
109a95d3
package
com.macro.mall.service.impl
;
import
com.github.pagehelper.PageHelper
;
import
com.macro.mall.dto.PmsBrand
Dto
;
import
com.macro.mall.dto.PmsBrand
Param
;
import
com.macro.mall.mapper.PmsBrandMapper
;
import
com.macro.mall.model.PmsBrand
;
import
com.macro.mall.model.PmsBrandExample
;
...
...
@@ -26,16 +26,16 @@ public class PmsBrandServiceImpl implements PmsBrandService{
}
@Override
public
int
createBrand
(
PmsBrand
Dto
pmsBrand
Dto
)
{
public
int
createBrand
(
PmsBrand
Param
pmsBrand
Param
)
{
PmsBrand
pmsBrand
=
new
PmsBrand
();
BeanUtils
.
copyProperties
(
pmsBrand
Dto
,
pmsBrand
);
BeanUtils
.
copyProperties
(
pmsBrand
Param
,
pmsBrand
);
return
brandMapper
.
insertSelective
(
pmsBrand
);
}
@Override
public
int
updateBrand
(
Long
id
,
PmsBrand
Dto
pmsBrand
Dto
)
{
public
int
updateBrand
(
Long
id
,
PmsBrand
Param
pmsBrand
Param
)
{
PmsBrand
pmsBrand
=
new
PmsBrand
();
BeanUtils
.
copyProperties
(
pmsBrand
Dto
,
pmsBrand
);
BeanUtils
.
copyProperties
(
pmsBrand
Param
,
pmsBrand
);
pmsBrand
.
setId
(
id
);
return
brandMapper
.
updateByPrimaryKeySelective
(
pmsBrand
);
}
...
...
mall-admin/src/main/webapp/WEB-INF/web.xml
deleted
100644 → 0
View file @
6c918f20
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>
Archetype Created Web Application
</display-name>
</web-app>
mall-admin/src/main/webapp/index.jsp
deleted
100644 → 0
View file @
6c918f20
<html>
<body>
<h2>
Hello World!
</h2>
</body>
</html>
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