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
0ccc5817
Commit
0ccc5817
authored
Apr 17, 2018
by
zhh
Browse files
商品品牌接口完善
parent
390132d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/controller/PmsBrandController.java
View file @
0ccc5817
...
...
@@ -128,4 +128,18 @@ public class PmsBrandController {
return
new
CommonResult
().
failed
();
}
}
@ApiOperation
(
value
=
"批量更新厂家制造商状态"
)
@RequestMapping
(
value
=
"/update/factoryStatus"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
updateFactoryStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
,
@RequestParam
(
"factoryStatus"
)
Integer
factoryStatus
)
{
int
count
=
brandService
.
updateFactoryStatus
(
ids
,
factoryStatus
);
if
(
count
>
0
)
{
LOGGER
.
debug
(
"updateFactoryStatus success:{}"
,
ids
);
return
new
CommonResult
().
success
(
count
);
}
else
{
LOGGER
.
debug
(
"updateFactoryStatus failed:{}"
,
ids
);
return
new
CommonResult
().
failed
();
}
}
}
mall-admin/src/main/java/com/macro/mall/service/PmsBrandService.java
View file @
0ccc5817
...
...
@@ -24,4 +24,6 @@ public interface PmsBrandService {
PmsBrand
getBrand
(
Long
id
);
int
updateShowStatus
(
List
<
Long
>
ids
,
Integer
showStatus
);
int
updateFactoryStatus
(
List
<
Long
>
ids
,
Integer
factoryStatus
);
}
mall-admin/src/main/java/com/macro/mall/service/impl/PmsBrandServiceImpl.java
View file @
0ccc5817
...
...
@@ -17,7 +17,7 @@ import java.util.List;
* 商品品牌Service实现类
*/
@Service
public
class
PmsBrandServiceImpl
implements
PmsBrandService
{
public
class
PmsBrandServiceImpl
implements
PmsBrandService
{
@Autowired
private
PmsBrandMapper
brandMapper
;
...
...
@@ -29,10 +29,10 @@ public class PmsBrandServiceImpl implements PmsBrandService{
@Override
public
int
createBrand
(
PmsBrandParam
pmsBrandParam
)
{
PmsBrand
pmsBrand
=
new
PmsBrand
();
BeanUtils
.
copyProperties
(
pmsBrandParam
,
pmsBrand
);
BeanUtils
.
copyProperties
(
pmsBrandParam
,
pmsBrand
);
//如果创建时首字母为空,取名称的第一个为首字母
if
(
StringUtils
.
isEmpty
(
pmsBrand
.
getFirstLetter
())){
pmsBrand
.
setFirstLetter
(
pmsBrand
.
getName
().
substring
(
0
,
1
));
if
(
StringUtils
.
isEmpty
(
pmsBrand
.
getFirstLetter
()))
{
pmsBrand
.
setFirstLetter
(
pmsBrand
.
getName
().
substring
(
0
,
1
));
}
return
brandMapper
.
insertSelective
(
pmsBrand
);
}
...
...
@@ -40,11 +40,11 @@ public class PmsBrandServiceImpl implements PmsBrandService{
@Override
public
int
updateBrand
(
Long
id
,
PmsBrandParam
pmsBrandParam
)
{
PmsBrand
pmsBrand
=
new
PmsBrand
();
BeanUtils
.
copyProperties
(
pmsBrandParam
,
pmsBrand
);
BeanUtils
.
copyProperties
(
pmsBrandParam
,
pmsBrand
);
pmsBrand
.
setId
(
id
);
//如果创建时首字母为空,取名称的第一个为首字母
if
(
StringUtils
.
isEmpty
(
pmsBrand
.
getFirstLetter
())){
pmsBrand
.
setFirstLetter
(
pmsBrand
.
getName
().
substring
(
0
,
1
));
if
(
StringUtils
.
isEmpty
(
pmsBrand
.
getFirstLetter
()))
{
pmsBrand
.
setFirstLetter
(
pmsBrand
.
getName
().
substring
(
0
,
1
));
}
return
brandMapper
.
updateByPrimaryKeySelective
(
pmsBrand
);
}
...
...
@@ -62,11 +62,12 @@ public class PmsBrandServiceImpl implements PmsBrandService{
}
@Override
public
List
<
PmsBrand
>
listBrand
(
String
keyword
,
int
pageNum
,
int
pageSize
)
{
public
List
<
PmsBrand
>
listBrand
(
String
keyword
,
int
pageNum
,
int
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PmsBrandExample
pmsBrandExample
=
new
PmsBrandExample
();
if
(!
StringUtils
.
isEmpty
(
keyword
)){
pmsBrandExample
.
createCriteria
().
andNameLike
(
"%"
+
keyword
+
"%"
);
pmsBrandExample
.
setOrderByClause
(
"sort asc"
);
if
(!
StringUtils
.
isEmpty
(
keyword
))
{
pmsBrandExample
.
createCriteria
().
andNameLike
(
"%"
+
keyword
+
"%"
);
}
return
brandMapper
.
selectByExample
(
pmsBrandExample
);
}
...
...
@@ -82,6 +83,15 @@ public class PmsBrandServiceImpl implements PmsBrandService{
pmsBrand
.
setShowStatus
(
showStatus
);
PmsBrandExample
pmsBrandExample
=
new
PmsBrandExample
();
pmsBrandExample
.
createCriteria
().
andIdIn
(
ids
);
return
brandMapper
.
updateByExampleSelective
(
pmsBrand
,
pmsBrandExample
);
return
brandMapper
.
updateByExampleSelective
(
pmsBrand
,
pmsBrandExample
);
}
@Override
public
int
updateFactoryStatus
(
List
<
Long
>
ids
,
Integer
factoryStatus
)
{
PmsBrand
pmsBrand
=
new
PmsBrand
();
pmsBrand
.
setFactoryStatus
(
factoryStatus
);
PmsBrandExample
pmsBrandExample
=
new
PmsBrandExample
();
pmsBrandExample
.
createCriteria
().
andIdIn
(
ids
);
return
brandMapper
.
updateByExampleSelective
(
pmsBrand
,
pmsBrandExample
);
}
}
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