浏览代码

1.学生接口调整添加机构ID

yuanliang 2 年之前
父节点
当前提交
c9f604303b

+ 2 - 2
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/StudentController.java

@@ -157,9 +157,9 @@ public class StudentController extends BaseController {
         OutputStream outputStream = response.getOutputStream();
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学生编号", "学生姓名", "真实姓名", "性别", "出生日期",
-                    "年龄", "专业", "手机号码", "是否是会员", "注册时间","用户状态"}, new String[]{
+                    "年龄", "专业", "手机号码", "是否是会员", "注册时间","用户状态","学生来源"}, new String[]{
                     "userId","username" , "realName", "gender.msg", "birthdate", "age", "subjectName", "phone",
-                    "isVip.msg", "createTime", "userStatus.msg"}, rows);
+                    "isVip.msg", "createTime", "userStatus.msg","tenantName"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attac:wq" +
                     "hment;filename=学生列表-" + DateUtil.getDate(new Date()) + ".xls");

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/search/StudentSearch.java

@@ -7,6 +7,7 @@ import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 import com.yonge.toolset.base.page.QueryInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
@@ -16,6 +17,7 @@ import java.util.Optional;
  * @Author: liweifan
  * @Data: 2022/3/21 15:26
  */
+@Data
 @ApiModel(value = "StudentSearch", description = "学院管理查询")
 public class StudentSearch extends QueryInfo{
     @ApiModelProperty(value = "学员编号/昵称/电话")
@@ -61,6 +63,12 @@ public class StudentSearch extends QueryInfo{
     @ApiModelProperty("隐藏标识")
     private Integer hideFlag;
 
+    @ApiModelProperty("机构ID")
+    private String tenantId;
+
+    @ApiModelProperty("机构名称")
+    private String tenantName;
+
     public Date getVipStartTime() {
         return vipStartTime;
     }

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentVo.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 import java.util.Date;
 
+import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -17,6 +18,7 @@ import com.yonge.cooleshow.common.enums.YesOrNoEnum;
  * @Author: liweifan
  * @Data: 2022/3/24 17:22
  */
+@Data
 @ApiModel(value = "StudentVo对象", description = "学生表")
 public class StudentVo extends Student {
     @ApiModelProperty("头像地址")
@@ -54,6 +56,12 @@ public class StudentVo extends Student {
     @ApiModelProperty(value = "用户状态 NORMAL-正常   LOCKED-冻结  CLOSED-关闭")
     private UserStatusEnum userStatus;
 
+    @ApiModelProperty(value = "机构ID")
+    private Long tenantId;
+
+    @ApiModelProperty(value = "机构名称")
+    private String tenantName;
+
     public YesOrNoEnum getDelFlag() {
         return delFlag;
     }

+ 12 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -52,9 +52,11 @@
             (
             SELECT GROUP_CONCAT(name_ ORDER by locate(id_,t.subject_id_)) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
             ) as subjectName,
-            u.user_type_ as userType
+            u.user_type_ as userType,
+            (case when t.tenant_id_ = -1 then '平台学生' else ti.name_ end) as tenantName
         FROM student t
         left join sys_user u on t.user_id_ = u.id_
+        left join tenant_info ti on ti.id_ = t.tenant_id_
         where u.del_flag_ = 0 and t.user_id_ = #{userId}
     </select>
     <select id="detailByPhone" resultType="com.yonge.cooleshow.biz.dal.vo.StudentVo">
@@ -95,9 +97,11 @@
             (!isnull(membership_end_time_) and membership_end_time_ > now()) as isVip,
             (
             SELECT GROUP_CONCAT(name_ ORDER by locate(id_,t.subject_id_)) FROM subject WHERE FIND_IN_SET(id_,t.subject_id_)
-            ) as subjectName
+            ) as subjectName,
+            (case when t.tenant_id_ = -1 then '平台学生' else ti.name_ end) as tenantName
         FROM student t
         left join sys_user u on t.user_id_ = u.id_
+        left join tenant_info ti on t.tenant_id_ = ti.id_
         <where>
             <if test="null != param.search and '' != param.search">
                 AND (
@@ -148,6 +152,12 @@
             <if test="param.hideFlag != null">
                 and t.hide_flag_ = #{param.hideFlag}
             </if>
+            <if test="param.tenantId != null">
+                and t.tenant_id_ = #{param.tenantId}
+            </if>
+            <if test="param.tenantName != null and param.tenantName.trim() != ''">
+                and te.name_ like concat('%',#{param.tenantName},'%')
+            </if>
         </where>
         order by t.create_time_ desc
     </select>

+ 6 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -103,12 +103,14 @@
 <!--            t.tag_ tag,-->
             u.del_flag_ as delFlag,
             (case when isnull(u.id_card_no_) then 0 else 1 end) as isReal,
-            (case when isnull(b.user_id_) then 0 else 1 end) as isBank
+            (case when isnull(b.user_id_) then 0 else 1 end) as isBank,
+            (case when t.tenant_id_ = -1 then '平台老师' else ti.name_ end) as tenantName
         FROM teacher t
         left join sys_user u on t.user_id_ = u.id_
         left join (
             select distinct user_id_ from user_bank_card where del_flag_ = 0
         ) b on t.user_id_ = b.user_id_
+        left join tenant_info ti on t.tenant_id_ = ti.id_
         <where>
             <if test="null != param.search and '' != param.search">
                 AND (
@@ -176,6 +178,9 @@
             <if test="param.settlementFrom ! =null and param.settlementFrom.trim() != ''">
                 AND t.settlement_from_ = #{param.settlementFrom}
             </if>
+            <if test="param.tenantName != null and param.tenantName.trim() != ''">
+                and te.name_ like concat('%',#{param.tenantName},'%')
+            </if>
         </where>
         order by t.create_time_ desc
     </select>