商品品牌接口完善

This commit is contained in:
zhh 2018-04-17 15:52:30 +08:00
parent 390132d9e8
commit 0ccc58178e
3 changed files with 37 additions and 11 deletions

View File

@ -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();
}
}
}

View File

@ -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);
}

View File

@ -65,6 +65,7 @@ public class PmsBrandServiceImpl implements PmsBrandService{
public List<PmsBrand> listBrand(String keyword, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.setOrderByClause("sort asc");
if (!StringUtils.isEmpty(keyword)) {
pmsBrandExample.createCriteria().andNameLike("%" + keyword + "%");
}
@ -84,4 +85,13 @@ public class PmsBrandServiceImpl implements PmsBrandService{
pmsBrandExample.createCriteria().andIdIn(ids);
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);
}
}