浏览代码

1.机构管理需求新增

yuanliang 1 年之前
父节点
当前提交
94cb5ff19e
共有 13 个文件被更改,包括 741 次插入5 次删除
  1. 40 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantAlbumPurchaseController.java
  2. 101 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/UserTenantBindRecordController.java
  3. 91 0
      cooleshow-app/src/main/java/com/yonge/cooleshow/admin/io/request/UserTenantBindRecordVo.java
  4. 4 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TenantAlbumPurchase.java
  5. 46 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserTenantBindRecord.java
  6. 28 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/mapper/UserTenantBindRecordMapper.java
  7. 43 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserTenantBindRecordService.java
  8. 8 4
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantActivationCodeServiceImpl.java
  9. 116 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserTenantBindRecordServiceImpl.java
  10. 13 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumPurchaseWrapper.java
  11. 148 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/UserTenantBindRecordWrapper.java
  12. 15 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantAlbumPurchaseMapper.xml
  13. 88 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/UserTenantBindRecordMapper.xml

+ 40 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/TenantAlbumPurchaseController.java

@@ -0,0 +1,40 @@
+package com.yonge.cooleshow.admin.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.microsvc.toolkit.common.response.paging.PageInfo;
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.yonge.cooleshow.biz.dal.service.TenantAlbumPurchaseService;
+import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumPurchaseWrapper;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.admin:}/tenantAlbumPurchase")
+@Api(tags = "机构专辑采购")
+public class TenantAlbumPurchaseController extends BaseController {
+
+    @Autowired
+    private TenantAlbumPurchaseService tenantAlbumPurchaseService;
+
+    @ApiOperation(value = "查询分页", notes = "机构专辑采购- 传入 TenantAlbumPurchaseVo.TenantAlbumPurchaseQuery")
+    @PostMapping("/page")
+    public HttpResponseResult<PageInfo<TenantAlbumPurchaseWrapper.TenantAlbumPurchase>> page(
+            @RequestBody TenantAlbumPurchaseWrapper.TenantAlbumPurchaseQuery query) {
+        // 查询数据
+        IPage<TenantAlbumPurchaseWrapper.TenantAlbumPurchase> pages =
+                tenantAlbumPurchaseService.selectPage(QueryInfo.getPage(query), query);
+        return succeed(QueryInfo.pageInfo(pages, pages.getRecords()));
+    }
+}

+ 101 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/UserTenantBindRecordController.java

@@ -0,0 +1,101 @@
+package com.yonge.cooleshow.admin.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.microsvc.toolkit.common.response.paging.PageInfo;
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.microsvc.toolkit.common.response.template.R;
+import com.yonge.cooleshow.admin.io.request.UserTenantBindRecordVo;
+import com.yonge.cooleshow.biz.dal.entity.UserTenantBindRecord;
+import com.yonge.cooleshow.biz.dal.service.UserTenantBindRecordService;
+import com.yonge.cooleshow.biz.dal.wrapper.UserTenantBindRecordWrapper;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.toolset.base.exception.BizException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.admin:}/userTenantBindRecord")
+@Api(tags = "用户机构绑定解绑记录")
+public class UserTenantBindRecordController extends BaseController {
+
+    @Autowired
+    private UserTenantBindRecordService userTenantBindRecordService;
+
+    @ApiOperation(value = "详情", notes = "用户机构绑定解绑记录-根据详情ID查询单条, 传入id")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @PreAuthorize("@pcs.hasPermissions('userTenantBindRecord/detail', {'BACKEND'})")
+//    @GetMapping("/detail/{id}")
+    public R<UserTenantBindRecordVo.UserTenantBindRecord> detail(@PathVariable("id") Long id) {
+
+        UserTenantBindRecord wrapper = userTenantBindRecordService.detail(id);
+
+        return R.from(UserTenantBindRecordVo.UserTenantBindRecord.from(JSON.toJSONString(wrapper)));
+    }
+
+    @ApiOperation(value = "查询分页", notes = "用户机构绑定解绑记录- 传入 UserTenantBindRecordVo.UserTenantBindRecordQuery")
+    @PreAuthorize("@pcs.hasPermissions('userTenantBindRecord/page', {'BACKEND'})")
+    @PostMapping("/page")
+    public R<PageInfo<UserTenantBindRecordWrapper.UserTenantBindRecord>> page(@RequestBody UserTenantBindRecordWrapper.UserTenantBindRecordQuery query) {
+
+        if (query.getTenantId() == null || StringUtils.isEmpty(query.getUserType())) {
+            throw new BizException("参数错误");
+        }
+        // 查询数据
+        IPage<UserTenantBindRecordWrapper.UserTenantBindRecord> pages = userTenantBindRecordService.selectPage(QueryInfo.getPage(query), query);
+        return R.from(QueryInfo.pageInfo(pages, pages.getRecords()));
+    }
+
+    @ApiOperation(value = "新增", notes = "用户机构绑定解绑记录- 传入 UserTenantBindRecordVo.UserTenantBindRecord")
+    @PreAuthorize("@pcs.hasPermissions('userTenantBindRecord/save', {'BACKEND'})")
+//    @PostMapping("/save")
+    public R<JSONObject> add(@Validated @RequestBody UserTenantBindRecordVo.UserTenantBindRecord userTenantBindRecordVo) {
+
+        // 新增数据
+        userTenantBindRecordService.save(JSON.parseObject(userTenantBindRecordVo.jsonString(), UserTenantBindRecord.class));
+
+        return R.defaultR();
+    }
+
+    @ApiOperation(value = "修改", notes = "用户机构绑定解绑记录- 传入 UserTenantBindRecordVo.UserTenantBindRecord")
+    @PreAuthorize("@pcs.hasPermissions('userTenantBindRecord/update', {'BACKEND'})")
+//    @PostMapping("/update")
+    public R<JSONObject> update(@Validated @RequestBody UserTenantBindRecordVo.UserTenantBindRecord userTenantBindRecordVo) {
+
+        // 更新数据
+        userTenantBindRecordService.updateById(JSON.parseObject(userTenantBindRecordVo.jsonString(), UserTenantBindRecord.class));
+
+        return R.defaultR();
+    }
+
+    @ApiOperation(value = "删除", notes = "用户机构绑定解绑记录- 传入id")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @PreAuthorize("@pcs.hasPermissions('userTenantBindRecord/remove', {'BACKEND'})")
+//    @PostMapping("/remove")
+    public R<Boolean> remove(@RequestParam Long id) {
+
+        return R.from(userTenantBindRecordService.removeById(id));
+    }
+}

+ 91 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/io/request/UserTenantBindRecordVo.java

@@ -0,0 +1,91 @@
+package com.yonge.cooleshow.admin.io.request;
+
+import com.alibaba.fastjson.JSON;
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.yonge.cooleshow.common.enums.ESettlementFrom;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+import lombok.Data;
+
+/**
+ * 用户机构绑定解绑记录
+ * 2023-12-04 15:30:02
+ */
+@ApiModel(value = "UserTenantBindRecordVo对象", description = "用户机构绑定解绑记录查询视图对象")
+public class UserTenantBindRecordVo {
+
+    @Data
+    @ApiModel(" UserTenantBindRecordQuery-用户机构绑定解绑记录")
+    public static class UserTenantBindRecordQuery implements QueryInfo {
+
+        @ApiModelProperty("当前页")
+        private Integer page;
+
+        @ApiModelProperty("分页行数")
+        private Integer rows;
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static UserTenantBindRecordQuery from(String json) {
+            return JSON.parseObject(json, UserTenantBindRecordQuery.class);
+        }
+    }
+
+    @Data
+    @ApiModel(" UserTenantBindRecord-用户机构绑定解绑记录")
+    public static class UserTenantBindRecord {
+
+
+        @ApiModelProperty("")
+        private Long id;
+
+
+        @ApiModelProperty("用户ID")
+        private Long userId;
+
+
+        @ApiModelProperty("TEACHER:老师,STUDENT:学生")
+        private String userType;
+
+
+        @ApiModelProperty("机构ID")
+        private Long tenantId;
+
+
+        @ApiModelProperty("绑定状态:1:已绑定,0:未绑定")
+        private Boolean bindStatus;
+
+
+        @ApiModelProperty("绑定/解绑最新时间")
+        private Date bindTime;
+
+        @ApiModelProperty("姓名")
+        private String userName;
+
+        @ApiModelProperty("手机号")
+        private String phone;
+
+        @ApiModelProperty("小组名称")
+        private String tenantGroupName;
+
+        @ApiModelProperty("结算方式")
+        private ESettlementFrom settlementFrom;
+
+        @ApiModelProperty("锁定状态")
+        private Boolean lockFlag;
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static UserTenantBindRecord from(String json) {
+            return JSON.parseObject(json, UserTenantBindRecord.class);
+        }
+    }
+
+}

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/TenantAlbumPurchase.java

@@ -65,6 +65,10 @@ public class TenantAlbumPurchase implements Serializable {
 	@TableField(value = "purchase_status_")
     private String purchaseStatus;
 
+    @ApiModelProperty("激活状态:NONE:未激活,PART:部分,ALL:全部")
+	@TableField(value = "active_status_")
+    private String activeStatus;
+
     @ApiModelProperty("更新时间") 
 	@TableField(value = "update_time_")
     private Date updateTime;

+ 46 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/UserTenantBindRecord.java

@@ -0,0 +1,46 @@
+package com.yonge.cooleshow.biz.dal.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 用户机构绑定解绑记录
+ * 2023-12-04 15:30:02
+ */
+@Data
+@ApiModel(" UserTenantBindRecord-用户机构绑定解绑记录")
+@TableName("user_tenant_bind_record")
+public class UserTenantBindRecord implements Serializable {
+
+    @TableId(value = "id_")
+    private Long id;
+
+    @ApiModelProperty("用户ID")
+    @TableField(value = "user_id_")
+    private Long userId;
+
+    @ApiModelProperty("TEACHER:老师,STUDENT:学生")
+    @TableField(value = "user_type_")
+    private String userType;
+
+    @ApiModelProperty("机构ID")
+    @TableField(value = "tenant_id_")
+    private Long tenantId;
+
+    @ApiModelProperty("绑定状态:1:已绑定,0:未绑定")
+    @TableField(value = "bind_status_")
+    private Boolean bindStatus;
+
+    @ApiModelProperty("绑定/解绑最新时间")
+    @TableField(value = "bind_time_")
+    private Date bindTime;
+
+}

+ 28 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/mapper/UserTenantBindRecordMapper.java

@@ -0,0 +1,28 @@
+package com.yonge.cooleshow.biz.dal.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.biz.dal.entity.UserTenantBindRecord;
+import com.yonge.cooleshow.biz.dal.wrapper.UserTenantBindRecordWrapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 用户机构绑定解绑记录
+ * 2023-12-04 15:30:02
+ */
+@Repository
+public interface UserTenantBindRecordMapper extends BaseMapper<UserTenantBindRecord> {
+
+    /**
+     * 分页查询
+     * @param page IPage<UserTenantBindRecordWrapper.UserTenantBindRecord>
+     * @param param UserTenantBindRecordWrapper.UserTenantBindRecordQuery
+     * @return List<UserTenantBindRecordWrapper.UserTenantBindRecord>
+     */
+    List<UserTenantBindRecordWrapper.UserTenantBindRecord> selectPage(@Param("page") IPage<UserTenantBindRecordWrapper.UserTenantBindRecord> page,
+                                                                      @Param("param") UserTenantBindRecordWrapper.UserTenantBindRecordQuery param);
+
+}

+ 43 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/UserTenantBindRecordService.java

@@ -0,0 +1,43 @@
+package com.yonge.cooleshow.biz.dal.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yonge.cooleshow.biz.dal.wrapper.UserTenantBindRecordWrapper;
+import com.yonge.cooleshow.biz.dal.entity.UserTenantBindRecord;
+
+/**
+ * 用户机构绑定解绑记录
+ * 2023-12-04 15:30:02
+ */
+public interface UserTenantBindRecordService extends IService<UserTenantBindRecord>  {
+
+    /**
+     * 查询详情
+     * @param id 详情ID
+     * @return UserTenantBindRecord
+     */
+    UserTenantBindRecord detail(Long id);
+
+    /**
+     * 分页查询
+     * @param page IPage<UserTenantBindRecord>
+     * @param query UserTenantBindRecordWrapper.UserTenantBindRecordQuery
+     * @return IPage<UserTenantBindRecord>
+     */
+    IPage<UserTenantBindRecordWrapper.UserTenantBindRecord> selectPage(IPage<UserTenantBindRecordWrapper.UserTenantBindRecord> page, UserTenantBindRecordWrapper.UserTenantBindRecordQuery query);
+
+    /**
+     * 添加
+     * @param userTenantBindRecord UserTenantBindRecordWrapper.UserTenantBindRecord
+     * @return Boolean
+     */
+    Boolean add(UserTenantBindRecordWrapper.UserTenantBindRecord userTenantBindRecord);
+
+    /**
+     * 更新
+     * @param userTenantBindRecord UserTenantBindRecordWrapper.UserTenantBindRecord
+     * @return Boolean
+     */
+    Boolean update(UserTenantBindRecordWrapper.UserTenantBindRecord userTenantBindRecord);
+
+}

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

@@ -240,10 +240,14 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
                 .eq(TenantActivationCode::getTenantAlbumPurchaseId, code.getTenantAlbumPurchaseId())
                 .eq(TenantActivationCode::getActivationStatus, true).count();
 
-        TenantAlbumPurchase tenantAlbumPurchase = new TenantAlbumPurchase();
-        tenantAlbumPurchase.setId(code.getTenantAlbumPurchaseId());
-        tenantAlbumPurchase.setActiveQuantity(activeCodeNumber);
-        tenantAlbumPurchaseMapper.updateById(tenantAlbumPurchase);
+        TenantAlbumPurchase albumPurchase = tenantAlbumPurchaseMapper.selectById(code.getTenantAlbumPurchaseId());
+        albumPurchase.setActiveQuantity(activeCodeNumber);
+        if (activeCodeNumber.equals(albumPurchase.getPurchaseQuantity())) {
+            albumPurchase.setActiveStatus("ALL");
+        } else {
+            albumPurchase.setActiveStatus("PART");
+        }
+        tenantAlbumPurchaseMapper.updateById(albumPurchase);
     }
 
 

+ 116 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserTenantBindRecordServiceImpl.java

@@ -0,0 +1,116 @@
+package com.yonge.cooleshow.biz.dal.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yonge.cooleshow.biz.dal.entity.Subject;
+import com.yonge.cooleshow.biz.dal.entity.UserTenantAlbumRecord;
+import com.yonge.cooleshow.biz.dal.entity.UserTenantBindRecord;
+import com.yonge.cooleshow.biz.dal.mapper.UserTenantAlbumRecordMapper;
+import com.yonge.cooleshow.biz.dal.mapper.UserTenantBindRecordMapper;
+import com.yonge.cooleshow.biz.dal.service.SubjectService;
+import com.yonge.cooleshow.biz.dal.service.UserTenantBindRecordService;
+import com.yonge.cooleshow.biz.dal.wrapper.UserTenantBindRecordWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 用户机构绑定解绑记录
+ * 2023-12-04 15:30:02
+ */
+@Slf4j
+@Service
+public class UserTenantBindRecordServiceImpl extends ServiceImpl<UserTenantBindRecordMapper, UserTenantBindRecord> implements UserTenantBindRecordService {
+
+    @Autowired
+    private UserTenantAlbumRecordMapper userTenantAlbumRecordMapper;
+
+    @Autowired
+    private SubjectService subjectService;
+
+    /**
+     * 查询详情
+     *
+     * @param id 详情ID
+     * @return UserTenantBindRecord
+     */
+    @Override
+    public UserTenantBindRecord detail(Long id) {
+
+        return baseMapper.selectById(id);
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param page  IPage<UserTenantBindRecord>
+     * @param query UserTenantBindRecordWrapper.UserTenantBindRecordQuery
+     * @return IPage<UserTenantBindRecord>
+     */
+    @Override
+    public IPage<UserTenantBindRecordWrapper.UserTenantBindRecord> selectPage(IPage<UserTenantBindRecordWrapper.UserTenantBindRecord> page,
+                                                                              UserTenantBindRecordWrapper.UserTenantBindRecordQuery query) {
+
+        IPage<UserTenantBindRecordWrapper.UserTenantBindRecord> pageRecord = page.setRecords(baseMapper.selectPage(page, query));
+        List<UserTenantBindRecordWrapper.UserTenantBindRecord> records = pageRecord.getRecords();
+        if (!records.isEmpty() && "STUDENT".equals(query.getUserType())) {
+            List<Long> userIds = records.stream().map(UserTenantBindRecordWrapper.UserTenantBindRecord::getUserId).distinct().collect(Collectors.toList());
+
+            QueryWrapper<UserTenantAlbumRecord> queryWrapper = new QueryWrapper<>();
+            queryWrapper.lambda()
+                    .in(UserTenantAlbumRecord::getUserId, userIds)
+                    .ge(UserTenantAlbumRecord::getEndTime, new Date());
+            Map<String, List<UserTenantAlbumRecord>> groupByAlbum = userTenantAlbumRecordMapper.selectList(queryWrapper).stream()
+                    .collect(Collectors.groupingBy(next -> next.getUserId() + "_" + next.getTenantId()));
+
+            List<String> collect = records.stream().map(UserTenantBindRecordWrapper.UserTenantBindRecord::getSubjectId).distinct().collect(Collectors.toList());
+            Map<Integer, Subject> mapByIds = subjectService.getMapByIds(collect);
+            records.forEach(next -> {
+                String key = next.getUserId() + "_" + next.getTenantId();
+                if (groupByAlbum.containsKey(key)) {
+                    next.setTenantAlbumActiveStatus(true);
+                    List<UserTenantAlbumRecord> userTenantAlbumRecords = groupByAlbum.get(key);
+                    userTenantAlbumRecords.sort((o1, o2) -> o2.getEndTime().compareTo(o1.getEndTime()));
+                    next.setTenantAlbumExpireTime(userTenantAlbumRecords.get(0).getEndTime());
+                } else {
+                    next.setTenantAlbumActiveStatus(false);
+                }
+                next.setSubjectName(mapByIds.getOrDefault(Integer.valueOf(next.getSubjectId()), new Subject()).getName());
+            });
+        }
+
+        return pageRecord;
+
+    }
+
+    /**
+     * 添加
+     *
+     * @param userTenantBindRecord UserTenantBindRecordWrapper.UserTenantBindRecord
+     * @return Boolean
+     */
+    @Override
+    public Boolean add(UserTenantBindRecordWrapper.UserTenantBindRecord userTenantBindRecord) {
+
+        return this.save(JSON.parseObject(userTenantBindRecord.jsonString(), UserTenantBindRecord.class));
+    }
+
+    /**
+     * 更新
+     *
+     * @param userTenantBindRecord UserTenantBindRecordWrapper.UserTenantBindRecord
+     * @return Boolean
+     */
+    @Override
+    public Boolean update(UserTenantBindRecordWrapper.UserTenantBindRecord userTenantBindRecord) {
+
+        return this.updateById(JSON.parseObject(userTenantBindRecord.jsonString(), UserTenantBindRecord.class));
+    }
+}

+ 13 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/TenantAlbumPurchaseWrapper.java

@@ -41,12 +41,21 @@ public class TenantAlbumPurchaseWrapper {
         @ApiModelProperty("机构ID")
         private Long tenantId;
 
-        @ApiModelProperty(value = "排序规则", hidden = true)
+        @ApiModelProperty(value = "排序规则,激活数排序:升序:active_quantity_ asc,逆序:active_quantity_ desc")
         private String orderBy;
 
 
         @ApiModelProperty("采购状态 WAIT_PAY 待支付   PAID 已付款 CLOSE 已关闭")
         private String purchaseStatus;
+
+        @ApiModelProperty("激活状态:NONE:未激活,PART:部分,ALL:全部")
+        private String activeStatus;
+
+        @ApiModelProperty("采购开始时间")
+        private Date purchaseStartTime;
+
+        @ApiModelProperty("采购结束时间")
+        private Date purchaseEndTime;
         public String getKeyword() {
             return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
         }
@@ -106,6 +115,9 @@ public class TenantAlbumPurchaseWrapper {
         @ApiModelProperty("创建时间")
         private Date createTime;
 
+        @ApiModelProperty("激活状态:NONE:未激活,PART:部分,ALL:全部")
+        private String activeStatus;
+
         public String jsonString() {
             return JSON.toJSONString(this);
         }

+ 148 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/UserTenantBindRecordWrapper.java

@@ -0,0 +1,148 @@
+package com.yonge.cooleshow.biz.dal.wrapper;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import com.yonge.cooleshow.common.enums.ESettlementFrom;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+import java.util.Optional;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 用户机构绑定解绑记录
+ * 2023-12-04 15:30:02
+ */
+@ApiModel(value = "UserTenantBindRecordWrapper对象", description = "用户机构绑定解绑记录查询对象")
+public class UserTenantBindRecordWrapper {
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel(" UserTenantBindRecordQuery-用户机构绑定解绑记录")
+    public static class UserTenantBindRecordQuery implements QueryInfo {
+
+        @ApiModelProperty("当前页")
+        private Integer page;
+
+        @ApiModelProperty("分页行数")
+        private Integer rows;
+
+        @ApiModelProperty("关键字匹配")
+        private String keyword;
+
+        @ApiModelProperty("TEACHER:老师,STUDENT:学生")
+        private String userType;
+
+        @ApiModelProperty("机构小组ID")
+        private Long tenantGroupId;
+
+        @ApiModelProperty("结算方式")
+        private ESettlementFrom settlementFrom;
+
+        @ApiModelProperty("绑定状态,1:绑定。2:未绑定")
+        private Boolean bindStatus;
+
+        @ApiModelProperty("账号锁定状态,1:锁定,0:未锁定")
+        private Boolean lockFlag;
+
+        @ApiModelProperty("绑定开始时间")
+        private Date bindStartTime;
+
+        @ApiModelProperty("绑定结束时间")
+        private Date bindEndTime;
+
+        @ApiModelProperty("声部")
+        private String subjectId;
+
+        @ApiModelProperty("机构ID")
+        private Long tenantId;
+
+        public String getKeyword() {
+            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
+        }
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static UserTenantBindRecordQuery from(String json) {
+            return JSON.parseObject(json, UserTenantBindRecordQuery.class);
+        }
+    }
+
+    @Data
+    @ApiModel(" UserTenantBindRecord-用户机构绑定解绑记录")
+    public static class UserTenantBindRecord {
+
+        @ApiModelProperty("")
+        private Long id;
+
+
+        @ApiModelProperty("用户ID")
+        private Long userId;
+
+
+        @ApiModelProperty("TEACHER:老师,STUDENT:学生")
+        private String userType;
+
+
+        @ApiModelProperty("机构ID")
+        private Long tenantId;
+
+
+        @ApiModelProperty("绑定状态:1:已绑定,0:未绑定")
+        private Boolean bindStatus;
+
+
+        @ApiModelProperty("绑定/解绑最新时间")
+        private Date bindTime;
+
+        @ApiModelProperty("姓名")
+        private String userName;
+
+        @ApiModelProperty("手机号")
+        private String phone;
+
+        @ApiModelProperty("小组名称")
+        private String tenantGroupName;
+
+        @ApiModelProperty("小组名称")
+        private String tenantGroupId;
+
+        @ApiModelProperty("结算方式")
+        private ESettlementFrom settlementFrom;
+
+        @ApiModelProperty("锁定状态")
+        private Boolean lockFlag;
+
+        @ApiModelProperty("声部")
+        private String subjectName;
+
+        @ApiModelProperty("声部")
+        private String subjectId;
+
+        @ApiModelProperty("专辑状态,1:激活,0:为激活")
+        private Boolean tenantAlbumActiveStatus;
+
+        @ApiModelProperty("失效时间")
+        private Date tenantAlbumExpireTime;
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static UserTenantBindRecord from(String json) {
+            return JSON.parseObject(json, UserTenantBindRecord.class);
+        }
+    }
+
+}

+ 15 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/TenantAlbumPurchaseMapper.xml

@@ -16,6 +16,7 @@
         , t.active_quantity_ AS activeQuantity
         , t.purchase_price_ AS purchasePrice
         , t.purchase_status_ AS purchaseStatus
+        , t.active_status_ AS activeStatus
         , t.update_time_ AS updateTime
         , t.create_time_ AS createTime
         </sql>
@@ -28,6 +29,11 @@
         LEFT JOIN tenant_album ta on t.tenant_album_id_ = ta.id_
         left join user_order t2 on t2.order_no_ = t.order_no_
         <where>
+            <if test="param.keyword != null and param.keyword.trim() != ''">
+                AND (ta.name_ like concat('%',#{param.keyword},'%')
+                or t.purchase_quantity_ = #{param.keyword}
+                )
+            </if>
             <if test="param.tenantId != null">
                 AND t.tenant_id_ = #{param.tenantId}
             </if>
@@ -42,6 +48,15 @@
                     AND t2.status_ in ( 'CLOSE','FAIL')
                 </if>
             </if>
+            <if test="param.activeStatus != null">
+                AND t.active_status_ = #{param.activeStatus}
+            </if>
+            <if test="param.purchaseStartTime != null">
+                AND t.create_time_ >= #{param.purchaseStartTime}
+            </if>
+            <if test="param.purchaseEndTime != null">
+                AND #{param.purchaseEndTime} >= t.create_time_
+            </if>
         </where>
         <choose>
             <when test="param.orderBy != null and param.orderBy.trim() != ''">

+ 88 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/UserTenantBindRecordMapper.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE  mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.yonge.cooleshow.biz.dal.mapper.UserTenantBindRecordMapper">
+
+
+
+    <!-- 表字段 -->
+    <sql id="baseColumns">
+        t.id_ AS id
+        , t.user_id_ AS userId
+        , t.user_type_ AS userType
+        , t.tenant_id_ AS tenantId
+        , t.bind_status_ AS bindStatus
+        , t.bind_time_ AS bindTime
+    </sql>
+
+    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.wrapper.UserTenantBindRecordWrapper$UserTenantBindRecord">
+        SELECT
+        <include refid="baseColumns"/>
+        ,su.username_ userName
+        ,su.phone_ phone
+        ,su.gender_ gender
+        ,su.lock_flag_ lockFlag
+        <if test="param.userType == 'TEACHER'">
+            ,tc.settlement_from_ settlementFrom
+            ,group_concat(tg.name_) tenantGroupName
+            ,tg.id_ tenantGroupId
+        </if>
+        <if test="param.userType == 'STUDENT'">
+            ,tg.name_ tenantGroupName
+            ,tg.id_ tenantGroupId
+            ,st.subject_id_ subjectId
+        </if>
+        FROM user_tenant_bind_record t
+        LEFT JOIN sys_user su ON t.user_id_ = su.id_
+        <if test="param.userType == 'TEACHER'">
+            LEFT JOIN teacher tc on t.user_id_ = tc.user_id_
+            LEFT JOIN tenant_group tg on t.user_id_ = tg.admin_id_
+        </if>
+        <if test="param.userType == 'STUDENT'">
+            LEFT JOIN student st on t.user_id_ = st.user_id_
+            LEFT JOIN tenant_group tg on st.tenant_group_id_ = tg.id_
+        </if>
+        <where>
+            <if test="param.keyword != null and param.keyword.trim() != ''">
+                AND (t.user_id_ like concat('%',#{param.keyword},'%')
+                or su.username_ like concat('%',#{param.keyword},'%')
+                or su.phone_ like concat('%',#{param.keyword},'%')
+                )
+            </if>
+            <if test="param.tenantId != null">
+                AND t.tenant_id_ = #{param.tenantId}
+            </if>
+            <if test="param.userType != null and param.userType.trim() != ''">
+                AND t.user_type_ = #{param.userType}
+            </if>
+            <if test="param.tenantGroupId != null">
+                <if test="param.userType == 'TEACHER'">
+                    AND tg.id_ =#{param.tenantGroupId}
+                </if>
+                <if test="param.userType == 'STUDENT'">
+                    AND st.tenant_group_id_ = #{param.tenantGroupId}
+                </if>
+            </if>
+            <if test="param.userType == 'TEACHER' and param.settlementFrom != null">
+                AND tc.settlement_from_ = #{param.settlementFrom}
+            </if>
+            <if test="param.bindStatus != null">
+                AND t.bind_status_ = #{param.bindStatus}
+            </if>
+            <if test="param.lockFlag != null">
+                AND su.lock_flag_ = #{param.lockFlag}
+            </if>
+            <if test="param.bindStartTime != null">
+                AND t.bind_time_ >= #{param.bindStartTime}
+            </if>
+            <if test="param.bindEndTime != null">
+                AND #{param.bindEndTime} >= t.bind_time_
+            </if>
+            <if test="param.userType == 'STUDENT' and param.subjectId != null">
+                AND st.subject_id_ = #{param.subjectId}
+            </if>
+        </where>
+        group by t.user_id_
+        order by t.bind_time_ desc
+    </select>
+
+</mapper>