dev-v2 #3

Merged
bunny merged 122 commits from dev-v2 into master-v2 2024-03-30 23:40:58 +08:00
5 changed files with 49 additions and 0 deletions
Showing only changes of commit 605647283a - Show all commits

View File

@ -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();
}
} }

View File

@ -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);
} }

View File

@ -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);
} }

View File

@ -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);
}
} }

View File

@ -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