feat(新增-商品规格管理): 删除功能
Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
parent
605647283a
commit
27105b3220
|
@ -35,4 +35,11 @@ public class ProductSpecController {
|
||||||
productSpecService.updateById(productSpec);
|
productSpecService.updateById(productSpec);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除功能", description = "删除功能")
|
||||||
|
@DeleteMapping("deleteById/{id}")
|
||||||
|
public Result<Long> removeById(@PathVariable Long id) {
|
||||||
|
productSpecService.deleteById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -27,4 +27,11 @@ public interface ProductSpecMapper {
|
||||||
* @param productSpec 商品规格实体类
|
* @param productSpec 商品规格实体类
|
||||||
*/
|
*/
|
||||||
void updateById(ProductSpec productSpec);
|
void updateById(ProductSpec productSpec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除功能
|
||||||
|
*
|
||||||
|
* @param id 要删除的ID
|
||||||
|
*/
|
||||||
|
void deleteById(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,4 +26,11 @@ public interface ProductSpecService {
|
||||||
* @param productSpec 商品规格实体类
|
* @param productSpec 商品规格实体类
|
||||||
*/
|
*/
|
||||||
void updateById(ProductSpec productSpec);
|
void updateById(ProductSpec productSpec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除功能
|
||||||
|
*
|
||||||
|
* @param id 要删除的ID
|
||||||
|
*/
|
||||||
|
void deleteById(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.atguigu.exception.BunnyException;
|
||||||
import com.atguigu.spzx.manger.mapper.ProductSpecMapper;
|
import com.atguigu.spzx.manger.mapper.ProductSpecMapper;
|
||||||
import com.atguigu.spzx.manger.service.ProductSpecService;
|
import com.atguigu.spzx.manger.service.ProductSpecService;
|
||||||
import com.atguigu.spzx.model.entity.product.ProductSpec;
|
import com.atguigu.spzx.model.entity.product.ProductSpec;
|
||||||
|
import com.atguigu.utils.StringEmptyUtil;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
@ -17,6 +18,8 @@ import java.util.List;
|
||||||
public class ProductSpecServiceImpl implements ProductSpecService {
|
public class ProductSpecServiceImpl implements ProductSpecService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductSpecMapper productSpecMapper;
|
private ProductSpecMapper productSpecMapper;
|
||||||
|
@Autowired
|
||||||
|
private StringEmptyUtil emptyUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
|
@ -61,4 +64,15 @@ public class ProductSpecServiceImpl implements ProductSpecService {
|
||||||
|
|
||||||
productSpecMapper.updateById(productSpec);
|
productSpecMapper.updateById(productSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除功能
|
||||||
|
*
|
||||||
|
* @param id 要删除的ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteById(Long id) {
|
||||||
|
emptyUtil.isEmpty(id, MessageConstant.UPDATE_ID_IS_NOT_EMPTY);
|
||||||
|
productSpecMapper.deleteById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,14 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 删除功能 -->
|
||||||
|
<update id="deleteById">
|
||||||
|
update product_spec
|
||||||
|
set is_deleted = 1,
|
||||||
|
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