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

This commit is contained in:
OPGame
2019-09-06 11:12:05 +08:00
parent 6dcd046c51
commit 5e10d08a7e
2 changed files with 2 additions and 2 deletions

View File

@@ -109,7 +109,7 @@ public class CategoryController {
@DeleteMapping("/{categoryId}")
@PreAuthorize("@pms.hasPermission('prod:category:delete')")
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("请删除子分类,再删除该分类");
}
categoryService.deleteCategroy(categoryId);

View File

@@ -46,7 +46,7 @@
<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 id="tableCategory" resultType="com.yami.shop.bean.model.Category">