feat(新增-商品规格管理): 修改功能
Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
parent
b70fc9ed4e
commit
605647283a
|
@ -28,4 +28,11 @@ public class ProductSpecController {
|
|||
productSpecService.save(productSpec);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "修改功能", description = "修改功能")
|
||||
@PutMapping("updateById")
|
||||
public Result<ProductSpec> updateById(@RequestBody ProductSpec productSpec) {
|
||||
productSpecService.updateById(productSpec);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -20,4 +20,11 @@ public interface ProductSpecMapper {
|
|||
* @param productSpec 商品规格实体类
|
||||
*/
|
||||
void save(ProductSpec productSpec);
|
||||
|
||||
/**
|
||||
* 修改功能
|
||||
*
|
||||
* @param productSpec 商品规格实体类
|
||||
*/
|
||||
void updateById(ProductSpec productSpec);
|
||||
}
|
||||
|
|
|
@ -19,4 +19,11 @@ public interface ProductSpecService {
|
|||
* @param productSpec 商品规格实体类
|
||||
*/
|
||||
void save(ProductSpec productSpec);
|
||||
|
||||
/**
|
||||
* 修改功能
|
||||
*
|
||||
* @param productSpec 商品规格实体类
|
||||
*/
|
||||
void updateById(ProductSpec productSpec);
|
||||
}
|
||||
|
|
|
@ -47,4 +47,18 @@ public class ProductSpecServiceImpl implements ProductSpecService {
|
|||
|
||||
productSpecMapper.save(productSpec);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改功能
|
||||
*
|
||||
* @param productSpec 商品规格实体类
|
||||
*/
|
||||
@Override
|
||||
public void updateById(ProductSpec productSpec) {
|
||||
if (productSpec == null) {
|
||||
throw new BunnyException(MessageConstant.UPDATE_DTO_IS_NULL);
|
||||
}
|
||||
|
||||
productSpecMapper.updateById(productSpec);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,20 @@
|
|||
values (#{id}, #{specName}, #{specValue}, now(), now(), 0);
|
||||
</insert>
|
||||
|
||||
<!-- 修改功能 -->
|
||||
<update id="updateById">
|
||||
update product_spec
|
||||
set
|
||||
<if test="specName != null and specName != ''">
|
||||
spec_name = #{specName},
|
||||
</if>
|
||||
<if test="specValue != null and specValue != ''">
|
||||
spec_value = #{specValue},
|
||||
</if>
|
||||
update_time = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 列表查询 -->
|
||||
<select id="findByPage" resultType="com.atguigu.spzx.model.entity.product.ProductSpec">
|
||||
select
|
||||
|
|
Loading…
Reference in New Issue