商品品牌接口完善
This commit is contained in:
parent
390132d9e8
commit
0ccc58178e
@ -128,4 +128,18 @@ public class PmsBrandController {
|
|||||||
return new CommonResult().failed();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,6 @@ public interface PmsBrandService {
|
|||||||
PmsBrand getBrand(Long id);
|
PmsBrand getBrand(Long id);
|
||||||
|
|
||||||
int updateShowStatus(List<Long> ids, Integer showStatus);
|
int updateShowStatus(List<Long> ids, Integer showStatus);
|
||||||
|
|
||||||
|
int updateFactoryStatus(List<Long> ids, Integer factoryStatus);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
|||||||
* 商品品牌Service实现类
|
* 商品品牌Service实现类
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class PmsBrandServiceImpl implements PmsBrandService{
|
public class PmsBrandServiceImpl implements PmsBrandService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsBrandMapper brandMapper;
|
private PmsBrandMapper brandMapper;
|
||||||
|
|
||||||
@ -29,10 +29,10 @@ public class PmsBrandServiceImpl implements PmsBrandService{
|
|||||||
@Override
|
@Override
|
||||||
public int createBrand(PmsBrandParam pmsBrandParam) {
|
public int createBrand(PmsBrandParam pmsBrandParam) {
|
||||||
PmsBrand pmsBrand = new PmsBrand();
|
PmsBrand pmsBrand = new PmsBrand();
|
||||||
BeanUtils.copyProperties(pmsBrandParam,pmsBrand);
|
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
|
||||||
//如果创建时首字母为空,取名称的第一个为首字母
|
//如果创建时首字母为空,取名称的第一个为首字母
|
||||||
if(StringUtils.isEmpty(pmsBrand.getFirstLetter())){
|
if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
|
||||||
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0,1));
|
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
|
||||||
}
|
}
|
||||||
return brandMapper.insertSelective(pmsBrand);
|
return brandMapper.insertSelective(pmsBrand);
|
||||||
}
|
}
|
||||||
@ -40,11 +40,11 @@ public class PmsBrandServiceImpl implements PmsBrandService{
|
|||||||
@Override
|
@Override
|
||||||
public int updateBrand(Long id, PmsBrandParam pmsBrandParam) {
|
public int updateBrand(Long id, PmsBrandParam pmsBrandParam) {
|
||||||
PmsBrand pmsBrand = new PmsBrand();
|
PmsBrand pmsBrand = new PmsBrand();
|
||||||
BeanUtils.copyProperties(pmsBrandParam,pmsBrand);
|
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
|
||||||
pmsBrand.setId(id);
|
pmsBrand.setId(id);
|
||||||
//如果创建时首字母为空,取名称的第一个为首字母
|
//如果创建时首字母为空,取名称的第一个为首字母
|
||||||
if(StringUtils.isEmpty(pmsBrand.getFirstLetter())){
|
if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
|
||||||
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0,1));
|
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
|
||||||
}
|
}
|
||||||
return brandMapper.updateByPrimaryKeySelective(pmsBrand);
|
return brandMapper.updateByPrimaryKeySelective(pmsBrand);
|
||||||
}
|
}
|
||||||
@ -62,11 +62,12 @@ public class PmsBrandServiceImpl implements PmsBrandService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
PmsBrandExample pmsBrandExample = new PmsBrandExample();
|
PmsBrandExample pmsBrandExample = new PmsBrandExample();
|
||||||
if(!StringUtils.isEmpty(keyword)){
|
pmsBrandExample.setOrderByClause("sort asc");
|
||||||
pmsBrandExample.createCriteria().andNameLike("%"+keyword+"%");
|
if (!StringUtils.isEmpty(keyword)) {
|
||||||
|
pmsBrandExample.createCriteria().andNameLike("%" + keyword + "%");
|
||||||
}
|
}
|
||||||
return brandMapper.selectByExample(pmsBrandExample);
|
return brandMapper.selectByExample(pmsBrandExample);
|
||||||
}
|
}
|
||||||
@ -82,6 +83,15 @@ public class PmsBrandServiceImpl implements PmsBrandService{
|
|||||||
pmsBrand.setShowStatus(showStatus);
|
pmsBrand.setShowStatus(showStatus);
|
||||||
PmsBrandExample pmsBrandExample = new PmsBrandExample();
|
PmsBrandExample pmsBrandExample = new PmsBrandExample();
|
||||||
pmsBrandExample.createCriteria().andIdIn(ids);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user