feat(新增): 品牌列表

Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
bunny 2024-03-26 10:22:22 +08:00
parent 1dd176a1af
commit 8dddea3bf5
5 changed files with 42 additions and 0 deletions

View File

@ -9,6 +9,8 @@ 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/brand")
@ -43,4 +45,11 @@ public class BrandController {
brandService.deleteById(id);
return Result.success();
}
@Operation(summary = "品牌列表", description = "品牌列表接口")
@GetMapping("findAll")
public Result<List<Brand>> findAll() {
List<Brand> list = brandService.findAll();
return Result.success(list);
}
}

View File

@ -32,4 +32,11 @@ public interface BrandMapper {
* @param id 品牌id
*/
void deleteById(Long id);
/**
* 品牌列表
*
* @return 品牌列表
*/
List<Brand> findAll();
}

View File

@ -3,6 +3,8 @@ package com.atguigu.spzx.manger.service;
import com.atguigu.spzx.model.entity.product.Brand;
import com.github.pagehelper.PageInfo;
import java.util.List;
public interface BrandService {
/**
* 品牌列表查询
@ -33,4 +35,11 @@ public interface BrandService {
* @param id 品牌id
*/
void deleteById(Long id);
/**
* 品牌列表
*
* @return 品牌列表
*/
List<Brand> findAll();
}

View File

@ -68,4 +68,14 @@ public class BrandServiceImpl implements BrandService {
emptyUtil.isEmpty(id, MessageConstant.DELETE_ID_IS_NOT_EMPTY);
brandMapper.deleteById(id);
}
/**
* 品牌列表
*
* @return 品牌列表
*/
@Override
public List<Brand> findAll() {
return brandMapper.findAll();
}
}

View File

@ -42,4 +42,11 @@
where is_deleted = 0
order by id desc
</select>
<!-- 品牌列表 -->
<select id="findAll" resultType="com.atguigu.spzx.model.entity.product.Brand">
select
<include refid="columns"/>
from brand where is_deleted = 0 order by id desc
</select>
</mapper>