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.GoodsSpecMapper;
|
|
import com.gxwebsoft.shop.service.GoodsSpecService;
|
|
import com.gxwebsoft.shop.entity.GoodsSpec;
|
|
import com.gxwebsoft.shop.param.GoodsSpecParam;
|
|
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-03 16:06:23
|
|
*/
|
|
@Service
|
|
public class GoodsSpecServiceImpl extends ServiceImpl<GoodsSpecMapper, GoodsSpec> implements GoodsSpecService {
|
|
|
|
@Override
|
|
public PageResult<GoodsSpec> pageRel(GoodsSpecParam param) {
|
|
PageParam<GoodsSpec, GoodsSpecParam> page = new PageParam<>(param);
|
|
page.setDefaultOrder("id desc");
|
|
List<GoodsSpec> list = baseMapper.selectPageRel(page, param);
|
|
return new PageResult<>(list, page.getTotal());
|
|
}
|
|
|
|
@Override
|
|
public List<GoodsSpec> listRel(GoodsSpecParam param) {
|
|
List<GoodsSpec> list = baseMapper.selectListRel(param);
|
|
// 排序
|
|
PageParam<GoodsSpec, GoodsSpecParam> page = new PageParam<>();
|
|
page.setDefaultOrder("id desc");
|
|
return page.sortRecords(list);
|
|
}
|
|
|
|
@Override
|
|
public GoodsSpec getByIdRel(Integer id) {
|
|
GoodsSpecParam param = new GoodsSpecParam();
|
|
param.setId(id);
|
|
return param.getOne(baseMapper.selectListRel(param));
|
|
}
|
|
|
|
}
|