dev-v2 #3

Merged
bunny merged 122 commits from dev-v2 into master-v2 2024-03-30 23:40:58 +08:00
6 changed files with 47 additions and 9 deletions
Showing only changes of commit cd1e39271a - Show all commits

View File

@ -7,10 +7,7 @@ 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@Tag(name = "品牌管理")
@RestController
@ -25,4 +22,11 @@ public class BrandController {
PageInfo<Brand> pageInfo = brandService.findByPage(page, limit);
return Result.success(pageInfo);
}
@Operation(summary = "品牌添加", description = "品牌添加")
@PostMapping("save")
public Result<Brand> save(@RequestBody Brand brand) {
brandService.save(brand);
return Result.success();
}
}

View File

@ -11,4 +11,11 @@ public interface BrandMapper {
* @return 品牌列表
*/
List<Brand> findByPage();
/**
* 品牌添加
*
* @param brand 品牌实体类
*/
void save(Brand brand);
}

View File

@ -12,4 +12,11 @@ public interface BrandService {
* @return 品牌分页结果
*/
PageInfo<Brand> findByPage(Integer page, Integer limit);
/**
* 品牌添加
*
* @param brand 品牌实体类
*/
void save(Brand brand);
}

View File

@ -31,4 +31,14 @@ public class BrandServiceImpl implements BrandService {
startPage.close();
return new PageInfo<>(brandList);
}
/**
* 品牌添加
*
* @param brand 品牌实体类
*/
@Override
public void save(Brand brand) {
brandMapper.save(brand);
}
}

View File

@ -6,6 +6,12 @@
id,name,logo,create_time,update_time,is_deleted
</sql>
<!-- 品牌添加 -->
<insert id="save">
insert into brand (id, name, logo, create_time, update_time, is_deleted)
values (#{id}, #{name}, #{logo}, now(), now(), 0);
</insert>
<!-- 查找分页品牌 -->
<select id="findByPage" resultType="com.atguigu.spzx.model.entity.product.Brand">
select

View File

@ -2,9 +2,13 @@ package com.atguigu.spzx.model.entity.product;
import com.atguigu.spzx.model.entity.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.*;
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Schema(description = "品牌实体类")
public class Brand extends BaseEntity {