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
89c84ce8
Commit
89c84ce8
authored
Nov 11, 2022
by
macro
Browse files
获取品牌列表接口添加显示状态条件
parent
4b2062e8
Changes
3
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/controller/PmsBrandController.java
View file @
89c84ce8
...
@@ -79,9 +79,10 @@ public class PmsBrandController {
...
@@ -79,9 +79,10 @@ public class PmsBrandController {
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
CommonResult
<
CommonPage
<
PmsBrand
>>
getList
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
public
CommonResult
<
CommonPage
<
PmsBrand
>>
getList
(
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
String
keyword
,
@RequestParam
(
value
=
"showStatus"
,
required
=
false
)
Integer
showStatus
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
)
{
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"5"
)
Integer
pageSize
)
{
List
<
PmsBrand
>
brandList
=
brandService
.
listBrand
(
keyword
,
pageNum
,
pageSize
);
List
<
PmsBrand
>
brandList
=
brandService
.
listBrand
(
keyword
,
showStatus
,
pageNum
,
pageSize
);
return
CommonResult
.
success
(
CommonPage
.
restPage
(
brandList
));
return
CommonResult
.
success
(
CommonPage
.
restPage
(
brandList
));
}
}
...
...
mall-admin/src/main/java/com/macro/mall/service/PmsBrandService.java
View file @
89c84ce8
...
@@ -40,7 +40,7 @@ public interface PmsBrandService {
...
@@ -40,7 +40,7 @@ public interface PmsBrandService {
/**
/**
* 分页查询品牌
* 分页查询品牌
*/
*/
List
<
PmsBrand
>
listBrand
(
String
keyword
,
int
pageNum
,
int
pageSize
);
List
<
PmsBrand
>
listBrand
(
String
keyword
,
Integer
showStatus
,
int
pageNum
,
int
pageSize
);
/**
/**
* 获取品牌详情
* 获取品牌详情
...
...
mall-admin/src/main/java/com/macro/mall/service/impl/PmsBrandServiceImpl.java
View file @
89c84ce8
...
@@ -13,7 +13,6 @@ import com.macro.mall.service.PmsBrandService;
...
@@ -13,7 +13,6 @@ import com.macro.mall.service.PmsBrandService;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
import
java.util.List
;
...
@@ -75,7 +74,7 @@ public class PmsBrandServiceImpl implements PmsBrandService {
...
@@ -75,7 +74,7 @@ public class PmsBrandServiceImpl implements PmsBrandService {
}
}
@Override
@Override
public
List
<
PmsBrand
>
listBrand
(
String
keyword
,
int
pageNum
,
int
pageSize
)
{
public
List
<
PmsBrand
>
listBrand
(
String
keyword
,
Integer
showStatus
,
int
pageNum
,
int
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
PmsBrandExample
pmsBrandExample
=
new
PmsBrandExample
();
PmsBrandExample
pmsBrandExample
=
new
PmsBrandExample
();
pmsBrandExample
.
setOrderByClause
(
"sort desc"
);
pmsBrandExample
.
setOrderByClause
(
"sort desc"
);
...
@@ -83,6 +82,9 @@ public class PmsBrandServiceImpl implements PmsBrandService {
...
@@ -83,6 +82,9 @@ public class PmsBrandServiceImpl implements PmsBrandService {
if
(!
StrUtil
.
isEmpty
(
keyword
))
{
if
(!
StrUtil
.
isEmpty
(
keyword
))
{
criteria
.
andNameLike
(
"%"
+
keyword
+
"%"
);
criteria
.
andNameLike
(
"%"
+
keyword
+
"%"
);
}
}
if
(
showStatus
!=
null
){
criteria
.
andShowStatusEqualTo
(
showStatus
);
}
return
brandMapper
.
selectByExample
(
pmsBrandExample
);
return
brandMapper
.
selectByExample
(
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