feat(新增-商品规格管理): 加载商品规格数据
Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
parent
0affca82f0
commit
77bd3496d5
|
@ -3,12 +3,15 @@ package com.atguigu.spzx.manger.controller;
|
|||
import com.atguigu.spzx.manger.service.ProductSpecService;
|
||||
import com.atguigu.spzx.model.entity.product.ProductSpec;
|
||||
import com.atguigu.spzx.model.vo.result.Result;
|
||||
import com.atguigu.spzx.model.vo.result.ResultCodeEnum;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "商品规格管理")
|
||||
@RestController
|
||||
@RequestMapping(value = "/admin/product/productSpec")
|
||||
|
@ -43,4 +46,11 @@ public class ProductSpecController {
|
|||
productSpecService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "加载商品规格数据", description = "加载商品规格数据")
|
||||
@GetMapping("findAll")
|
||||
public Result<List<ProductSpec>> findAll() {
|
||||
List<ProductSpec> list = productSpecService.findAll();
|
||||
return Result.build(list, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
|
@ -34,4 +34,11 @@ public interface ProductSpecMapper {
|
|||
* @param id 要删除的ID
|
||||
*/
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 加载商品规格数据
|
||||
*
|
||||
* @return 列表
|
||||
*/
|
||||
List<ProductSpec> findAll();
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.atguigu.spzx.manger.service;
|
|||
import com.atguigu.spzx.model.entity.product.ProductSpec;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProductSpecService {
|
||||
/**
|
||||
* 列表查询
|
||||
|
@ -33,4 +35,11 @@ public interface ProductSpecService {
|
|||
* @param id 要删除的ID
|
||||
*/
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 加载商品规格数据
|
||||
*
|
||||
* @return 列表
|
||||
*/
|
||||
List<ProductSpec> findAll();
|
||||
}
|
||||
|
|
|
@ -75,4 +75,14 @@ public class ProductSpecServiceImpl implements ProductSpecService {
|
|||
emptyUtil.isEmpty(id, MessageConstant.UPDATE_ID_IS_NOT_EMPTY);
|
||||
productSpecMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载商品规格数据
|
||||
*
|
||||
* @return 列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProductSpec> findAll() {
|
||||
return productSpecMapper.findAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,4 +41,11 @@
|
|||
from product_spec
|
||||
where is_deleted = 0 order by id desc
|
||||
</select>
|
||||
|
||||
<!-- 加载商品规格数据 -->
|
||||
<select id="findAll" resultType="com.atguigu.spzx.model.entity.product.ProductSpec">
|
||||
select
|
||||
<include refid="columns"/>
|
||||
from product_spec where is_deleted = 0 order by id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue