parent
bc7bc4afd2
commit
cd1e39271a
|
@ -7,10 +7,7 @@ import com.github.pagehelper.PageInfo;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Tag(name = "品牌管理")
|
@Tag(name = "品牌管理")
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -25,4 +22,11 @@ public class BrandController {
|
||||||
PageInfo<Brand> pageInfo = brandService.findByPage(page, limit);
|
PageInfo<Brand> pageInfo = brandService.findByPage(page, limit);
|
||||||
return Result.success(pageInfo);
|
return Result.success(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "品牌添加", description = "品牌添加")
|
||||||
|
@PostMapping("save")
|
||||||
|
public Result<Brand> save(@RequestBody Brand brand) {
|
||||||
|
brandService.save(brand);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -11,4 +11,11 @@ public interface BrandMapper {
|
||||||
* @return 品牌列表
|
* @return 品牌列表
|
||||||
*/
|
*/
|
||||||
List<Brand> findByPage();
|
List<Brand> findByPage();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌添加
|
||||||
|
*
|
||||||
|
* @param brand 品牌实体类
|
||||||
|
*/
|
||||||
|
void save(Brand brand);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,11 @@ public interface BrandService {
|
||||||
* @return 品牌分页结果
|
* @return 品牌分页结果
|
||||||
*/
|
*/
|
||||||
PageInfo<Brand> findByPage(Integer page, Integer limit);
|
PageInfo<Brand> findByPage(Integer page, Integer limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌添加
|
||||||
|
*
|
||||||
|
* @param brand 品牌实体类
|
||||||
|
*/
|
||||||
|
void save(Brand brand);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,4 +31,14 @@ public class BrandServiceImpl implements BrandService {
|
||||||
startPage.close();
|
startPage.close();
|
||||||
return new PageInfo<>(brandList);
|
return new PageInfo<>(brandList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌添加
|
||||||
|
*
|
||||||
|
* @param brand 品牌实体类
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void save(Brand brand) {
|
||||||
|
brandMapper.save(brand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,12 @@
|
||||||
id,name,logo,create_time,update_time,is_deleted
|
id,name,logo,create_time,update_time,is_deleted
|
||||||
</sql>
|
</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 id="findByPage" resultType="com.atguigu.spzx.model.entity.product.Brand">
|
||||||
select
|
select
|
||||||
|
|
|
@ -2,9 +2,13 @@ package com.atguigu.spzx.model.entity.product;
|
||||||
|
|
||||||
import com.atguigu.spzx.model.entity.base.BaseEntity;
|
import com.atguigu.spzx.model.entity.base.BaseEntity;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.*;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
@Schema(description = "品牌实体类")
|
@Schema(description = "品牌实体类")
|
||||||
public class Brand extends BaseEntity {
|
public class Brand extends BaseEntity {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue