刘俊驰 1 vuosi sitten
vanhempi
commit
f4dd89833d

+ 3 - 2
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/TenantGroupAlbumController.java

@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -34,13 +35,13 @@ public class TenantGroupAlbumController {
 
 	@ApiOperation(value = "学生可购买机构专辑信息")
 	@GetMapping("/buyAlbumInfo")
-	public HttpResponseResult<List<TenantGroupAlbumWrapper.BuyTenantAlbum>> buyAlbumInfo() {
+	public HttpResponseResult<List<TenantGroupAlbumWrapper.BuyTenantAlbum>> buyAlbumInfo(@RequestParam(required = false) Long tenantGroupAlbumId) {
 
         SysUser user = sysUserFeignService.queryUserInfo();
         if (user == null || null == user.getId()) {
             return HttpResponseResult.failed(HttpStatus.FORBIDDEN, "请登录");
         }
     
-		return HttpResponseResult.succeed(tenantGroupAlbumService.buyAlbumInfo(user.getId(), ClientEnum.STUDENT));
+		return HttpResponseResult.succeed(tenantGroupAlbumService.buyAlbumInfo(tenantGroupAlbumId,user.getId(), ClientEnum.STUDENT));
 	}
 }

+ 3 - 2
cooleshow-app/src/main/java/com/yonge/cooleshow/tenant/controller/TenantGroupAlbumController.java

@@ -14,6 +14,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
@@ -33,13 +34,13 @@ public class TenantGroupAlbumController {
 
 	@ApiOperation(value = "机构可购买机构专辑信息")
 	@GetMapping("/buyAlbumInfo")
-	public HttpResponseResult<List<TenantGroupAlbumWrapper.BuyTenantAlbum>> buyAlbumInfo() {
+	public HttpResponseResult<List<TenantGroupAlbumWrapper.BuyTenantAlbum>> buyAlbumInfo(@RequestParam(required = false) Long tenantGroupAlbumId) {
 
         SysUser user = sysUserFeignService.queryUserInfo();
         if (user == null || null == user.getId()) {
             return HttpResponseResult.failed(HttpStatus.FORBIDDEN, "请登录");
         }
     
-		return HttpResponseResult.succeed(tenantGroupAlbumService.buyAlbumInfo(user.getId(), ClientEnum.TENANT));
+		return HttpResponseResult.succeed(tenantGroupAlbumService.buyAlbumInfo(tenantGroupAlbumId, user.getId(), ClientEnum.TENANT));
 	}
 }

+ 4 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TenantGroupAlbumService.java

@@ -2,7 +2,6 @@ package com.yonge.cooleshow.biz.dal.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.microsvc.toolkit.common.response.ParamResponse;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
 import com.yonge.cooleshow.biz.dal.entity.TenantGroupAlbum;
@@ -47,8 +46,9 @@ public interface TenantGroupAlbumService extends IService<TenantGroupAlbum>  {
     /**
      * 可购买机构信息
      *
-     * @param userId 用户ID
-     * @param clientType 客户端类型
+     * @param tenantGroupAlbumId
+     * @param userId             用户ID
+     * @param clientType         客户端类型
      */
-    List<TenantGroupAlbumWrapper.BuyTenantAlbum> buyAlbumInfo(Long userId, ClientEnum clientType);
+    List<TenantGroupAlbumWrapper.BuyTenantAlbum> buyAlbumInfo(Long tenantGroupAlbumId, Long userId, ClientEnum clientType);
 }

+ 3 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantGroupAlbumServiceImpl.java

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.biz.dal.dao.UserOrderDao;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.entity.TenantStaff;
-import com.yonge.cooleshow.biz.dal.entity.UserOrder;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
 import com.yonge.cooleshow.biz.dal.service.TenantStaffService;
@@ -14,7 +13,6 @@ import com.yonge.toolset.base.exception.BizException;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.beans.BeanUtils;
 import lombok.extern.slf4j.Slf4j;
 import com.yonge.cooleshow.biz.dal.entity.TenantGroupAlbum;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantGroupAlbumWrapper;
@@ -87,11 +85,12 @@ public class TenantGroupAlbumServiceImpl extends ServiceImpl<TenantGroupAlbumMap
     }
 
     @Override
-    public List<TenantGroupAlbumWrapper.BuyTenantAlbum> buyAlbumInfo(Long userId, ClientEnum clientType) {
+    public List<TenantGroupAlbumWrapper.BuyTenantAlbum> buyAlbumInfo(Long tenantGroupAlbumId, Long userId, ClientEnum clientType) {
         // 学生端 查看小组专辑 获取专辑基本信息, 机构端查看机构专辑 获取专辑基本信息
 
         TenantGroupAlbumWrapper.BuyTenantAlbumQuery query = new TenantGroupAlbumWrapper.BuyTenantAlbumQuery();
-        if (clientType == ClientEnum.STUDENT) {
+        query.setTenantGroupAlbumId(tenantGroupAlbumId);
+        if (tenantGroupAlbumId != null) {} else if (clientType == ClientEnum.STUDENT) {
             Student student = studentService.getById(userId);
             if (student.getTenantId() == null || student.getTenantId() <=0 || student.getTenantGroupId() == null) {
                 throw new BizException("学生未加入机构或者小组");

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantGroupAlbumWrapper.java

@@ -186,6 +186,9 @@ public class TenantGroupAlbumWrapper {
 
         @ApiModelProperty("小组ID")
         private Long tenantGroupId;
+
+        @ApiModelProperty("机构小组专辑ID")
+        private Long tenantGroupAlbumId;
     }
 
 

+ 9 - 4
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantGroupAlbumMapper.xml

@@ -57,7 +57,7 @@
         t.subject_types_,
         t.purchase_types_,
         t.purchase_json_
-        <if test="param.tenantGroupId != null">
+        <if test="param.tenantGroupId != null or param.tenantGroupAlbumId != null">
             ,
             t2.id_ as tenantGroupAlbumId,
             t2.tenant_group_id_,
@@ -70,7 +70,7 @@
         </if>
         from tenant_album t
 
-        <if test="param.tenantGroupId != null">
+        <if test="param.tenantGroupId != null or param.tenantGroupAlbumId != null">
             left join tenant_group_album t2 on t2.tenant_album_id_ = t.id_
         </if>
         <if test="param.tenantId != null">
@@ -81,9 +81,14 @@
             <if test="param.tenantId != null">
                 and t1.tenant_id_ = #{param.tenantId}
             </if>
-            <if test="param.tenantGroupId != null">
+            <if test="param.tenantGroupId != null  or param.tenantGroupAlbumId != null">
                 and t2.status_ = 1 and t2.del_flag_ = 0
-                and t2.tenant_group_id_ = #{param.tenantGroupId}
+                <if test="param.tenantGroupId != null">
+                    and t2.tenant_group_id_ = #{param.tenantGroupId}
+                </if>
+                <if test="param.tenantGroupAlbumId != null">
+                    and t2.id_ = #{param.tenantGroupAlbumId}
+                </if>
             </if>
         </where>
     </select>