dev-v2 #3
|
@ -28,4 +28,11 @@ public class ProductSpecController {
|
||||||
productSpecService.save(productSpec);
|
productSpecService.save(productSpec);
|
||||||
return Result.success();
|
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 商品规格实体类
|
* @param productSpec 商品规格实体类
|
||||||
*/
|
*/
|
||||||
void save(ProductSpec productSpec);
|
void save(ProductSpec productSpec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改功能
|
||||||
|
*
|
||||||
|
* @param productSpec 商品规格实体类
|
||||||
|
*/
|
||||||
|
void updateById(ProductSpec productSpec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,11 @@ public interface ProductSpecService {
|
||||||
* @param productSpec 商品规格实体类
|
* @param productSpec 商品规格实体类
|
||||||
*/
|
*/
|
||||||
void save(ProductSpec productSpec);
|
void save(ProductSpec productSpec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改功能
|
||||||
|
*
|
||||||
|
* @param productSpec 商品规格实体类
|
||||||
|
*/
|
||||||
|
void updateById(ProductSpec productSpec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,4 +47,18 @@ public class ProductSpecServiceImpl implements ProductSpecService {
|
||||||
|
|
||||||
productSpecMapper.save(productSpec);
|
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);
|
values (#{id}, #{specName}, #{specValue}, now(), now(), 0);
|
||||||
</insert>
|
</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 id="findByPage" resultType="com.atguigu.spzx.model.entity.product.ProductSpec">
|
||||||
select
|
select
|
||||||
|
|
Loading…
Reference in New Issue