48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package com.gxwebsoft.shop.service.impl;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.gxwebsoft.shop.mapper.BrandMapper;
|
|
import com.gxwebsoft.shop.service.BrandService;
|
|
import com.gxwebsoft.shop.entity.Brand;
|
|
import com.gxwebsoft.shop.param.BrandParam;
|
|
import com.gxwebsoft.common.core.web.PageParam;
|
|
import com.gxwebsoft.common.core.web.PageResult;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 品牌Service实现
|
|
*
|
|
* @author 科技小王子
|
|
* @since 2024-04-04 11:38:21
|
|
*/
|
|
@Service
|
|
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements BrandService {
|
|
|
|
@Override
|
|
public PageResult<Brand> pageRel(BrandParam param) {
|
|
PageParam<Brand, BrandParam> page = new PageParam<>(param);
|
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
|
List<Brand> list = baseMapper.selectPageRel(page, param);
|
|
return new PageResult<>(list, page.getTotal());
|
|
}
|
|
|
|
@Override
|
|
public List<Brand> listRel(BrandParam param) {
|
|
List<Brand> list = baseMapper.selectListRel(param);
|
|
// 排序
|
|
PageParam<Brand, BrandParam> page = new PageParam<>();
|
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
|
return page.sortRecords(list);
|
|
}
|
|
|
|
@Override
|
|
public Brand getByIdRel(Integer brandId) {
|
|
BrandParam param = new BrandParam();
|
|
param.setBrandId(brandId);
|
|
return param.getOne(baseMapper.selectListRel(param));
|
|
}
|
|
|
|
}
|