Parcourir la source

1.添加专辑分类接口同步,添加下拉数据接口

yuanliang il y a 1 an
Parent
commit
577fb9c278

+ 20 - 6
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantAlbumCategoryController.java

@@ -11,9 +11,12 @@ import com.yonge.cooleshow.admin.io.request.TenantAlbumCategoryVo;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategory;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategoryDetail;
 import com.yonge.cooleshow.biz.dal.service.SysUserService;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumCategoryDetailService;
 import com.yonge.cooleshow.biz.dal.service.TenantAlbumCategoryService;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumCategoryWrapper;
+import com.yonge.toolset.base.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -45,6 +48,9 @@ public class TenantAlbumCategoryController {
     @Autowired
     private TenantAlbumCategoryService tenantAlbumCategoryService;
 
+    @Autowired
+    private TenantAlbumCategoryDetailService tenantAlbumCategoryDetailService;
+
     @Resource
     private SysUserFeignService sysUserFeignService;
 
@@ -52,9 +58,6 @@ public class TenantAlbumCategoryController {
     private SysUserService sysUserService;
 
     @ApiOperation(value = "详情", notes = "机构专辑分类-根据详情ID查询单条, 传入id")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
-    })
     @PreAuthorize("@auditsvc.hasPermissions('tenantAlbumCategory/detail', {'BACKEND'})")
     @GetMapping("/detail/{id}")
     public R<TenantAlbumCategoryWrapper.TenantAlbumCategory> detail(@PathVariable("id") Long id) {
@@ -117,13 +120,24 @@ public class TenantAlbumCategoryController {
     }
 
     @ApiOperation(value = "删除", notes = "机构专辑分类- 传入id")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
-    })
     @PreAuthorize("@auditsvc.hasPermissions('tenantAlbumCategory/remove', {'BACKEND'})")
     @PostMapping("/remove")
     public R<Boolean> remove(@RequestParam Long id) {
 
         return R.from(tenantAlbumCategoryService.delete(id));
     }
+
+    @ApiOperation(value = "获取专辑分类值列表")
+    @PreAuthorize("@auditsvc.hasPermissions('tenantAlbumCategory/queryCategoryValue', {'BACKEND'})")
+    @GetMapping("/queryCategoryValue")
+    public R<List<TenantAlbumCategoryDetail>> queryCategoryValue(@RequestParam("id") Long id) {
+        TenantAlbumCategory albumCategory = tenantAlbumCategoryService.getById(id);
+        if (albumCategory == null) {
+            throw new BizException("专辑分类不存在");
+        }
+        List<TenantAlbumCategoryDetail> detailList = tenantAlbumCategoryDetailService.lambdaQuery()
+                .eq(TenantAlbumCategoryDetail::getTenantAlbumCategoryId, id)
+                .list();
+        return R.from(detailList);
+    }
 }

+ 21 - 7
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/TenantAlbumCategoryController.java

@@ -11,10 +11,12 @@ import com.yonge.cooleshow.admin.io.request.TenantAlbumCategoryVo;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategory;
-import com.yonge.cooleshow.biz.dal.mapper.SysUserMapper;
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumCategoryDetail;
 import com.yonge.cooleshow.biz.dal.service.SysUserService;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumCategoryDetailService;
 import com.yonge.cooleshow.biz.dal.service.TenantAlbumCategoryService;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumCategoryWrapper;
+import com.yonge.toolset.base.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -46,6 +48,9 @@ public class TenantAlbumCategoryController {
     @Autowired
     private TenantAlbumCategoryService tenantAlbumCategoryService;
 
+    @Autowired
+    private TenantAlbumCategoryDetailService tenantAlbumCategoryDetailService;
+
     @Resource
     private SysUserFeignService sysUserFeignService;
 
@@ -53,9 +58,6 @@ public class TenantAlbumCategoryController {
     private SysUserService sysUserService;
 
     @ApiOperation(value = "详情", notes = "机构专辑分类-根据详情ID查询单条, 传入id")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
-    })
     @PreAuthorize("@auditsvc.hasPermissions('tenantAlbumCategory/detail', {'BACKEND'})")
     @GetMapping("/detail/{id}")
     public R<TenantAlbumCategoryWrapper.TenantAlbumCategory> detail(@PathVariable("id") Long id) {
@@ -118,13 +120,25 @@ public class TenantAlbumCategoryController {
     }
 
     @ApiOperation(value = "删除", notes = "机构专辑分类- 传入id")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
-    })
     @PreAuthorize("@auditsvc.hasPermissions('tenantAlbumCategory/remove', {'BACKEND'})")
     @PostMapping("/remove")
     public R<Boolean> remove(@RequestParam Long id) {
 
         return R.from(tenantAlbumCategoryService.delete(id));
     }
+
+    @ApiOperation(value = "获取专辑分类值列表")
+    @PreAuthorize("@auditsvc.hasPermissions('tenantAlbumCategory/queryCategoryValue', {'BACKEND'})")
+    @GetMapping("/queryCategoryValue")
+    public R<List<TenantAlbumCategoryDetail>> queryCategoryValue(@RequestParam("id") Long id) {
+        TenantAlbumCategory albumCategory = tenantAlbumCategoryService.getById(id);
+        if (albumCategory == null) {
+            throw new BizException("专辑分类不存在");
+        }
+        List<TenantAlbumCategoryDetail> detailList = tenantAlbumCategoryDetailService.lambdaQuery()
+                .eq(TenantAlbumCategoryDetail::getTenantAlbumCategoryId, id)
+                .list();
+        return R.from(detailList);
+    }
+
 }

+ 5 - 8
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantAlbumCategoryServiceImpl.java

@@ -84,7 +84,7 @@ public class TenantAlbumCategoryServiceImpl extends ServiceImpl<TenantAlbumCateg
         Integer count = this.lambdaQuery()
                 .eq(TenantAlbumCategory::getName, tenantAlbumCategory.getName())
                 .eq(TenantAlbumCategory::getCategoryType, tenantAlbumCategory.getCategoryType())
-                .eq(TenantAlbumCategory::getDelFlag, 0)
+                .eq(TenantAlbumCategory::getDelFlag, false)
                 .count();
         if (count > 0) {
             throw new BizException("专辑分类名称已存在");
@@ -114,7 +114,7 @@ public class TenantAlbumCategoryServiceImpl extends ServiceImpl<TenantAlbumCateg
         Integer count = this.lambdaQuery()
                 .eq(TenantAlbumCategory::getName, tenantAlbumCategory.getName())
                 .eq(TenantAlbumCategory::getCategoryType, tenantAlbumCategory.getCategoryType())
-                .eq(TenantAlbumCategory::getDelFlag, 0)
+                .eq(TenantAlbumCategory::getDelFlag, false)
                 .ne(TenantAlbumCategory::getId, tenantAlbumCategory.getId())
                 .count();
         if (count > 0) {
@@ -159,12 +159,9 @@ public class TenantAlbumCategoryServiceImpl extends ServiceImpl<TenantAlbumCateg
                 .eq(TenantAlbumCategoryDetail::getTenantAlbumCategoryId, albumCategory.getId())
                 .list();
         checkTenantAlbumCategoryDetailUsed(albumCategory.getCategoryType(), list);
-
-        tenantAlbumCategoryDetailService.lambdaUpdate()
-                .eq(TenantAlbumCategoryDetail::getTenantAlbumCategoryId, id)
-                .remove();
-        this.removeById(id);
-        return null;
+        albumCategory.setDelFlag(true);
+        this.updateById(albumCategory);
+        return true;
     }
 
     /**