分类被禁用时,前端接口不显示

master
OPGame 7 years ago
parent 6dcd046c51
commit 5e10d08a7e

@ -109,7 +109,7 @@ public class CategoryController {
@DeleteMapping("/{categoryId}") @DeleteMapping("/{categoryId}")
@PreAuthorize("@pms.hasPermission('prod:category:delete')") @PreAuthorize("@pms.hasPermission('prod:category:delete')")
public ResponseEntity<String> delete(@PathVariable("categoryId") Long categoryId){ public ResponseEntity<String> delete(@PathVariable("categoryId") Long categoryId){
if (CollectionUtil.isNotEmpty(categoryService.listByParentId(categoryId))) { if (categoryService.count(new LambdaQueryWrapper<Category>().eq(Category::getParentId,categoryId)) >0) {
return ResponseEntity.badRequest().body("请删除子分类,再删除该分类"); return ResponseEntity.badRequest().body("请删除子分类,再删除该分类");
} }
categoryService.deleteCategroy(categoryId); categoryService.deleteCategroy(categoryId);

@ -46,7 +46,7 @@
<select id="listByParentId" resultType="com.yami.shop.bean.model.Category"> <select id="listByParentId" resultType="com.yami.shop.bean.model.Category">
select category_id,category_name,`seq`,`status`,pic from tz_category where parent_id = #{parentId} order by seq select category_id,category_name,`seq`,`status`,pic from tz_category where parent_id = #{parentId} and `status` = 1 order by seq
</select> </select>
<select id="tableCategory" resultType="com.yami.shop.bean.model.Category"> <select id="tableCategory" resultType="com.yami.shop.bean.model.Category">

Loading…
Cancel
Save