获取品牌列表接口添加显示状态条件
This commit is contained in:
@@ -79,9 +79,10 @@ public class PmsBrandController {
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
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 = "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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 获取品牌详情
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.macro.mall.service.PmsBrandService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -75,7 +74,7 @@ public class PmsBrandServiceImpl implements PmsBrandService {
|
||||
}
|
||||
|
||||
@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);
|
||||
PmsBrandExample pmsBrandExample = new PmsBrandExample();
|
||||
pmsBrandExample.setOrderByClause("sort desc");
|
||||
@@ -83,6 +82,9 @@ public class PmsBrandServiceImpl implements PmsBrandService {
|
||||
if (!StrUtil.isEmpty(keyword)) {
|
||||
criteria.andNameLike("%" + keyword + "%");
|
||||
}
|
||||
if(showStatus!=null){
|
||||
criteria.andShowStatusEqualTo(showStatus);
|
||||
}
|
||||
return brandMapper.selectByExample(pmsBrandExample);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user