feat(新增): 根据id删除品牌
Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
parent
a7afceb704
commit
b77dbadd4a
|
@ -36,4 +36,11 @@ public class BrandController {
|
||||||
brandService.updateById(brand);
|
brandService.updateById(brand);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除品牌", description = "删除品牌")
|
||||||
|
@DeleteMapping("deleteById/{id}")
|
||||||
|
public Result<Long> deleteById(@PathVariable Long id) {
|
||||||
|
brandService.deleteById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -25,4 +25,11 @@ public interface BrandMapper {
|
||||||
* @param brand 品牌实体类
|
* @param brand 品牌实体类
|
||||||
*/
|
*/
|
||||||
void updateById(Brand brand);
|
void updateById(Brand brand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除品牌
|
||||||
|
*
|
||||||
|
* @param id 品牌id
|
||||||
|
*/
|
||||||
|
void deleteById(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,4 +26,11 @@ public interface BrandService {
|
||||||
* @param brand 品牌实体类
|
* @param brand 品牌实体类
|
||||||
*/
|
*/
|
||||||
void updateById(Brand brand);
|
void updateById(Brand brand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除品牌
|
||||||
|
*
|
||||||
|
* @param id 品牌id
|
||||||
|
*/
|
||||||
|
void deleteById(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,4 +57,15 @@ public class BrandServiceImpl implements BrandService {
|
||||||
|
|
||||||
brandMapper.updateById(brand);
|
brandMapper.updateById(brand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id删除品牌
|
||||||
|
*
|
||||||
|
* @param id 品牌id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteById(Long id) {
|
||||||
|
emptyUtil.isEmpty(id, MessageConstant.DELETE_ID_IS_NOT_EMPTY);
|
||||||
|
brandMapper.deleteById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,14 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 根据id删除品牌 -->
|
||||||
|
<update id="deleteById">
|
||||||
|
update brand
|
||||||
|
set is_deleted = 1,
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<!-- 查找分页品牌 -->
|
<!-- 查找分页品牌 -->
|
||||||
<select id="findByPage" resultType="com.atguigu.spzx.model.entity.product.Brand">
|
<select id="findByPage" resultType="com.atguigu.spzx.model.entity.product.Brand">
|
||||||
select
|
select
|
||||||
|
|
Loading…
Reference in New Issue