Browse Source

Merge branch 'saas' of http://git.dayaedu.com/yonge/mec into saas

yanite 3 năm trước cách đây
mục cha
commit
f4f4ecb7c3
85 tập tin đã thay đổi với 819 bổ sung1530 xóa
  1. 3 11
      cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsInformation.java
  2. 3 1
      cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsType.java
  3. 5 4
      cms/src/main/resources/config/mybatis/SysNewsTypeMapper.xml
  4. 1 1
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysMenu.java
  5. 0 54
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRoleDept.java
  6. 0 9
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/dal/dao/SysRoleDeptDao.java
  7. 0 8
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/SysRoleDeptService.java
  8. 0 23
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysRoleDeptServiceImpl.java
  9. 0 63
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysRoleDeptMapper.xml
  10. 13 6
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserDeviceMapper.xml
  11. 5 4
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserLoginLogMapper.xml
  12. 6 5
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserLoginMapper.xml
  13. 7 7
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserMapper.xml
  14. 2 1
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserRoleMapper.xml
  15. 5 13
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java
  16. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java
  17. 4 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CooperationOrganDao.java
  18. 10 115
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  19. 20 18
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleEvaluateDao.java
  20. 5 15
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  21. 7 9
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java
  22. 3 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/DegreeLevelFeeDao.java
  23. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ChargeType.java
  24. 0 7
      mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java
  25. 0 11
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  26. 0 8
      mec-biz/src/main/java/com/ym/mec/biz/service/ExtracurricularExercisesReplyService.java
  27. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChildrenDayReserveServiceImpl.java
  28. 2 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  29. 0 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
  30. 6 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleEvaluateServiceImpl.java
  31. 6 369
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  32. 11 11
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  33. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java
  34. 0 66
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java
  35. 6 10
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  36. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportServiceImpl.java
  37. 3 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  38. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeLessonApplyServiceImpl.java
  39. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java
  40. 4 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherCourseScheduleServiceImpl.java
  41. 6 5
      mec-biz/src/main/resources/config/mybatis/ActivityApplyStudentTypeMapper.xml
  42. 7 6
      mec-biz/src/main/resources/config/mybatis/ActivityPlanMapper.xml
  43. 21 24
      mec-biz/src/main/resources/config/mybatis/ActivityUserMapperAdjustLogMapper.xml
  44. 21 24
      mec-biz/src/main/resources/config/mybatis/ActivityUserMapperMapper.xml
  45. 7 5
      mec-biz/src/main/resources/config/mybatis/ChargeTypeMapper.xml
  46. 7 5
      mec-biz/src/main/resources/config/mybatis/ChargeTypeOrganizationFeeMapper.xml
  47. 10 13
      mec-biz/src/main/resources/config/mybatis/ChargeTypeSubjectMapperMapper.xml
  48. 6 5
      mec-biz/src/main/resources/config/mybatis/ChildrenDayDegreeDetailDao.xml
  49. 6 5
      mec-biz/src/main/resources/config/mybatis/ChildrenDayDegreeInfoDao.xml
  50. 9 5
      mec-biz/src/main/resources/config/mybatis/ChildrenDayReserveMapper.xml
  51. 47 11
      mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml
  52. 8 7
      mec-biz/src/main/resources/config/mybatis/ClassGroupRelationMapper.xml
  53. 20 7
      mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml
  54. 15 8
      mec-biz/src/main/resources/config/mybatis/ClassGroupTeacherMapperMapper.xml
  55. 10 3
      mec-biz/src/main/resources/config/mybatis/ClassGroupTeacherSalaryMapper.xml
  56. 7 6
      mec-biz/src/main/resources/config/mybatis/CloudTeacherMapper.xml
  57. 16 6
      mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml
  58. 10 9
      mec-biz/src/main/resources/config/mybatis/CooperationOrganLinkmanMapper.xml
  59. 10 6
      mec-biz/src/main/resources/config/mybatis/CooperationOrganMapper.xml
  60. 16 5
      mec-biz/src/main/resources/config/mybatis/CourseHomeworkMapper.xml
  61. 8 4
      mec-biz/src/main/resources/config/mybatis/CourseHomeworkTemplateMapper.xml
  62. 6 5
      mec-biz/src/main/resources/config/mybatis/CourseScheduleComplaintsMapper.xml
  63. 24 5
      mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml
  64. 34 255
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  65. 6 4
      mec-biz/src/main/resources/config/mybatis/CourseScheduleModifyLogMapper.xml
  66. 14 7
      mec-biz/src/main/resources/config/mybatis/CourseScheduleReviewMapper.xml
  67. 11 7
      mec-biz/src/main/resources/config/mybatis/CourseScheduleRewardsMapper.xml
  68. 17 40
      mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  69. 24 32
      mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml
  70. 7 6
      mec-biz/src/main/resources/config/mybatis/CoursesGroupMapper.xml
  71. 5 4
      mec-biz/src/main/resources/config/mybatis/CoursesGroupModifyLogDao.xml
  72. 7 6
      mec-biz/src/main/resources/config/mybatis/DataChangeLogMapper.xml
  73. 5 4
      mec-biz/src/main/resources/config/mybatis/DegreeLevelFeeMapper.xml
  74. 9 8
      mec-biz/src/main/resources/config/mybatis/courseScheduleStudentMusicScoreMapper.xml
  75. 0 6
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  76. 0 5
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  77. 12 0
      mec-common/common-core/src/main/java/com/ym/mec/common/page/QueryInfo.java
  78. 4 0
      mec-common/common-core/src/main/java/com/ym/mec/common/service/impl/BaseServiceImpl.java
  79. 110 47
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  80. 47 0
      mec-student/src/main/java/com/ym/mec/student/controller/SysTenantConfigController.java
  81. 0 19
      mec-task/src/main/java/com/ym/mec/task/jobs/CloudTeacherOrderTask.java
  82. 48 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/SysTenantConfigController.java
  83. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleTeacherSalaryController.java
  84. 5 1
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  85. 0 6
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

+ 3 - 11
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsInformation.java

@@ -6,10 +6,12 @@ import java.util.Date;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import com.ym.mec.common.entity.BaseEntity;
+
 /**
  * 对应数据库表(sys_news_information):
  */
-public class SysNewsInformation {
+public class SysNewsInformation extends BaseEntity {
 
 	/**  */
 	private Long id;
@@ -67,8 +69,6 @@ public class SysNewsInformation {
 
 	private Boolean delFlag;
 
-	private Integer tenantId;
-
 	private String attribute1;
 	
 	private String attribute2;
@@ -193,14 +193,6 @@ public class SysNewsInformation {
 		this.delFlag = delFlag;
 	}
 
-	public Integer getTenantId() {
-		return tenantId;
-	}
-
-	public void setTenantId(Integer tenantId) {
-		this.tenantId = tenantId;
-	}
-
 	public Integer getSubType() {
 		return subType;
 	}

+ 3 - 1
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsType.java

@@ -2,10 +2,12 @@ package com.ym.mec.cms.dal.entity;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import com.ym.mec.common.entity.BaseEntity;
+
 /**
  * 对应数据库表(sys_news_type):
  */
-public class SysNewsType {
+public class SysNewsType extends BaseEntity {
 
 	/**  */
 	private Integer id;

+ 5 - 4
cms/src/main/resources/config/mybatis/SysNewsTypeMapper.xml

@@ -10,6 +10,7 @@
 		<result column="del_flag_" property="delFlag" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<resultMap type="com.ym.mec.cms.dal.entity.SysNewsTypeTree" extends="SysNewsType" id="SysNewsTypeTree">
@@ -31,8 +32,8 @@
 	<insert id="insert" parameterType="com.ym.mec.cms.dal.entity.SysNewsType"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO sys_news_type
-		(id_,name_,parent_id_,del_flag_,create_time_,update_time_)
-		VALUES(#{id},#{name},#{parentId},#{delFlag},#{createTime},#{updateTime})
+		(id_,name_,parent_id_,del_flag_,create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{name},#{parentId},#{delFlag},#{createTime},#{updateTime},#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -58,12 +59,12 @@
 				create_time_ = #{createTime},
 			</if>
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete">
-		DELETE FROM sys_news_type WHERE id_ = #{id}
+		DELETE FROM sys_news_type WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</delete>
 
 	<!-- 分页查询 -->

+ 1 - 1
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysMenu.java

@@ -11,7 +11,7 @@ import java.util.List;
 /**
  * 对应数据库表(sys_menu):
  */
-public class SysMenu extends BaseEntity {
+public class SysMenu {
 
 	/** 菜单ID */
 	@ApiModelProperty(value = "菜单ID",required = false)

+ 0 - 54
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysRoleDept.java

@@ -1,54 +0,0 @@
-package com.ym.mec.auth.api.entity;
-
-import io.swagger.annotations.ApiModelProperty;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import com.ym.mec.common.entity.BaseEntity;
-
-/**
- * 对应数据库表(sys_role_dept):
- */
-public class SysRoleDept extends BaseEntity {
-
-	/**  */
-	private Integer id;
-	
-	/** 角色ID */
-	@ApiModelProperty(value = "角色ID",required = false)
-	private Integer roleId;
-	
-	/** 部门ID */
-	@ApiModelProperty(value = "部门ID",required = false)
-	private Integer deptId;
-	
-	public void setId(Integer id){
-		this.id = id;
-	}
-	
-	public Integer getId(){
-		return this.id;
-	}
-			
-	public void setRoleId(Integer roleId){
-		this.roleId = roleId;
-	}
-	
-	public Integer getRoleId(){
-		return this.roleId;
-	}
-			
-	public void setDeptId(Integer deptId){
-		this.deptId = deptId;
-	}
-	
-	public Integer getDeptId(){
-		return this.deptId;
-	}
-			
-	@Override
-	public String toString() {
-		return ToStringBuilder.reflectionToString(this);
-	}
-
-}

+ 0 - 9
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/dal/dao/SysRoleDeptDao.java

@@ -1,9 +0,0 @@
-package com.ym.mec.auth.dal.dao;
-
-import com.ym.mec.auth.api.entity.SysRoleDept;
-import com.ym.mec.common.dal.BaseDAO;
-
-public interface SysRoleDeptDao extends BaseDAO<Integer, SysRoleDept> {
-
-	
-}

+ 0 - 8
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/SysRoleDeptService.java

@@ -1,8 +0,0 @@
-package com.ym.mec.auth.service;
-
-import com.ym.mec.auth.api.entity.SysRoleDept;
-import com.ym.mec.common.service.BaseService;
-
-public interface SysRoleDeptService extends BaseService<Integer, SysRoleDept> {
-
-}

+ 0 - 23
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysRoleDeptServiceImpl.java

@@ -1,23 +0,0 @@
-package com.ym.mec.auth.service.impl;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.ym.mec.auth.api.entity.SysRoleDept;
-import com.ym.mec.auth.dal.dao.SysRoleDeptDao;
-import com.ym.mec.auth.service.SysRoleDeptService;
-import com.ym.mec.common.dal.BaseDAO;
-import com.ym.mec.common.service.impl.BaseServiceImpl;
-
-@Service
-public class SysRoleDeptServiceImpl extends BaseServiceImpl<Integer, SysRoleDept>  implements SysRoleDeptService {
-	
-	@Autowired
-	private SysRoleDeptDao sysRoleDeptDao;
-
-	@Override
-	public BaseDAO<Integer, SysRoleDept> getDAO() {
-		return sysRoleDeptDao;
-	}
-	
-}

+ 0 - 63
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysRoleDeptMapper.xml

@@ -1,63 +0,0 @@
-<?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.ym.mec.auth.dal.dao.SysRoleDeptDao">
-	
-	<resultMap type="com.ym.mec.auth.api.entity.SysRoleDept" id="SysRoleDept">
-		<result column="id_" property="id" />
-		<result column="role_id_" property="roleId" />
-		<result column="dept_id_" property="deptId" />
-	</resultMap>
-	
-	<!-- 根据主键查询一条记录 -->
-	<select id="get" resultMap="SysRoleDept" >
-		SELECT * FROM sys_role_dept WHERE id_ = #{id}
-	</select>
-	
-	<!-- 全查询 -->
-	<select id="findAll" resultMap="SysRoleDept">
-		SELECT * FROM sys_role_dept ORDER BY id_
-	</select>
-	
-	<!-- 向数据库增加一条记录 -->
-	<insert id="insert" parameterType="com.ym.mec.auth.api.entity.SysRoleDept" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!--
-		<selectKey resultClass="int" keyProperty="id" > 
-		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
-		</selectKey>
-		-->
-		INSERT INTO sys_role_dept (id_,role_id_,dept_id_) VALUES(#{id},#{roleId},#{deptId})
-	</insert>
-	
-	<!-- 根据主键查询一条记录 -->
-	<update id="update" parameterType="com.ym.mec.auth.api.entity.SysRoleDept">
-		UPDATE sys_role_dept
-		 <set>
-			 <if test="roleId != null">
-				 role_id_ = #{roleId},
-			 </if>
-			 <if test="deptId != null">
-				 dept_id_ = #{deptId},
-			 </if>
-		 </set>
-		 WHERE id_ = #{id}
-	</update>
-	
-	<!-- 根据主键删除一条记录 -->
-	<delete id="delete" >
-		DELETE FROM sys_role_dept WHERE id_ = #{id}
-	</delete>
-	
-	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="SysRoleDept" parameterType="map">
-		SELECT * FROM sys_role_dept ORDER BY id_ <include refid="global.limit"/>
-	</select>
-	
-	<!-- 查询当前表的总记录数 -->
-	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_role_dept
-	</select>
-</mapper>

+ 13 - 6
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserDeviceMapper.xml

@@ -14,6 +14,7 @@
 		<result column="update_time_" property="updateTime" />
 		<result column="phone_" property="user.phone" />
 		<result column="real_name_" property="user.realName" />
+        <result column="tenant_id_" property="tenantId"/>
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -24,7 +25,7 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="SysUserDevice">
-		SELECT * FROM sys_user_device
+		SELECT * FROM sys_user_device where tenant_id_ = #{tenantId}
 		ORDER BY id_
 	</select>
 
@@ -34,8 +35,8 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO sys_user_device
-		(id_,user_id_,device_num_,bind_time_,device_type_,client_id_,del_flag_)
-		VALUES(#{id},#{userId},#{deviceNum},#{bindTime},#{deviceType},#{clientId},0)
+		(id_,user_id_,device_num_,bind_time_,device_type_,client_id_,del_flag_,tenant_id_)
+		VALUES(#{id},#{userId},#{deviceNum},#{bindTime},#{deviceType},#{clientId},0,#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -65,7 +66,7 @@
 			</if>
 			update_time_ = now()
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -89,6 +90,9 @@
 		<if test="bindEndTime != null">
 			and date(bind_time_) &lt;= #{bindEndTime}
 		</if>
+		<if test="tenantId != null">
+			and ud.tenant_id_ = #{tenantId}
+		</if>
 		ORDER BY id_
 		<include refid="global.limit" />
 	</select>
@@ -109,17 +113,20 @@
 		<if test="bindEndTime != null">
 			and date(bind_time_) &lt;= #{bindEndTime}
 		</if>
+		<if test="tenantId != null">
+			and ud.tenant_id_ = #{tenantId}
+		</if>
 	</select>
 	
 	<select id="queryByUserId" resultMap="SysUserDevice" parameterType="map">
-		SELECT * FROM sys_user_device WHERE user_id_ = #{userId} and del_flag_ = 0
+		SELECT * FROM sys_user_device WHERE user_id_ = #{userId} and del_flag_ = 0 and tenant_id_ = #{tenantId}
 		<if test="clientId != null">
 			and client_id_ = #{clientId}
 		</if>
 	</select>
 	
 	<select id="queryByDeviceNum" resultMap="SysUserDevice" parameterType="map">
-		SELECT * FROM sys_user_device WHERE device_num_ = #{deviceNum} and del_flag_ = 0
+		SELECT * FROM sys_user_device WHERE device_num_ = #{deviceNum} and del_flag_ = 0 and tenant_id_ = #{tenantId}
 		<if test="clientId != null">
 			and client_id_ = #{clientId}
 		</if>

+ 5 - 4
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserLoginLogMapper.xml

@@ -8,6 +8,7 @@
 	
 	<resultMap type="com.ym.mec.auth.api.entity.SysUserLoginLog" id="SysUserLoginLog">
 		<result column="id_" property="id"/>
+        <result column="tenant_id_" property="tenantId"/>
 		<result column="user_id_" property="userId" />
 		<result column="login_ip_" property="loginIp" />
 		<result column="login_time_" property="loginTime" />
@@ -17,7 +18,7 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="SysUserLoginLog">
-		SELECT * FROM sys_user_login_log
+		SELECT * FROM sys_user_login_log where tenant_id_ = #{tenantId}
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
@@ -27,18 +28,18 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 		</selectKey>
 		-->
-		INSERT INTO sys_user_login_log (id_,user_id_,login_ip_,login_time_,source_) VALUES(#{id},#{userId},#{loginIp},#{loginTime},#{source})
+		INSERT INTO sys_user_login_log (id_,user_id_,login_ip_,login_time_,source_,tenant_id_) VALUES(#{id},#{userId},#{loginIp},#{loginTime},#{source},#{tenantId})
 	</insert>
 	
 	
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysUserLoginLog" parameterType="map">
-		SELECT * FROM sys_user_login_log <include refid="global.limit"/>
+		SELECT * FROM sys_user_login_log where tenant_id_ = #{tenantId} <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_user_login_log
+		SELECT COUNT(*) FROM sys_user_login_log where tenant_id_ = #{tenantId}
 	</select>
 </mapper>

+ 6 - 5
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserLoginMapper.xml

@@ -14,6 +14,7 @@
         <result column="fail_count_" property="failCount"/>
         <result column="lock_time_" property="lockTime"/>
         <result column="lock_date_" property="lockDate"/>
+        <result column="tenant_id_" property="tenantId"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -35,8 +36,8 @@
         </selectKey>
         -->
         INSERT INTO sys_user_login
-        (user_id_,login_count_,last_login_time_,last_login_ip_,fail_count_,lock_time_,lock_date_)
-        VALUES(#{userId},#{loginCount},#{lastLoginTime},#{lastLoginIp},#{failCount},#{lockTime},#{lockDate})
+        (user_id_,login_count_,last_login_time_,last_login_ip_,fail_count_,lock_time_,lock_date_,tenant_id_)
+        VALUES(#{userId},#{loginCount},#{lastLoginTime},#{lastLoginIp},#{failCount},#{lockTime},#{lockDate},#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -62,7 +63,7 @@
                 lock_date_ = #{lockDate},
             </if>
         </set>
-        WHERE user_id_ = #{userId}
+        WHERE user_id_ = #{userId} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 根据主键删除一条记录 -->
@@ -72,13 +73,13 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="SysUserLogin" parameterType="map">
-        SELECT * FROM sys_user_login ORDER BY user_id_
+        SELECT * FROM sys_user_login where tenant_id_ = #{tenantId} ORDER BY user_id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_user_login
+		SELECT COUNT(*) FROM sys_user_login where tenant_id_ = #{tenantId}
 	</select>
 
     <select id="findLoginByUserId" resultMap="SysUserLogin">

+ 7 - 7
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -51,6 +51,9 @@
         <if test="organId != null">
             and organ_id_ = #{organId}
         </if>
+        <if test="tenantId != null">
+            and tenant_id_ = #{tenantId}
+        </if>
     </sql>
 
     <!-- 根据主键查询一条记录 -->
@@ -62,7 +65,7 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="SysUser">
-		SELECT * FROM sys_user ORDER BY id_
+		SELECT * FROM sys_user where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->
@@ -91,9 +94,6 @@
     <update id="update" parameterType="com.ym.mec.auth.api.entity.SysUser">
         UPDATE sys_user
         <set>
-            <if test="tenantId != null">
-                tenant_id_ = #{tenantId},
-            </if>
             <if test="delFlag != null">
                 del_flag_ = #{delFlag, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -161,7 +161,7 @@
                 certificate_type_ = #{certificateType},
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
     <update id="updatePassword">
         UPDATE sys_user SET password_ = #{password} WHERE phone_ = #{mobile}
@@ -177,7 +177,7 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="SysUser" parameterType="map">
-        SELECT * FROM sys_user ORDER BY id_
+        SELECT * FROM sys_user
         <include refid="queryCondition"/>
         <include refid="global.orderby"/>
         <include refid="global.limit"/>
@@ -211,7 +211,7 @@
     </select>
     
     <select id="queryByStatus" resultMap="SysUser">
-        select * from sys_user where lock_flag_ = #{status}
+        select * from sys_user where lock_flag_ = #{status} and tenant_id_ = #{tenantId}
     </select>
     <select id="findUserBySalt" resultMap="SysUser">
         SELECT * FROM sys_user WHERE salt_ IS NOT NULL AND salt_ = 'replace' AND user_type_ LIKE CONCAT('%',#{userType},'%') LIMIT 1

+ 2 - 1
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserRoleMapper.xml

@@ -9,6 +9,7 @@
     <resultMap type="com.ym.mec.auth.api.entity.SysUserRole" id="SysUserRole">
         <result column="user_id_" property="userId"/>
         <result column="role_id_" property="roleId"/>
+        <result column="tenant_id_" property="tenantId"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -18,7 +19,7 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="SysUserRole">
-		SELECT * FROM sys_user_role ORDER BY user_id_,role_id_
+		SELECT * FROM sys_user_role where tenant_id_ = #{tenantId} ORDER BY user_id_,role_id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->

+ 5 - 13
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -669,11 +669,11 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      */
     List<ClassGroup> findByClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds, @Param("lockFlag") Integer lockFlag);
 
-    List<ImGroupModel> queryStudentGroup();
+    List<ImGroupModel> queryStudentGroup(Integer tenantId);
 
-    List<ImGroupModel> queryTeacherGroup();
+    List<ImGroupModel> queryTeacherGroup(Integer tenantId);
 
-    List<ImUserModel> queryImUser();
+    List<ImUserModel> queryImUser(Integer tenantId);
 
     /**
      * 批量更新班级学生数减一
@@ -714,7 +714,7 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      * @author Joburgess
      * @date 2019/12/31
      */
-    List<Integer> findClassGroupIdsByStudent(@Param("search") String search);
+    List<Integer> findClassGroupIdsByStudent(@Param("search") String search, @Param("tenantId") Integer tenantId);
 
     /**
      * @param search:
@@ -723,15 +723,7 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      * @author Joburgess
      * @date 2019/12/31
      */
-    List<Integer> findClassGroupIdsByTeacher(@Param("search") String search);
-
-    /**
-     * 获取基础技能版数量
-     *
-     * @param musicGroupId
-     * @return
-     */
-    Integer countClassNumByType(String musicGroupId);
+    List<Integer> findClassGroupIdsByTeacher(@Param("search") String search, @Param("tenantId") Integer tenantId);
 
     /**
      * 获取对应班级的声部名称列表

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java

@@ -30,7 +30,7 @@ public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
      *
      * @return
      */
-    List<CloudTeacherOrder> getNoStartCloudTeacherOrder();
+    List<CloudTeacherOrder> getNoStartCloudTeacherOrder(Integer tenantId);
 
     /**
      * 获取学生在有效期内的乐保数量
@@ -82,7 +82,7 @@ public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
                                                  @Param("activeRemark") Integer activeRemark,
                                                  @Param("remark") String remark);
 
-    List<Integer> getStudentIds();
+    List<Integer> getStudentIds(Integer tenantId);
 
     /**
      * 获取学员云教练活动金额

+ 4 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CooperationOrganDao.java

@@ -2,13 +2,12 @@ package com.ym.mec.biz.dal.dao;
 
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
-import com.ym.mec.biz.dal.dto.OrganFullJobResourceNumDto;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import org.apache.ibatis.annotations.Param;
 
+import com.ym.mec.biz.dal.dto.OrganFullJobResourceNumDto;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.common.dal.BaseDAO;
 
 public interface CooperationOrganDao extends BaseDAO<Integer, CooperationOrgan> {
@@ -31,14 +30,14 @@ public interface CooperationOrganDao extends BaseDAO<Integer, CooperationOrgan>
     List<Map<Integer, String>> queryNameByIds(String organIds);
 
 
-    List<OrganFullJobResourceNumDto> getOrganFullJobResourceNum();
+    List<OrganFullJobResourceNumDto> getOrganFullJobResourceNum(Integer tenantId);
 
     /**
      * 获取全部使用中合作单位
      *
      * @return
      */
-    List<CooperationOrgan> getAllCooperationOrgan();
+    List<CooperationOrgan> getAllCooperationOrgan(Integer tenantId);
 
     /**
      * 获取合作单位乐团的学校缴费

+ 10 - 115
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -219,7 +219,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @params [classDates, classGroupId]
      * @describe 根据班级和上课日期获取课程计划
      */
-    List<CourseSchedule> findByClassGroupAndDate(@Param("classDates") List<Date> classDates, @Param("classGroupId") Long classGroupId);
+    List<CourseSchedule> findByClassGroupAndDate(@Param("classDates") List<Date> classDates, @Param("classGroupId") Long classGroupId, @Param("tenantId") Integer tenantId);
 
     /**
      * @Author: Joburgess
@@ -264,7 +264,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<CourseScheduleDto> findCourseSchedulesWithDate(@Param("teacherId") Integer teacherId,
                                                         @Param("classDate") Date classDate,
                                                         @Param("groupId") String groupId,
-                                                        @Param("groupType") GroupType groupType);
+                                                        @Param("groupType") GroupType groupType,@Param("tenantId") Integer tenantId);
 
     /**
      * @param classDate:
@@ -402,7 +402,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<Date> findHaveClassesDatesWithMonth(@Param("teacherId") Integer teacherId,
                                              @Param("month") Date month,
                                              @Param("groupId") String groupId,
-                                             @Param("groupType") GroupType groupType);
+                                             @Param("groupType") GroupType groupType, @Param("tenantId") Integer tenantId);
 
     /**
      * @param teacherId: 教师编号
@@ -429,7 +429,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<Date> getCourseScheduleDateWithOrgan(@Param("organIds") List<Integer> organIds,
                                               @Param("month") Date month,
                                               @Param("type") String type,
-                                              @Param("transactionTeacherId") Integer transactionTeacherId);
+                                              @Param("transactionTeacherId") Integer transactionTeacherId, @Param("tenantId") Integer tenantId);
 
     /**
      * @Author: Joburgess
@@ -450,7 +450,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @Date: 2019/9/24
      * 根据日期获取课程
      */
-    List<CourseSchedule> findCoursesByDates(@Param("dates") List<Date> dates);
+    List<CourseSchedule> findCoursesByDates(@Param("dates") List<Date> dates, @Param("tenantId") Integer tenantId);
 
     /**
      * @Author: Joburgess
@@ -458,7 +458,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * 获取在指定时间段内存在重复的课程
      */
     List<CourseSchedule> findOverLapCoursesInDay(@Param("dates") List<Date> dates, @Param("startClassTime") Date startClassTime,
-                                                 @Param("endClassTime") Date endClassTime);
+                                                 @Param("endClassTime") Date endClassTime, @Param("tenantId") Integer tenantId);
 
     /**
      * @Author: Joburgess
@@ -491,15 +491,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<StudentCourseScheduleRecordDto> findStudentCourseScheduleRecords(Map<String, Object> params);
 
     /**
-     * @param classGroupId: 班级编号
-     * @return com.ym.mec.biz.dal.entity.CourseSchedule
-     * @describe 获取班级的下一节课
-     * @author Joburgess
-     * @date 2019/11/19
-     */
-    CourseSchedule getNextCourseSchedule(@Param("classGroupId") Integer classGroupId);
-
-    /**
      * @Author: Joburgess
      * @Date: 2019/9/30
      * 统计学生上课记录
@@ -565,7 +556,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param status    课程状态
      * @return
      */
-    List<Map<Integer, Integer>> queryVipGroupTeachereClassTimesByMonth(@Param("monthDate") Date monthDate, @Param("status") CourseStatusEnum status);
+    List<Map<Integer, Integer>> queryVipGroupTeachereClassTimesByMonth(@Param("monthDate") Date monthDate, @Param("status") CourseStatusEnum status, @Param("tenantId") Integer tenantId);
 
     /**
      * 查询已完成未更新状态的课程列表
@@ -753,42 +744,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     Integer countMusicGroupIdsWithoutOverGroup(Map<String, Object> params);
 
-    /**
-     * @param startTime: 开始时间
-     * @param endTime:   结束时间
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
-     * @describe 获取时间段内未开始的课程
-     * @author Joburgess
-     * @date 2019/10/31
-     */
-    List<CourseSchedule> findByDateZone(@Param("startTime") Date startTime,
-                                        @Param("endTime") Date endTime);
-
-    /**
-     * @param startTime: 开始时间
-     * @param endTime:   结束时间
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
-     * @describe 获取时间段内所有的课程
-     * @author Joburgess
-     * @date 2019/10/31
-     */
-    List<CourseSchedule> findAllCourseByDateZone(@Param("startTime") Date startTime,
-                                                 @Param("endTime") Date endTime);
-
-    List<CourseSchedule> findByClassDate(@Param("classDates") List<String> classDates);
-
-    List<CourseSchedule> findByClassDateWithoutMusicGroup(@Param("classDates") List<String> classDates);
-
-    /**
-     * @param startTime: 开始时间
-     * @param endTime:   结束时间
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
-     * @describe 获取时间段内所有的课程(去除无关字段)
-     * @author Joburgess
-     * @date 2019/10/31
-     */
-    List<CourseSchedule> findAllCourseByDateZone2(@Param("startTime") Date startTime,
-                                                  @Param("endTime") Date endTime);
+    List<CourseSchedule> findByClassDate(@Param("classDates") List<String> classDates, @Param("tenantId") Integer tenantId);
 
     /**
      * 查询学生明天的课程数
@@ -847,17 +803,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @author Joburgess
      * @date 2019/11/3
      */
-    List<CourseSchedule> findCourseScheduleWithDate(@Param("startDate") String startDate, @Param("endDate") String endDate);
-
-    /**
-     * @param startDate:
-     * @param endDate:
-     * @return int
-     * @describe 统计指定时间段内已结算的课程组类型数量
-     * @author Joburgess
-     * @date 2020/12/29 0029
-     */
-    int countIsSalaryGroupTypes(@Param("startDate") String startDate, @Param("endDate") String endDate);
+    List<CourseSchedule> findCourseScheduleWithDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("tenantId") Integer tenantId);
 
     /**
      * @param classGroupId: 班级编号
@@ -896,8 +842,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     List<Map<Integer, String>> findStudentMap(Long courseScheduleId);
 
-    List<CourseSchedule> findAllCourseSches();
-
     /**
      * 获取一节班级的课程
      *
@@ -934,13 +878,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     int deleteCourseSchedulesByClassGroupIds(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
     /**
-     * 查询所有未签到的学生信息
-     *
-     * @return
-     */
-    List<StudentAttendance> queryUnsignedStudentList();
-
-    /**
      * @param currentCourseDate: 班级编号
      * @return java.lang.Integer
      * @describe 统计已上的课时数
@@ -1202,24 +1139,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     int endCountCourseSchedules(Map<String, Object> params);
 
     /**
-     * @param search: 搜索关键字
-     * @return java.util.List<java.lang.Integer>
-     * @describe 根据关键字查询学生相关的课程编号
-     * @author Joburgess
-     * @date 2019/12/31
-     */
-    Set<Integer> findCourseIdsByStudent(String search);
-
-    /**
-     * @param search: 搜索关键字
-     * @return java.util.List<java.lang.Integer>
-     * @describe 根据关键字查询教师相关的课程编号
-     * @author Joburgess
-     * @date 2019/12/31
-     */
-    Set<Integer> findCourseIdsByTeacher(String search);
-
-    /**
      * @param groupType:
      * @param groupId:
      * @return int
@@ -1253,30 +1172,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
                                 @Param("groupId") String groupId);
 
     /**
-     * 获取课程编号列表
-     *
-     * @param params
-     * @return
-     */
-    Set<Integer> queryMusicCourseScheduleIds(Map<String, Object> params);
-
-    /**
-     * 获取课程编号列表
-     *
-     * @param params
-     * @return
-     */
-    Set<Integer> queryVipCourseScheduleIds(Map<String, Object> params);
-
-    /**
-     * 获取陪练课课程编号列表
-     *
-     * @param params
-     * @return
-     */
-    Set<Integer> queryPracticeCourseScheduleIds(Map<String, Object> params);
-
-    /**
      * @param userIds:   教师编号列表
      * @param startTime: 开始时间
      * @param endTime:   结束时间
@@ -1576,7 +1471,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param groupType
      * @return
      */
-    List<CourseScheduleRateDto> findCourseRate(@Param("groupId") String groupId, @Param("groupType") String groupType, @Param("classGroupId") Integer classGroupId);
+    List<CourseScheduleRateDto> findCourseRate(@Param("groupId") String groupId, @Param("groupType") String groupType, @Param("classGroupId") Integer classGroupId,@Param("tenantId") Integer tenantId);
 
     /**
      * 获取最后一次已结束的课程

+ 20 - 18
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleEvaluateDao.java

@@ -5,7 +5,9 @@ import com.ym.mec.biz.dal.dto.PracticeGroupsDto;
 import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
+
 import org.apache.ibatis.annotations.Param;
+import org.junit.runners.Parameterized.Parameters;
 
 import java.util.Date;
 import java.util.List;
@@ -16,17 +18,17 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
 
     List<CourseScheduleEvaluate> findByClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds);
 
-    List<PracticeGroupsDto> getPracticeGroupsFree();
+    List<PracticeGroupsDto> getPracticeGroupsFree(Integer tenantId);
 
-    List<PracticeGroupsDto> getPracticeGroupsBuy();
+    List<PracticeGroupsDto> getPracticeGroupsBuy(Integer tenantId);
 
-    List<PracticeGroupsDto> getPracticeGroupsRenew();
+    List<PracticeGroupsDto> getPracticeGroupsRenew(Integer tenantId);
 
-    List<PracticeGroupsDto> getHasReportNums();
+    List<PracticeGroupsDto> getHasReportNums(Integer tenantId);
 
-    List<PracticeGroupsDto> getOrganPracticeGroups();
+    List<PracticeGroupsDto> getOrganPracticeGroups(Integer tenantId);
 
-    List<PracticeGroupsDto> getOrganMoney();
+    List<PracticeGroupsDto> getOrganMoney(Integer tenantId);
 
     /**
      * @param expiredDate:
@@ -35,7 +37,7 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
      * @author Joburgess
      * @date 2020/2/28
      */
-    List<CourseScheduleEvaluate> findExpiredDateBeforeReport(@Param("expiredDate") Date expiredDate);
+    List<CourseScheduleEvaluate> findExpiredDateBeforeReport(@Param("expiredDate") Date expiredDate,@Param("tenantId") Integer tenantId);
 
     /**
      * 根据课程组id获取报告列表
@@ -67,7 +69,7 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
      * @param teacherId
      * @return
      */
-    List<CourseScheduleEvaluate> getNeedPostReports(@Param("teacherId") Integer teacherId);
+    List<CourseScheduleEvaluate> getNeedPostReports(@Param("teacherId") Integer teacherId, @Param("tenantId") Integer tenantId);
 
     /**
      * 批量插入报告
@@ -100,35 +102,35 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
      * @param type
      * @return
      */
-    List<PracticeGroupsDto> getMonthOrganMoney(@Param("type") OrderTypeEnum type, @Param("startTime") Date startTime);
+    List<PracticeGroupsDto> getMonthOrganMoney(@Param("type") OrderTypeEnum type, @Param("startTime") Date startTime, @Param("tenantId") Integer tenantId);
 
     /**
      * 获取当月新成交金额,人数
      *
      * @return
      */
-    List<PracticeGroupsDto> getOrganNewPracticeGroupsOfMonth(@Param("type") OrderTypeEnum type, @Param("startTime") Date startTime);
+    List<PracticeGroupsDto> getOrganNewPracticeGroupsOfMonth(@Param("type") OrderTypeEnum type, @Param("startTime") Date startTime, @Param("tenantId") Integer tenantId);
 
     /**
      * 获取分部体验人数(去除禁止)
      *
      * @return
      */
-    List<Practice4OrganDto> getTryNums();
+    List<Practice4OrganDto> getTryNums(Integer tenantId);
 
     /**
      * 网管课体验人数
      *
      * @return
      */
-    List<Practice4OrganDto> getPracticeTryNums();
+    List<Practice4OrganDto> getPracticeTryNums(Integer tenantId);
 
     /**
      * vip课体验人数
      *
      * @return
      */
-    List<Practice4OrganDto> getVipTryNums();
+    List<Practice4OrganDto> getVipTryNums(Integer tenantId);
 
     /**
      * 网管课转化人数
@@ -136,7 +138,7 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
      * @param classDate
      * @return
      */
-    List<Practice4OrganDto> getPracticeBuyNums(@Param("classDate") Date classDate, @Param("endDate") Date endDate);
+    List<Practice4OrganDto> getPracticeBuyNums(@Param("classDate") Date classDate, @Param("endDate") Date endDate, @Param("tenantId") Integer tenantId);
 
     /**
      * VIP课转化人数
@@ -144,7 +146,7 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
      * @param classDate
      * @return
      */
-    List<Practice4OrganDto> getVipBuyNums(@Param("classDate") Date classDate, @Param("endDate") Date endDate);
+    List<Practice4OrganDto> getVipBuyNums(@Param("classDate") Date classDate, @Param("endDate") Date endDate, @Param("tenantId") Integer tenantId);
 
     /**
      * 网管课和vip课同事存在的人数
@@ -153,18 +155,18 @@ public interface CourseScheduleEvaluateDao extends BaseDAO<Long, CourseScheduleE
      * @param endDate
      * @return
      */
-    List<Practice4OrganDto> getPracticeAndVipNums(@Param("classDate") Date classDate, @Param("endDate") Date endDate);
+    List<Practice4OrganDto> getPracticeAndVipNums(@Param("classDate") Date classDate, @Param("endDate") Date endDate, @Param("tenantId") Integer tenantId);
 
     /**
      * 禁止中vip和网管同时存在人数
      *
      * @return
      */
-    List<Practice4OrganDto> getPracticeAndVipTryNums();
+    List<Practice4OrganDto> getPracticeAndVipTryNums(Integer tenantId);
 
     /**
      * 获取所有的体验人数
      * @return
      */
-    List<Practice4OrganDto> getAllTryNums();
+    List<Practice4OrganDto> getAllTryNums(Integer tenantId);
 }

+ 5 - 15
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -177,14 +177,14 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      *
      * @return
      */
-    Set<Integer> queryMusicStudentPer();
+    Set<Integer> queryMusicStudentPer(Integer tenantId);
 
     /**
      * 根据乐团,vip状态获取编号
      *
      * @return
      */
-    Set<Integer> queryVipStudentPer();
+    Set<Integer> queryVipStudentPer(Integer tenantId);
 
     /**
      * @param courseIds: 统计课程上的学生人数
@@ -277,16 +277,6 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      */
     List<Map<Integer, String>> getStudentIdMap(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
-    /**
-     * @param monday:
-     * @return java.util.List<java.lang.Integer>
-     * @describe 获取在指定时间之后不存在网管课的学员编号列表
-     * @author Joburgess
-     * @date 2020/4/10
-     */
-    List<Practice4ExercisesSituationDto> findNoPracticeStudentIdsOnWeek(@Param("monday") String monday,
-                                                                        @Param("sunday") String sunday);
-
     Integer findNoPracticeStudentTeacherId(@Param("studentId") Integer studentId);
 
     /**
@@ -296,7 +286,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      */
     List<StudentCourseTimesDto> queryStudentNotStartCourseTimesOfOnline();
 
-    List<StudentTeacherCourseDto> findAllStudentCourseInfo();
+    List<StudentTeacherCourseDto> findAllStudentCourseInfo(Integer tenantId);
 
     /**
      * @param courseScheduleIds:
@@ -568,7 +558,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     * @author zx
     * @date 2021/11/5 11:30
     */
-    boolean hasCourse(@Param("organId") String organId);
+    boolean hasCourse(@Param("organId") String organId, @Param("tenantId") Integer tenantId);
 
     /**
     * @description:  报表中心学员小课记录导出
@@ -577,7 +567,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     * @author zx
     * @date 2021/11/5 11:54 
     */
-    List<StudentVipPracticeExportDto> exportStudentVipPractice(@Param("organId") String organId);
+    List<StudentVipPracticeExportDto> exportStudentVipPractice(@Param("organId") String organId, @Param("tenantId") Integer tenantId);
 
     List<BaseNameDto> queryLastOverTeacher(@Param("studentIds") List<Integer> studentIds, @Param("groupType") String groupType);
 }

+ 7 - 9
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java

@@ -76,9 +76,7 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @params [days:天数]
 	 * @describe 获取多少天之前的未结算教师课酬记录(vip课)
 	 */
-	List<CourseScheduleTeacherSalary> findSomeDayAgoTeacherCourseSalaryNoSettlement(@Param("startDate") String startDate,@Param("endDate") String endDate);
-
-	List<CourseScheduleTeacherSalary> findTemp();
+	List<CourseScheduleTeacherSalary> findSomeDayAgoTeacherCourseSalaryNoSettlement(@Param("startDate") String startDate,@Param("endDate") String endDate, @Param("tenantId") Integer tenantId);
 
 	/**
 	 * @return java.util.List<com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary>
@@ -89,7 +87,7 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 */
 	List<CourseScheduleTeacherSalary> findTeacherCourseSalaryNoSettlement(@Param("startDate") String startDate,
 																		  @Param("endDate") String endDate,
-																		  @Param("groupType") String groupType);
+																		  @Param("groupType") String groupType, @Param("tenantId") Integer tenantId);
 
 	/**
 	 * 查询老师指定课程的课酬
@@ -389,7 +387,7 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @param endDate
 	 * @return
 	 */
-	List<TeacherVipSalaryDto> queryOnlineCourseByGroupType(@Param("startDate") String startDate, @Param("endDate") String endDate);
+	List<TeacherVipSalaryDto> queryOnlineCourseByGroupType(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("tenantId") Integer tenantId);
 	/**
 	 * 该用户是不是这个群组的老师
 	 * @param groupId
@@ -425,7 +423,7 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @return java.util.List<java.lang.Long>
 	 */
 	List<Long> findTeacherSalaryIdsWithMonth(@Param("teacherId") Integer teacherId,
-											 @Param("month") String month);
+											 @Param("month") String month, @Param("tenantId") Integer tenantId);
 
 	/**
 	 * @describe 获取指定月份已结算的老师编号
@@ -434,7 +432,7 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @param month:
 	 * @return java.util.List<java.lang.Integer>
 	 */
-	List<Integer> findIsSettlementTeacherIdsWithMonth(@Param("month") String month);
+	List<Integer> findIsSettlementTeacherIdsWithMonth(@Param("month") String month, @Param("tenantId") Integer tenantId);
 
 	/**
 	 * @describe 更新指定课酬的确认状态
@@ -485,7 +483,7 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
      * @return int
      */
     int countOpenConfirmSalarysWithMonth(@Param("month") String month,
-										 @Param("confirmStatus") TeacherSalaryConfirmStatus confirmStatus);
+										 @Param("confirmStatus") TeacherSalaryConfirmStatus confirmStatus, @Param("tenantId") Integer tenantId);
 
     /**
      * @describe 获取课程结算时间
@@ -542,7 +540,7 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 	 * @param endDate:
 	 * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary>
 	 */
-	List<CourseScheduleTeacherSalary> getIsSalaryWithDate(@Param("startDate") String startDate, @Param("endDate") String endDate);
+	List<CourseScheduleTeacherSalary> getIsSalaryWithDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("tenantId") Integer tenantId);
 
 	/**
 	 * @describe 获取教师收入总览

+ 3 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/DegreeLevelFeeDao.java

@@ -1,10 +1,9 @@
 package com.ym.mec.biz.dal.dao;
 
+import java.util.List;
+
 import com.ym.mec.biz.dal.entity.DegreeLevelFee;
 import com.ym.mec.common.dal.BaseDAO;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
 
 public interface DegreeLevelFeeDao extends BaseDAO<Long, DegreeLevelFee> {
 
@@ -13,6 +12,6 @@ public interface DegreeLevelFeeDao extends BaseDAO<Long, DegreeLevelFee> {
      *
      * @return
      */
-    List<DegreeLevelFee> getAll();
+    List<DegreeLevelFee> getAll(Integer tenantId);
 
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ChargeType.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import com.ym.mec.common.entity.BaseEntity;
 
 import io.swagger.annotations.ApiModelProperty;
 
@@ -11,7 +12,7 @@ import java.util.List;
 /**
  * 对应数据库表(charge_type):
  */
-public class ChargeType {
+public class ChargeType extends BaseEntity {
 
 	/**  */
 	@ApiModelProperty(value = "收费类型编号",required = false)

+ 0 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java

@@ -38,13 +38,6 @@ public interface CloudTeacherOrderService extends BaseService<Long, CloudTeacher
 
 
     /**
-     * 检测云教练是否开始生效,乐团上课后开始生效
-     *
-     * @return
-     */
-    Boolean checkCloudOrderStart();
-
-    /**
      * 将生效的云教练订单加入
      *
      * @param cloudTeacherOrder

+ 0 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -326,17 +326,6 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 */
 	Boolean checkNewCourseSchedules(List<CourseSchedule> courseSchedules,boolean checkExistCourseSchedule,Boolean postponeFlag);
 
-	void checkNewCourseSchedulesWithoutMusicGroup(List<CourseSchedule> courseSchedules,boolean checkExistCourseSchedule);
-
-	/**
-	 * @describe 临时课检测
-	 * @author 周剑河
-	 * @date 2019/12/6
-	 * @param courseSchedules: 课程计划列表
-	 * @return void
-	 */
-	List<Long> checkSnapCourseShchedules(List<CourseSchedule> courseSchedules);
-
 	/**
 	 * @describe
 	 * @author Joburgess

+ 0 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/ExtracurricularExercisesReplyService.java

@@ -60,14 +60,6 @@ public interface ExtracurricularExercisesReplyService extends BaseService<Long,
      */
     PageInfo<ExtraExerciseStudentsDto> findExtraExercises(ExtraExercilseReplyQueryInfo queryInfo);
 
-    /**
-     * @describe 学生服务信息统计
-     * @author Joburgess
-     * @date 2020/4/10
-     * @param : 
-     * @return void
-     */
-    void exercisesSituationStatistics();
     void exercisesSituationStatistics2(String monday);
 
     PageInfo<EduHomeworkCardDto> getEduHomeworkList(StudentCourseHomeWorkQueryInfo queryInfo);

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChildrenDayReserveServiceImpl.java

@@ -12,10 +12,12 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,8 +26,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.*;
-
-import java.util.List;
 import java.util.stream.Collectors;
 
 @Service
@@ -140,7 +140,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
 
     @Override
     public DegreeFeeDto getFeeInfo(Integer organId) {
-        List<DegreeLevelFee> degreeLevelFee = degreeLevelFeeDao.getAll();
+        List<DegreeLevelFee> degreeLevelFee = degreeLevelFeeDao.getAll(TenantContextHolder.getTenantId());
         OrganizationDegreeCourseFee courseFee = organizationDegreeCourseFeeDao.getByOrganId(organId);
         DegreeFeeDto degreeFeeDto = new DegreeFeeDto();
         degreeFeeDto.setDegreeLevelFee(degreeLevelFee);
@@ -242,7 +242,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
         }
         degreePayDto.setReserveId(userReserve.getId());
 
-        List<DegreeLevelFee> degreeLevelFees = degreeLevelFeeDao.getAll();
+        List<DegreeLevelFee> degreeLevelFees = degreeLevelFeeDao.getAll(TenantContextHolder.getTenantId());
 
         //订单总金额
         BigDecimal orderAmount = BigDecimal.ZERO;

+ 2 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -2698,7 +2698,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if (!CollectionUtils.isEmpty(teacherAttendances)) {
             teacherAttendanceDao.batchInsert(teacherAttendances);
         }
-        cloudTeacherOrderService.checkCloudOrderStart();
         imUserFriendService.refreshGroupImUserFriend(termCourseDetail.getMusicGroupId(),MUSIC);
     }
 
@@ -3850,8 +3849,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             if (!CollectionUtils.isEmpty(groups)) {
                 params.put("groups", groups);
             }
-            List<Integer> studentClassGroupIds = classGroupDao.findClassGroupIdsByStudent(queryInfo.getSearch());
-            List<Integer> teacherClassGroupIds = classGroupDao.findClassGroupIdsByTeacher(queryInfo.getSearch());
+            List<Integer> studentClassGroupIds = classGroupDao.findClassGroupIdsByStudent(queryInfo.getSearch(), queryInfo.getTenantId());
+            List<Integer> teacherClassGroupIds = classGroupDao.findClassGroupIdsByTeacher(queryInfo.getSearch(), queryInfo.getTenantId());
             studentClassGroupIds.addAll(teacherClassGroupIds);
             if (!CollectionUtils.isEmpty(studentClassGroupIds)) {
                 params.put("classGroupIds", studentClassGroupIds);

+ 0 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java

@@ -284,19 +284,6 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
 	}
 
     @Override
-    public Boolean checkCloudOrderStart() {
-        List<CloudTeacherOrder> cloudTeacherOrders = cloudTeacherOrderDao.getNoStartCloudTeacherOrder();
-        List<String> musicGroupIds = cloudTeacherOrders.stream().map(CloudTeacherOrder::getMusicGroupId).collect(Collectors.toList());
-        List<CourseSchedule> musicGroupsHasStartCourseNum = courseScheduleDao.getMusicGroupsHasStartCourseNum(musicGroupIds);
-        Set<String> musicGroupHasStartCourse = musicGroupsHasStartCourseNum.stream().map(CourseSchedule::getMusicGroupId).collect(Collectors.toSet());
-        for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
-            if (!musicGroupHasStartCourse.contains(cloudTeacherOrder.getMusicGroupId())) continue;
-            addStudentCloudTeacher(cloudTeacherOrder);
-        }
-        return true;
-    }
-
-    @Override
     @Transactional(rollbackFor = Exception.class)
     public CloudTeacher addStudentCloudTeacher(CloudTeacherOrder cloudTeacherOrder) {
         Date nowDate = new Date();

+ 6 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleEvaluateServiceImpl.java

@@ -16,8 +16,10 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.date.DateUtil;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
@@ -126,7 +128,8 @@ public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, Cou
 
     @Override
     public List<CourseScheduleEvaluate> getNeedPostList(Integer teacherId) {
-        return courseScheduleEvaluateDao.getNeedPostReports(teacherId);
+        Integer tenantId = TenantContextHolder.getTenantId();
+        return courseScheduleEvaluateDao.getNeedPostReports(teacherId, tenantId);
     }
 
     @Override
@@ -209,7 +212,8 @@ public class CourseScheduleEvaluateServiceImpl extends BaseServiceImpl<Long, Cou
 
     @Override
     public void pushNeedPostReport() {
-        List<CourseScheduleEvaluate> needPostReports = courseScheduleEvaluateDao.getNeedPostReports(null);
+        Integer tenantId = TenantContextHolder.getTenantId();
+        List<CourseScheduleEvaluate> needPostReports = courseScheduleEvaluateDao.getNeedPostReports(null, tenantId);
         if (needPostReports.size() == 0) {
             return;
         }

+ 6 - 369
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -1039,7 +1039,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(StringUtils.isNotBlank(organIdList)){
 			organIds = Arrays.stream(organIdList.split(",")).map(s->Integer.valueOf(s)).collect(Collectors.toList());
 		}
-		return courseScheduleDao.getCourseScheduleDateWithOrgan(organIds, month, type, transactionTeacherId);
+		return courseScheduleDao.getCourseScheduleDateWithOrgan(organIds, month, type, transactionTeacherId, TenantContextHolder.getTenantId());
     }
 
     @Override
@@ -1742,7 +1742,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		if(!DateUtil.isSameDay(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime())){
 			throw new BizException("课程时间不允许跨天");
 		}
-		List<CourseSchedule> allCourseSchedules = courseScheduleDao.findByClassDate(Arrays.asList(DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd")));
+		List<CourseSchedule> allCourseSchedules = courseScheduleDao.findByClassDate(Arrays.asList(DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd")),TenantContextHolder.getTenantId());
 
 		if(null == allCourseSchedules){
 			allCourseSchedules = new ArrayList<>();
@@ -1884,7 +1884,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))
                 .collect(Collectors.toList());
 
-        List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates);
+        List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates, TenantContextHolder.getTenantId());
 
         //只需要调整课程信息的课程编号列表
         List<Long> updateCourseScheduleIds = courseSchedules
@@ -2103,369 +2103,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         return true;
     }
 
-    @Override
-    public void checkNewCourseSchedulesWithoutMusicGroup(List<CourseSchedule> courseSchedules, boolean checkExistCourseSchedule) {
-        if (CollectionUtils.isEmpty(courseSchedules)) {
-            return;
-        }
-        List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))
-                .collect(Collectors.toList());
-
-        List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDateWithoutMusicGroup(classDates);
-
-        //只需要调整课程信息的课程编号列表
-        List<Long> updateCourseScheduleIds = courseSchedules
-                .stream()
-                .filter(courseSchedule -> Objects.nonNull(courseSchedule.getId()))
-                .map(CourseSchedule::getId)
-                .collect(Collectors.toList());
-
-        //排除只需调整的课程
-        existCourseSchedules = existCourseSchedules.stream()
-                .filter(courseSchedule -> !updateCourseScheduleIds.contains(courseSchedule.getId()))
-                .collect(Collectors.toList());
-        //新课程对应的班级编号列表
-        List<Integer> newCourseScheduleClassGroupIds = courseSchedules
-                .stream()
-                .map(CourseSchedule::getClassGroupId)
-                .distinct()
-                .collect(Collectors.toList());
-
-        List<Long> existCourseScheduleIds = existCourseSchedules.stream()
-                .map(CourseSchedule::getId)
-                .collect(Collectors.toList());
-
-        HashSet<Long> courseScheduleIdsSet = new HashSet<>(existCourseScheduleIds);
-
-        //合并新课程和已存在的课程
-        List<CourseSchedule> allCourseSchedules;
-        if (!CollectionUtils.isEmpty(existCourseSchedules)) {
-            allCourseSchedules = ListUtils.sum(courseSchedules, existCourseSchedules);
-        } else {
-            allCourseSchedules = courseSchedules;
-        }
-        //所有课程的班级编号
-        List<Integer> classGroupIds = allCourseSchedules
-                .stream()
-                .map(CourseSchedule::getClassGroupId)
-                .distinct()
-                .collect(Collectors.toList());
-        //班级与学生的关联记录
-        List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findByClassGroups(classGroupIds);
-        Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentMappers
-                .stream()
-                .collect(Collectors.groupingBy(ClassGroupStudentMapper::getClassGroupId));
-
-        //根据课程获取助教id关联集合
-        List<IntegerAndIntegerListDto> courseScheduleTeachingTeacherIdList = new ArrayList<>();
-        if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
-            courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, TeachTypeEnum.TEACHING.getCode());
-        }
-        Map<Long, IntegerAndIntegerListDto> courseScheduleTeachingTeacherMap = courseScheduleTeachingTeacherIdList.stream()
-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
-
-        //班级助教关联ID集合
-        List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, TeachTypeEnum.TEACHING.getCode());
-        Map<Long, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
-
-        Set<Long> existCourseScheduleIdsSet=new HashSet<>(existCourseScheduleIds);
-
-        Map<String, List<CourseSchedule>> existClassDateCoursesMap = allCourseSchedules.stream().collect(Collectors.groupingBy(c -> DateUtil.dateToString(c.getClassDate(), "yyyy-MM-dd")));
-        Map<String, List<CourseSchedule>> newClassDateCoursesMap = courseSchedules.stream().collect(Collectors.groupingBy(c -> DateUtil.dateToString(c.getClassDate(), "yyyy-MM-dd")));
-        if (allCourseSchedules.size() > 1) {
-            for (Map.Entry<String, List<CourseSchedule>> classDateCourseEntry : newClassDateCoursesMap.entrySet()) {
-                List<CourseSchedule> existClassDateCourses = existClassDateCoursesMap.get(classDateCourseEntry.getKey());
-                if(CollectionUtils.isEmpty(existClassDateCourses)){
-                    continue;
-                }
-                List<CourseSchedule> newClassDateCourses=classDateCourseEntry.getValue();
-                existClassDateCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
-                newClassDateCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
-                for (CourseSchedule preCourseSchedule : newClassDateCourses) {
-                    for (CourseSchedule backCourseSchedule : existClassDateCourses) {
-
-                        //判断前后两节课是否存在冲突
-                        if (!preCourseSchedule.getStartClassTime().before(backCourseSchedule.getEndClassTime())
-                                ||!preCourseSchedule.getEndClassTime().after(backCourseSchedule.getStartClassTime())) {
-                            continue;
-                        }
-                        if (!checkExistCourseSchedule
-                                && !courseScheduleIdsSet.contains(backCourseSchedule.getId())) {
-                            continue;
-                        }
-
-                        //如果存在时间重叠,则需要判断前后两节课的教师和学生是否存在冲突
-                        //主教冲突检测
-                        if (Objects.nonNull(preCourseSchedule.getActualTeacherId())
-                                && preCourseSchedule.getActualTeacherId().equals(backCourseSchedule.getActualTeacherId())) {
-
-                            throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 1));
-                        }
-                        //助教冲突检测
-                        if (Objects.isNull(preCourseSchedule.getId())) {
-                            IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId());
-                            if (Objects.nonNull(integerAndIntegerListDto)) {
-                                preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-                            }
-                        } else if (existCourseScheduleIdsSet.contains(preCourseSchedule.getId())) {
-                            IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(preCourseSchedule.getId());
-                            if (Objects.nonNull(integerAndIntegerListDto)) {
-                                preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-                            }
-                        }
-                        if (Objects.isNull(backCourseSchedule.getId())) {
-                            IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId());
-                            if (Objects.nonNull(integerAndIntegerListDto)) {
-                                backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-                            }
-                        } else if (existCourseScheduleIdsSet.contains(backCourseSchedule.getId())) {
-                            IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(backCourseSchedule.getId());
-                            if (Objects.nonNull(integerAndIntegerListDto)) {
-                                backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds());
-                            }
-                        }
-                        if (!CollectionUtils.isEmpty(preCourseSchedule.getTeachingTeacherIdList())
-                                && !CollectionUtils.isEmpty(backCourseSchedule.getTeachingTeacherIdList())) {
-                            List<Integer> repeatIds = preCourseSchedule.getTeachingTeacherIdList()
-                                    .stream().filter(backCourseSchedule.getTeachingTeacherIdList()::contains)
-                                    .collect(Collectors.toList());
-                            if (!CollectionUtils.isEmpty(repeatIds)) {
-                                throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 2));
-                            }
-                        }
-                        //学生冲突检测
-                        if (preCourseSchedule.getClassGroupId().equals(backCourseSchedule.getClassGroupId())) {
-                            //如果班级相同,则学生肯定存在冲突
-                            throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 3));
-                        }
-                        //如果班级不同,则需要检测两个班级是否存在重复的学生
-                        List<ClassGroupStudentMapper> preClassGroupStudents = classGroupStudentsMap.get(preCourseSchedule.getClassGroupId());
-                        List<ClassGroupStudentMapper> backClassGroupStudents = classGroupStudentsMap.get(backCourseSchedule.getClassGroupId());
-                        //如果有一个存在没有学生的班级则不存在冲突
-                        if (CollectionUtils.isEmpty(preClassGroupStudents) || CollectionUtils.isEmpty(backClassGroupStudents)) {
-                            continue;
-                        }
-                        //当前课程所在班级的学生编号列表
-                        List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
-                                .map(ClassGroupStudentMapper::getUserId)
-                                .collect(Collectors.toList());
-                        //后面一节课程所在班级的学生编号列表
-                        Set<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
-                                .map(ClassGroupStudentMapper::getUserId)
-                                .collect(Collectors.toSet());
-                        List<Integer> repeatStudentIds = preClassGroupStudentIds.stream()
-                                .filter(backClassGroupStudentIds::contains)
-                                .collect(Collectors.toList());
-                        if (!CollectionUtils.isEmpty(repeatStudentIds)) {
-                            throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 3));
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public List<Long> checkSnapCourseShchedules(List<CourseSchedule> courseSchedules) {
-        List<Long> courseScheduleIds = new ArrayList<>();
-        List<CourseScheduleStudentDto> courseScheduleStudents = new ArrayList<>();
-        if (CollectionUtils.isEmpty(courseSchedules)) {
-            return courseScheduleIds;
-        }
-        //第一节课
-        CourseSchedule firstCourseSchedule;
-        //最后一节课
-        CourseSchedule latestCourseSchedule;
-        if (courseSchedules.size() == 1) {
-            firstCourseSchedule = courseSchedules.get(0);
-            latestCourseSchedule = courseSchedules.get(0);
-        } else {
-            firstCourseSchedule = courseSchedules.stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
-            latestCourseSchedule = courseSchedules.stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
-        }
-        //获取第一节课和最后一节课所包含的时间段内已存在的课程
-        List<CourseSchedule> existCourseSchedules = courseScheduleDao
-                .findAllCourseByDateZone(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
-
-        if (existCourseSchedules == null || existCourseSchedules.size() == 0) {
-            return null;
-        }
-        //只需要调整课程信息的课程编号列表
-        List<Long> updateCourseScheduleIds = courseSchedules
-                .stream()
-                .filter(courseSchedule -> Objects.nonNull(courseSchedule.getId()))
-                .map(CourseSchedule::getId)
-                .collect(Collectors.toList());
-
-        //排除只需调整的课程
-        existCourseSchedules = existCourseSchedules.stream()
-                .filter(courseSchedule -> !updateCourseScheduleIds.contains(courseSchedule.getId()))
-                .collect(Collectors.toList());
-        if (existCourseSchedules == null || existCourseSchedules.size() == 0) {
-            return null;
-        }
-
-
-        List<Long> existCourseScheduleIds = existCourseSchedules.stream()
-                .map(CourseSchedule::getId)
-                .collect(Collectors.toList());
-
-        //合并新课程和已存在的课程
-        List<CourseSchedule> allCourseSchedules;
-        if (!CollectionUtils.isEmpty(existCourseSchedules)) {
-            allCourseSchedules = ListUtils.sum(courseSchedules, existCourseSchedules);
-        } else {
-            allCourseSchedules = courseSchedules;
-        }
-
-        //新课程对应的班级编号列表
-        List<Integer> newCourseScheduleClassGroupIds = allCourseSchedules
-                .stream()
-                .map(CourseSchedule::getClassGroupId)
-                .distinct()
-                .collect(Collectors.toList());
-
-        //所有课程的班级编号
-        List<Integer> classGroupIds = allCourseSchedules
-                .stream()
-                .map(CourseSchedule::getClassGroupId)
-                .distinct()
-                .collect(Collectors.toList());
-        //班级与学生的关联记录
-        List<CourseScheduleStudentPayment> exitStudentPaymentList = courseScheduleStudentPaymentDao.findByCourseScheduleIds(existCourseScheduleIds);
-
-        List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findByClassGroups(classGroupIds);
-        Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentMappers
-                .stream()
-                .collect(Collectors.groupingBy(ClassGroupStudentMapper::getClassGroupId));
-
-        Map<Long, List<CourseScheduleStudentPayment>> exitStudentPaymentMap = exitStudentPaymentList.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getCourseScheduleId));
-
-        //根据课程获取教师id关联集合
-        List<IntegerAndIntegerListDto> courseScheduleTeachingTeacherIdList = new ArrayList<>();
-        if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
-            courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, null);
-        }
-        Map<Long, IntegerAndIntegerListDto> courseScheduleTeacherMap = courseScheduleTeachingTeacherIdList.stream()
-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
-
-        //班级教师关联ID集合
-        List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, null);
-        Map<Long, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
-
-		allCourseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
-        courseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
-
-        newNode:
-        for (CourseSchedule newCourseSchedule : courseSchedules) {
-            for (CourseSchedule existCourseSchedule : allCourseSchedules) {
-                if (newCourseSchedule.getEndClassTime().compareTo(existCourseSchedule.getStartClassTime()) <= 0) {
-                    continue newNode;
-                }
-                if (existCourseSchedule.getEndClassTime().compareTo(newCourseSchedule.getStartClassTime()) <= 0) {
-                    continue;
-                }
-
-                if(newCourseSchedule.equals(existCourseSchedule)){
-                	continue;
-				}
-
-                boolean isTeacherRepeat = false;
-                boolean isStudentRepeat = false;
-                //检测老师冲突
-				if (courseScheduleTeacherMap.containsKey(existCourseSchedule.getId())) {
-					existCourseSchedule.setTeachingTeacherIdList(courseScheduleTeacherMap.get(existCourseSchedule.getId()).getIds());
-				} else {
-					existCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(existCourseSchedule.getClassGroupId().longValue()).getIds());
-				}
-				newCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(newCourseSchedule.getClassGroupId().longValue()).getIds());
-
-                if (!CollectionUtils.isEmpty(newCourseSchedule.getTeachingTeacherIdList())
-                        && !CollectionUtils.isEmpty(existCourseSchedule.getTeachingTeacherIdList())) {
-                    List<Integer> repeatIds = newCourseSchedule.getTeachingTeacherIdList()
-                            .stream().filter(existCourseSchedule.getTeachingTeacherIdList()::contains)
-                            .collect(Collectors.toList());
-                    if (!CollectionUtils.isEmpty(repeatIds)) {
-                        isTeacherRepeat = true;
-                    }
-                }
-
-                //学生冲突检测
-                if (newCourseSchedule.getClassGroupId().equals(existCourseSchedule.getClassGroupId())) {
-                    //如果班级相同,则学生肯定全部存在冲突,当做老师冲突处理
-                    isTeacherRepeat = true;
-                }
-
-                List<Integer> repeatStudentIds = new ArrayList<>();
-                if (!isTeacherRepeat && classGroupStudentsMap.containsKey(newCourseSchedule.getClassGroupId()) && exitStudentPaymentMap.containsKey(existCourseSchedule.getId())) {
-                    //如果班级不同,则需要检测两个班级是否存在重复的学生
-                    List<ClassGroupStudentMapper> preClassGroupStudents = classGroupStudentsMap.get(newCourseSchedule.getClassGroupId());
-                    List<CourseScheduleStudentPayment> backClassGroupStudents = exitStudentPaymentMap.get(existCourseSchedule.getId());
-
-                    //当前课程所在班级的学生编号列表
-                    List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
-                            .map(ClassGroupStudentMapper::getUserId)
-                            .collect(Collectors.toList());
-                    //后面一节课程所在班级的学生编号列表
-                    List<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
-                            .map(CourseScheduleStudentPayment::getUserId)
-                            .collect(Collectors.toList());
-                    repeatStudentIds = preClassGroupStudentIds.stream()
-                            .filter(backClassGroupStudentIds::contains)
-                            .collect(Collectors.toList());
-                    if (!CollectionUtils.isEmpty(repeatStudentIds)) {
-                        isStudentRepeat = true;
-                    }
-
-                    if(isStudentRepeat && (backClassGroupStudentIds.size() == repeatStudentIds.size())){
-                        isStudentRepeat = false;
-                        isTeacherRepeat = true;
-                    }
-                }
-
-                if (!isTeacherRepeat && !isStudentRepeat) {
-                    continue;
-                }
-
-                if (ClassGroupTypeEnum.SNAP.getCode().equals(existCourseSchedule.getClassGroupType()) || ClassGroupTypeEnum.VIP.getCode().equals(existCourseSchedule.getClassGroupType())) {
-                    throw new BizException(courseCheckInfo(newCourseSchedule, existCourseSchedule, existCourseScheduleIds, isTeacherRepeat?1:3));
-                }
-
-                if (!existCourseSchedule.getGroupType().equals(newCourseSchedule.getGroupType()) || !existCourseSchedule.getMusicGroupId().equals(newCourseSchedule.getMusicGroupId())) {
-                    throw new BizException(courseCheckInfo(newCourseSchedule, existCourseSchedule, existCourseScheduleIds, isTeacherRepeat?1:3));
-                }
-
-                if (isTeacherRepeat) {
-                    courseScheduleIds.add(existCourseSchedule.getId());
-                }
-                if (isStudentRepeat) {
-                    CourseScheduleStudentDto courseScheduleStudentDto = new CourseScheduleStudentDto();
-                    courseScheduleStudentDto.setId(existCourseSchedule.getId());
-                    courseScheduleStudentDto.setStudentIds(repeatStudentIds);
-                    courseScheduleStudents.add(courseScheduleStudentDto);
-                }
-
-            }
-        }
-        //老师冲突删除课程课程
-        if (courseScheduleIds.size() > 0) {
-            courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
-            courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
-            teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds);
-            courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
-        }
-        //学生冲突删除学生课程
-        if (courseScheduleStudents.size() > 0) {
-            for (CourseScheduleStudentDto courseScheduleStudent : courseScheduleStudents) {
-                courseScheduleStudentPaymentDao.deleteStudentCourseScheduleByUserId(courseScheduleStudent.getId(), courseScheduleStudent.getStudentIds());
-            }
-        }
-        return courseScheduleIds;
-    }
-
     private String courseCheckInfo(CourseSchedule preCourseSchedule, CourseSchedule backCourseSchedule, List<Long> existCourseScheduleIds, Integer type) {
         List<CourseSchedule> courseSchedules=new ArrayList<>();
         courseSchedules.add(preCourseSchedule);
@@ -2552,7 +2189,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
      */
     private void checkCourseSchedule(List<CourseSchedule> courseSchedules) {
         List<Date> classDates = courseSchedules.stream().map(CourseSchedule::getClassDate).collect(Collectors.toList());
-        List<CourseSchedule> byClassGroupAndDate = courseScheduleDao.findByClassGroupAndDate(classDates, null);
+        List<CourseSchedule> byClassGroupAndDate = courseScheduleDao.findByClassGroupAndDate(classDates, null, TenantContextHolder.getTenantId());
         List<CourseSchedule> collect3 = Stream.of(courseSchedules, byClassGroupAndDate).flatMap(Collection::stream).collect(Collectors.toList());
         Map<Date, List<CourseSchedule>> collect = collect3.stream().collect(Collectors.groupingBy(CourseSchedule::getClassDate));
         for (Date keyDate : collect.keySet()) {
@@ -5706,12 +5343,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		CourseSchedule courseSchedule;
 		if(schedule.getGroupType() == MUSIC){
 			//获取当前班级
-			courseScheduleRateDtos = courseScheduleDao.findCourseRate(null,schedule.getGroupType().getCode(),schedule.getClassGroupId());
+			courseScheduleRateDtos = courseScheduleDao.findCourseRate(null,schedule.getGroupType().getCode(),schedule.getClassGroupId(), TenantContextHolder.getTenantId());
 			//获取最近一次已结束的课程
 			courseSchedule = courseScheduleDao.getLastEndCourse(null,schedule.getGroupType().getCode(),schedule.getClassGroupId());
 		}else {
 			//获取课程列表
-			courseScheduleRateDtos = courseScheduleDao.findCourseRate(schedule.getMusicGroupId(),schedule.getGroupType().getCode(),null);
+			courseScheduleRateDtos = courseScheduleDao.findCourseRate(schedule.getMusicGroupId(),schedule.getGroupType().getCode(),null, TenantContextHolder.getTenantId());
 			//获取最近一次已结束的课程
 			courseSchedule = courseScheduleDao.getLastEndCourse(schedule.getMusicGroupId(),schedule.getGroupType().getCode(),null);
 		}

+ 11 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -224,7 +224,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         Date date = DateUtil.addMonths(now, -1);
         String startDate = DateUtil.format(DateUtil.getFirstDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
         String endDate = DateUtil.format(DateUtil.getLastDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
-        List<CourseScheduleTeacherSalary> someDayAgoTeacherCourseSalaryNoSettlement = courseScheduleTeacherSalaryDao.findTeacherCourseSalaryNoSettlement(startDate,endDate,"PRACTICE");
+        List<CourseScheduleTeacherSalary> someDayAgoTeacherCourseSalaryNoSettlement = courseScheduleTeacherSalaryDao.findTeacherCourseSalaryNoSettlement(startDate,endDate,"PRACTICE",tenantId);
 
         if(CollectionUtils.isEmpty(someDayAgoTeacherCourseSalaryNoSettlement)){
             return;
@@ -339,14 +339,14 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         String endDate = DateUtil.format(DateUtil.getLastDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
 
         // 查询需要修改的课酬记录
-        List<TeacherVipSalaryDto> teacherSalaryList = courseScheduleTeacherSalaryDao.queryOnlineCourseByGroupType(startDate, endDate);
+        List<TeacherVipSalaryDto> teacherSalaryList = courseScheduleTeacherSalaryDao.queryOnlineCourseByGroupType(startDate, endDate, tenantId);
 
         Set<Integer> teacherIds = teacherSalaryList.stream().map(TeacherVipSalaryDto::getUserId).collect(Collectors.toSet());
         List<Teacher> teachers = teacherDao.findByTeacherIds(new ArrayList<>(teacherIds));
         Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getId, t -> t, (t1, t2) -> t1));
 
         //获取教师未结算课程记录
-        List<CourseScheduleTeacherSalary> someDayAgoTeacherCourseSalaryNoSettlement = courseScheduleTeacherSalaryDao.findSomeDayAgoTeacherCourseSalaryNoSettlement(startDate,endDate);
+        List<CourseScheduleTeacherSalary> someDayAgoTeacherCourseSalaryNoSettlement = courseScheduleTeacherSalaryDao.findSomeDayAgoTeacherCourseSalaryNoSettlement(startDate,endDate, tenantId);
         if (CollectionUtils.isEmpty(someDayAgoTeacherCourseSalaryNoSettlement)) {
             LOGGER.info("未获取到未结算课酬记录!");
             return;
@@ -677,7 +677,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         String startDate = DateUtil.format(DateUtil.getFirstDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
         String endDate = DateUtil.format(DateUtil.getLastDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
         //课程教师课酬
-        List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findTeacherCourseSalaryNoSettlement(startDate,endDate,"MUSIC");
+        List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findTeacherCourseSalaryNoSettlement(startDate,endDate,"MUSIC",tenantId);
 
         if (CollectionUtils.isEmpty(courseScheduleTeacherSalaries)) {
             return;
@@ -685,7 +685,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         List<Long> courseScheduleIds = courseScheduleTeacherSalaries.stream().map(CourseScheduleTeacherSalary::getCourseScheduleId).collect(Collectors.toList());
 
         //获取上个月的课程计划
-        List<CourseSchedule> yesterdayCourseSchedules = courseScheduleDao.findCourseScheduleWithDate(startDate,endDate);
+        List<CourseSchedule> yesterdayCourseSchedules = courseScheduleDao.findCourseScheduleWithDate(startDate,endDate, tenantId);
 
         Set<Integer> schoolIds = yesterdayCourseSchedules.stream().map(CourseSchedule::getSchoolId).collect(Collectors.toSet());
         Map<Integer, School> idSchoolMap = new HashMap<>();
@@ -1046,7 +1046,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         if(Objects.isNull(month)){
             month=DateUtil.dateToString(DateUtil.addMonths(new Date(), -1), "yyyy-MM");
         }
-        List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(teacherId, month);
+        List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(teacherId, month, TenantContextHolder.getTenantId());
         if(CollectionUtils.isEmpty(teacherSalaryIds)){
             return;
         }
@@ -1145,11 +1145,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         if(Objects.isNull(month)){
             month=DateUtil.dateToString(DateUtil.addMonths(new Date(), -1), "yyyy-MM");
         }
-        int i = courseScheduleTeacherSalaryDao.countOpenConfirmSalarysWithMonth(month,null);
+        int i = courseScheduleTeacherSalaryDao.countOpenConfirmSalarysWithMonth(month,null,TenantContextHolder.getTenantId());
         if(i<=0){
             throw new BizException("课酬确认已开启");
         }
-        List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(null, month);
+        List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(null, month, TenantContextHolder.getTenantId());
         if(CollectionUtils.isEmpty(teacherSalaryIds)){
             return;
         }
@@ -1159,7 +1159,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         String notifyUrl="8?"+teacherBaseUrl+"/#/remuneration?month=" + month;
         String monthStr = DateUtil.dateToString(DateUtil.stringToDate(month, "yyyy-MM"),"M月");
         String expireDateStr = DateUtil.dateToString(DateUtil.addDays(new Date(), 2), "M月d号");
-        List<Integer> teacherIds = courseScheduleTeacherSalaryDao.findIsSettlementTeacherIdsWithMonth(month);
+        List<Integer> teacherIds = courseScheduleTeacherSalaryDao.findIsSettlementTeacherIdsWithMonth(month, TenantContextHolder.getTenantId());
         Map<Integer, String> userMap = teacherIds.stream().collect(Collectors.toMap(Integer::valueOf, id->String.valueOf(id)));
         sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.TEACHER_PUSH_SALARY_CONFIRM,
                 userMap, null, 0, notifyUrl, "TEACHER", monthStr, expireDateStr);
@@ -1171,7 +1171,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         if(Objects.isNull(month)){
             month=DateUtil.dateToString(DateUtil.addMonths(new Date(), -1), "yyyy-MM");
         }
-        List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(null, month);
+        List<Long> teacherSalaryIds = courseScheduleTeacherSalaryDao.findTeacherSalaryIdsWithMonth(null, month, TenantContextHolder.getTenantId());
         if(CollectionUtils.isEmpty(teacherSalaryIds)){
             return;
         }
@@ -1502,7 +1502,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         String endDate = DateUtil.format(DateUtil.getLastDayOfMonth(date),DateUtil.DEFAULT_PATTERN);
 
         redisTemplate.delete(CourseScheduleTeacherSalaryService.TASK_KEY);
-        List<CourseScheduleTeacherSalary> salaries = courseScheduleTeacherSalaryDao.getIsSalaryWithDate(startDate, endDate);
+        List<CourseScheduleTeacherSalary> salaries = courseScheduleTeacherSalaryDao.getIsSalaryWithDate(startDate, endDate, tenantId);
         if(CollectionUtils.isEmpty(salaries)){
             return;
         }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -14,6 +14,7 @@ import com.ym.mec.biz.service.ExportService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.biz.service.StudentService;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.storage.StoragePluginContext;
 import com.ym.mec.thirdparty.storage.provider.KS3StoragePlugin;
 import com.ym.mec.util.collection.MapUtil;
@@ -891,7 +892,7 @@ public class ExportServiceImpl implements ExportService {
     @Override
     @Async
     public void studentVipPractice(String organId, ManagerDownload managerDownload) throws FileNotFoundException {
-        List<StudentVipPracticeExportDto> studentVipPracticeExportDtos = courseScheduleStudentPaymentDao.exportStudentVipPractice(organId);
+        List<StudentVipPracticeExportDto> studentVipPracticeExportDtos = courseScheduleStudentPaymentDao.exportStudentVipPractice(organId, TenantContextHolder.getTenantId());
         if(studentVipPracticeExportDtos != null && studentVipPracticeExportDtos.size() > 0){
             List<Integer> studentIds = studentVipPracticeExportDtos.stream().map(e -> e.getUserId()).collect(Collectors.toList());
             //获取学员最后一节已结束的vip课的老师以及编号

+ 0 - 66
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java

@@ -246,72 +246,6 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void exercisesSituationStatistics() {
-		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
-		if(nowDate.getDayOfWeek()==DayOfWeek.MONDAY){
-			nowDate = nowDate.plusDays(-1);
-			int lastWeekTodayUpdateNum = studentExtracurricularExercisesSituationDao.findLastWeekTodayUpdateNum(nowDate.toString());
-			if(lastWeekTodayUpdateNum>0){
-				nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
-			}
-		}
-		LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-		LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
-		List<Practice4ExercisesSituationDto> noPracticeStudents = courseScheduleStudentPaymentDao.findNoPracticeStudentIdsOnWeek(monDayDate.toString(),sunDayDate.toString());
-		if(CollectionUtils.isEmpty(noPracticeStudents)){
-			return;
-		}
-		Map<Integer, List<Practice4ExercisesSituationDto>> studentCourseMap = noPracticeStudents.stream().filter(e->Objects.nonNull(e.getCourseStartTime())).collect(Collectors.groupingBy(Practice4ExercisesSituationDto::getUserId));
-
-		List<ExtracurricularExercisesReply> noPracticeStudentExercisesInWeek = extracurricularExercisesReplyDao.findNoPracticeStudentExercisesInWeek(monDayDate.toString(), sunDayDate.toString());
-		Map<Integer, List<ExtracurricularExercisesReply>> studentExercisesMap = noPracticeStudentExercisesInWeek.stream().collect(Collectors.groupingBy(ExtracurricularExercisesReply::getUserId));
-
-		List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
-		for (Map.Entry<Integer, List<Practice4ExercisesSituationDto>> studentCourseEntry : studentCourseMap.entrySet()) {
-			StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation();
-			studentExtracurricularExercisesSituation.setStudentId(studentCourseEntry.getKey());
-			studentCourseEntry.getValue().sort(Comparator.comparing(Practice4ExercisesSituationDto::getCourseStartTime).reversed());
-			studentExtracurricularExercisesSituation.setTeacherId(studentCourseEntry.getValue().get(0).getActualTeacherId());
-			studentExtracurricularExercisesSituation.setExpectExercisesNum(1);
-			studentExtracurricularExercisesSituation.setWeekOfYear(nowDate.get(DateUtil.weekFields.weekOfYear()));
-			studentExtracurricularExercisesSituation.setMonday(DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"));
-			studentExtracurricularExercisesSituation.setSunday(DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"));
-			List<ExtracurricularExercisesReply> studentExercises = studentExercisesMap.get(studentCourseEntry.getKey());
-			if(CollectionUtils.isEmpty(studentExercises)){
-				studentExtracurricularExercisesSituation.setActualExercisesNum(0);
-				studentExtracurricularExercisesSituation.setExercisesReplyNum(0);
-				studentExtracurricularExercisesSituation.setExercisesMessageNum(0);
-				studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(0);
-				results.add(studentExtracurricularExercisesSituation);
-				continue;
-			}
-			studentExtracurricularExercisesSituation.setActualExercisesNum(1);
-			long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
-			studentExtracurricularExercisesSituation.setExercisesReplyNum(replyNum>0?1:0);
-			int exercisesMessageNum=0;
-			int exercisesMessageTimelyNum=0;
-			for (ExtracurricularExercisesReply studentExercise : studentExercises) {
-				if(!new Integer(1).equals(studentExercise.getStatus())){
-					continue;
-				}
-				if(!new Integer(1).equals(studentExercise.getIsReplied())){
-					continue;
-				}
-				exercisesMessageNum+=1;
-				if(new Integer(1).equals(studentExercise.getIsRepliedTimely())){
-					exercisesMessageTimelyNum+=1;
-				}
-			}
-			studentExtracurricularExercisesSituation.setExercisesMessageNum(exercisesMessageNum>0?1:0);
-			studentExtracurricularExercisesSituation.setExercisesMessageTimelyNum(exercisesMessageTimelyNum>0?1:0);
-			results.add(studentExtracurricularExercisesSituation);
-		}
-		studentExtracurricularExercisesSituationDao.deleteByMonday(monDayDate.toString(),null);
-		studentExtracurricularExercisesSituationDao.batchInsert(results);
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
 	public void exercisesSituationStatistics2(String monday) {
 		LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
 

+ 6 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -534,12 +534,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				&& musicGroupPaymentBaseCalender.getMusicRepair() == null){
 			throw new BizException("请选择一个缴费项目");
 		}
-		String musicGroupId = musicGroupPaymentBaseCalender.getMusicGroupId();
-
-		PaymentType paymentType = musicGroupPaymentBaseCalender.getPaymentType();
-
-		PayUserType payUserType = musicGroupPaymentBaseCalender.getPayUserType();
 
+		String musicGroupId = musicGroupPaymentBaseCalender.getMusicGroupId();
 		MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
 		if (musicGroup == null) {
 			throw new BizException("乐团查询失败,请检查参数");
@@ -574,7 +570,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		String batchNo = idGeneratorService.generatorId() + "";
 
 		BigDecimal originalMemberPaymentAmount = BigDecimal.ZERO;
-		if (payUserType == SCHOOL) {
+		if (musicGroupPaymentBaseCalender.getPayUserType() == SCHOOL) {
 			status = AUDITING;
 		} else {
 			status = memberCalenderService.checkComponentAmount(musicGroupPaymentBaseCalender);
@@ -652,9 +648,9 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 //		}
 
 		//缴费截止日期默认三天后
-		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
-			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
-		}
+//		if (musicGroupPaymentCalender.getDeadlinePaymentDate() == null && payUserType == PayUserType.STUDENT) {
+//			musicGroupPaymentCalender.setDeadlinePaymentDate(DateUtil.addDays(musicGroupPaymentCalender.getStartPaymentDate(), 3));
+//		}
 
 		if (musicGroupPaymentCalender.getStatus() != AUDITING) {
 			if (date.after(musicGroupPaymentCalender.getStartPaymentDate())) {
@@ -676,7 +672,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender,musicGroupPaymentCalender.getId());
 
 		// 如果是报名,需要修改乐团状态
-		if (paymentType == MUSIC_APPLY) {
+		if (musicGroupPaymentBaseCalender.getPaymentType() == MUSIC_APPLY) {
 			if (status != AUDITING) {
 				musicGroup.setStatus(MusicGroupStatusEnum.APPLY);
 				// 记录操作日志

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportServiceImpl.java

@@ -62,7 +62,7 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
             throw new BizException("请配置全职资源公摊金额");
         }
         BigDecimal fullJobFee = new BigDecimal(configValue);
-        List<OrganFullJobResourceNumDto> organFullJobResources = cooperationOrganDao.getOrganFullJobResourceNum();
+        List<OrganFullJobResourceNumDto> organFullJobResources = cooperationOrganDao.getOrganFullJobResourceNum(tenantId);
         for (OrganFullJobResourceNumDto organFullJobResource : organFullJobResources) {
             OperatingReport operatingReport = new OperatingReport();
             operatingReport.setOrganId(organFullJobResource.getOrganId());
@@ -78,7 +78,7 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
             organOperating.put(organ.getId(), operatingReport);
         }
         //1.3 合作单位的全职资源分摊费用
-        List<CooperationOrgan> allCooperationOrgan = cooperationOrganDao.getAllCooperationOrgan();
+        List<CooperationOrgan> allCooperationOrgan = cooperationOrganDao.getAllCooperationOrgan(tenantId);
         for (CooperationOrgan cooperationOrgan : allCooperationOrgan) {
             OperatingReport operatingReport = new OperatingReport();
             operatingReport.setOrganId(cooperationOrgan.getOrganId());

+ 3 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -23,6 +23,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -4613,8 +4614,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (StringUtils.isBlank(pushType)) {
             throw new BizException("请指定推送类型:JIGUANG、SMS、ALL");
         }
+        Integer tenantId = TenantContextHolder.getTenantId();
 
-        List<CourseScheduleEvaluate> reports = courseScheduleEvaluateDao.findExpiredDateBeforeReport(expiredDate);
+        List<CourseScheduleEvaluate> reports = courseScheduleEvaluateDao.findExpiredDateBeforeReport(expiredDate, tenantId);
 
         if (CollectionUtils.isEmpty(reports)) {
             return;

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeLessonApplyServiceImpl.java

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
 import com.ym.mec.biz.dal.dto.PracticeSumDto;
 import com.ym.mec.common.exception.BizException;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -13,6 +14,8 @@ import com.ym.mec.biz.dal.entity.PracticeLessonApply;
 import com.ym.mec.biz.service.PracticeLessonApplyService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
+
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
@@ -39,8 +42,8 @@ public class PracticeLessonApplyServiceImpl extends BaseServiceImpl<Integer, Pra
 
 	@Override
 	public Map<String, Object> practiceSum() {
-		Set<Integer> musicUserIds = scheduleStudentPaymentDao.queryMusicStudentPer();
-		Set<Integer> vipUserIds = scheduleStudentPaymentDao.queryVipStudentPer();
+		Set<Integer> musicUserIds = scheduleStudentPaymentDao.queryMusicStudentPer(TenantContextHolder.getTenantId());
+		Set<Integer> vipUserIds = scheduleStudentPaymentDao.queryVipStudentPer(TenantContextHolder.getTenantId());
 		musicUserIds.addAll(vipUserIds);
 		List<PracticeSumDto> practiceSumDtos = practiceLessonApplyDao.practiceSum(musicUserIds);
 		Integer totalNum = practiceLessonApplyDao.getTotalNum(musicUserIds);

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -261,7 +261,7 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 
     @Override
     public void initTeacherId() {
-        List<StudentTeacherCourseDto> allStudentCourseInfo = courseScheduleStudentPaymentDao.findAllStudentCourseInfo();
+        List<StudentTeacherCourseDto> allStudentCourseInfo = courseScheduleStudentPaymentDao.findAllStudentCourseInfo(TenantContextHolder.getTenantId());
         Map<Integer, List<StudentTeacherCourseDto>> studentCoursesMap = allStudentCourseInfo.stream().collect(Collectors.groupingBy(StudentTeacherCourseDto::getStudentId));
         List<Student> students = new ArrayList<>();
         for (Map.Entry<Integer, List<StudentTeacherCourseDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {

+ 4 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherCourseScheduleServiceImpl.java

@@ -6,6 +6,8 @@ import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.service.TeacherCourseScheduleService;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.tenant.TenantContextHolder;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -26,7 +28,7 @@ public class TeacherCourseScheduleServiceImpl implements TeacherCourseScheduleSe
 
     @Override
     public List<Date> findTeacherHaveClassesDates(Integer teacherId, Date month, String groupId, GroupType type) {
-        return courseScheduleDao.findHaveClassesDatesWithMonth(teacherId,month,groupId,type);
+        return courseScheduleDao.findHaveClassesDatesWithMonth(teacherId,month,groupId,type, TenantContextHolder.getTenantId());
     }
 
     @Override
@@ -35,7 +37,7 @@ public class TeacherCourseScheduleServiceImpl implements TeacherCourseScheduleSe
             throw new BizException("请指定课程");
         }
         CourseSchedule currentCourseSchedule = courseScheduleDao.get(courseScheduleId);
-        List<CourseScheduleDto> teacherCourseSchedulesWithDate = courseScheduleDao.findCourseSchedulesWithDate(null,null,currentCourseSchedule.getMusicGroupId(),currentCourseSchedule.getGroupType());
+        List<CourseScheduleDto> teacherCourseSchedulesWithDate = courseScheduleDao.findCourseSchedulesWithDate(null,null,currentCourseSchedule.getMusicGroupId(),currentCourseSchedule.getGroupType(),TenantContextHolder.getTenantId());
         List<CourseScheduleDto> notStartClasses=new ArrayList<>();
         List<CourseScheduleDto> overClasses=new ArrayList<>();
         CourseScheduleDto currentClasses=null;

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/ActivityApplyStudentTypeMapper.xml

@@ -11,6 +11,7 @@
 		<result column="new_student_" property="newStudent" />
 		<result column="member_flag_" property="memberFlag" />
 		<result column="activity_id_" property="activityId" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -20,13 +21,13 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="ActivityApplyStudentType">
-		SELECT * FROM activity_apply_student_type ORDER BY id_
+		SELECT * FROM activity_apply_student_type where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ActivityApplyStudentType" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO activity_apply_student_type (new_student_,member_flag_,activity_id_)
-		VALUES(#{newStudent},#{memberFlag},#{activityId})
+		INSERT INTO activity_apply_student_type (new_student_,member_flag_,activity_id_,tenant_id_)
+		VALUES(#{newStudent},#{memberFlag},#{activityId},#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -47,11 +48,11 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ActivityApplyStudentType" parameterType="map">
-		SELECT * FROM activity_apply_student_type ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM activity_apply_student_type where tenant_id_ = #{tenantId} ORDER BY id_ <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM activity_apply_student_type
+		SELECT COUNT(*) FROM activity_apply_student_type where tenant_id_ = #{tenantId}
 	</select>
 </mapper>

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/ActivityPlanMapper.xml

@@ -36,6 +36,7 @@
 		<result column="enable_" property="enable" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -45,7 +46,7 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="ActivityPlan">
-		SELECT * FROM activity_plan ORDER BY id_
+		SELECT * FROM activity_plan where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
@@ -54,12 +55,12 @@
 					   courses_end_time_,apply_to_student_type_,max_buy_num_,course_arranging_type_,
 					   course_type_,category_id_,single_course_time_,min_course_num_,max_course_num_,
 					   discount_,full_minus_course_times_,give_course_type_,give_category_id_,give_course_num_,
-					   member_rank_id_,member_time_,salary_settlement_json_,del_flag_,enable_,create_time_,update_time_)
+					   member_rank_id_,member_time_,salary_settlement_json_,del_flag_,enable_,create_time_,update_time_,tenant_id_)
 					   VALUES(#{organId},#{name},#{description},#{type},#{startTime},#{endTime},#{coursesStartTime},
 							  #{coursesEndTime},#{applyToStudentType},#{maxBuyNum},#{courseArrangingType},#{courseType},
 							  #{categoryId},#{singleCourseTime},#{minCourseNum},#{maxCourseNum},#{discount},
 							  #{fullMinusCourseTimes},#{giveCourseType},#{giveCategoryId},#{giveCourseNum},
-							  #{memberRankId},#{memberTime},#{salarySettlementJson},#{delFlag},#{enable},#{createTime},#{updateTime})
+							  #{memberRankId},#{memberTime},#{salarySettlementJson},#{delFlag},#{enable},#{createTime},#{updateTime},#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -152,7 +153,7 @@
 		<if test="type != null">
 		type_ = #{type},
 		</if>
-		</set> WHERE id_ = #{id}
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	
 	<!-- 根据主键删除一条记录 -->
@@ -162,11 +163,11 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ActivityPlan" parameterType="map">
-		SELECT * FROM activity_plan ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM activity_plan where tenant_id_ = #{tenantId} ORDER BY id_ <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM activity_plan
+		SELECT COUNT(*) FROM activity_plan where tenant_id_ = #{tenantId}
 	</select>
 </mapper>

+ 21 - 24
mec-biz/src/main/resources/config/mybatis/ActivityUserMapperAdjustLogMapper.xml

@@ -19,6 +19,7 @@
 		<result column="activity_user_mapper_id_" property="activityUserMapperId" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -28,21 +29,21 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="ActivityUserMapperAdjustLog">
-		SELECT * FROM activity_user_mapper_adjust_log ORDER BY id_
+		SELECT * FROM activity_user_mapper_adjust_log where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ActivityUserMapperAdjustLog" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO activity_user_mapper_adjust_log (operator_id_,operator_name_,activity_id_,
-		                                             course_num_,give_course_num_,memo_,user_id_,create_time_,update_time_,type_,activity_user_mapper_id_)
-		VALUES(#{operatorId},#{operatorName},#{activityId},#{courseNum},#{giveCourseNum},#{memo},#{userId},NOW(),NOW(),#{type},#{activityUserMapperId})
+		                                             course_num_,give_course_num_,memo_,user_id_,create_time_,update_time_,type_,activity_user_mapper_id_,tenant_id_)
+		VALUES(#{operatorId},#{operatorName},#{activityId},#{courseNum},#{giveCourseNum},#{memo},#{userId},NOW(),NOW(),#{type},#{activityUserMapperId},#{tenantId})
 	</insert>
 	<insert id="batchInsert">
 		INSERT INTO activity_user_mapper_adjust_log (operator_id_,operator_name_,activity_id_,course_num_,
-		                                             give_course_num_,memo_,user_id_,create_time_,update_time_,type_,activity_user_mapper_id_)
+		                                             give_course_num_,memo_,user_id_,create_time_,update_time_,type_,activity_user_mapper_id_,tenant_id_)
 		VALUES
 		<foreach collection="logs" separator="," item="bean">
-			(#{bean.operatorId},#{bean.operatorName},#{bean.activityId},#{bean.courseNum},#{bean.giveCourseNum},#{bean.memo},#{bean.userId},NOW(),NOW(),#{bean.type},#{bean.activityUserMapperId})
+			(#{bean.operatorId},#{bean.operatorName},#{bean.activityId},#{bean.courseNum},#{bean.giveCourseNum},#{bean.memo},#{bean.userId},NOW(),NOW(),#{bean.type},#{bean.activityUserMapperId},#{bean.tenantId})
 		</foreach>
 	</insert>
 
@@ -71,7 +72,7 @@
 		activity_id_ = #{activityId},
 		</if>
 		update_time_ = NOW()
-		</set> WHERE id_ = #{id}
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	
 	<!-- 根据主键删除一条记录 -->
@@ -81,29 +82,25 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ActivityUserMapperAdjustLog" parameterType="map">
-		SELECT * FROM activity_user_mapper_adjust_log
-		<where>
-			<if test="userId != null">
-				AND user_id_ = #{userId}
-			</if>
-			<if test="activityId != null">
-				AND activity_id_ = #{activityId}
-			</if>
-		</where>
+		SELECT * FROM activity_user_mapper_adjust_log where tenant_id_ = #{tenantId}
+		<if test="userId != null">
+			AND user_id_ = #{userId}
+		</if>
+		<if test="activityId != null">
+			AND activity_id_ = #{activityId}
+		</if>
 		ORDER BY id_ DESC
 		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM activity_user_mapper_adjust_log
-		<where>
-			<if test="userId != null">
-				AND user_id_ = #{userId}
-			</if>
-			<if test="activityId != null">
-				AND activity_id_ = #{activityId}
-			</if>
-		</where>
+		SELECT COUNT(*) FROM activity_user_mapper_adjust_log where tenant_id_ = #{tenantId}
+		<if test="userId != null">
+			AND user_id_ = #{userId}
+		</if>
+		<if test="activityId != null">
+			AND activity_id_ = #{activityId}
+		</if>
 	</select>
 </mapper>

+ 21 - 24
mec-biz/src/main/resources/config/mybatis/ActivityUserMapperMapper.xml

@@ -30,6 +30,7 @@
 		<result column="cut_memo_" property="cutMemo" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -39,7 +40,7 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="ActivityUserMapper">
-		SELECT * FROM activity_user_mapper ORDER BY id_
+		SELECT * FROM activity_user_mapper where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
@@ -47,23 +48,23 @@
 		INSERT INTO activity_user_mapper (activity_id_,user_id_,vip_flag_,give_vip_flag_,
 		                                  practice_flag_,give_practice_flag_,member_flag_,give_member_flag_,create_time_,update_time_,payment_order_id_,
 										  vip_group_id_,give_vip_group_id_,practice_group_id_,give_practice_group_id_,return_fee_,
-		                                  member_order_id_,give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_)
+		                                  member_order_id_,give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_,tenant_id_)
 		                                  VALUES(#{activityId},#{userId},#{vipFlag},#{giveVipFlag},#{practiceFlag},
 		                                         #{givePracticeFlag},#{memberFlag},#{giveMemberFlag},NOW(),NOW(),#{paymentOrderId},#{vipGroupId},
 		                                         #{giveVipGroupId},#{practiceGroupId},#{givePracticeGroupId},#{returnFee},
-		                                         #{memberOrderId},#{giveMemberOrderId},#{teacherId},#{actualPrice},#{addMemo},#{cutMemo})
+		                                         #{memberOrderId},#{giveMemberOrderId},#{teacherId},#{actualPrice},#{addMemo},#{cutMemo},#{tenantId})
 	</insert>
     <insert id="batchInsert">
 		INSERT INTO activity_user_mapper (activity_id_,user_id_,vip_flag_,give_vip_flag_,
 		practice_flag_,give_practice_flag_,member_flag_,give_member_flag_,create_time_,update_time_,payment_order_id_,
 		vip_group_id_,give_vip_group_id_,practice_group_id_,give_practice_group_id_,return_fee_,member_order_id_,
-		                                  give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_)
+		                                  give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_,tenant_id_)
 		VALUES
 		<foreach collection="activityUserMappers" item="item" separator=",">
 			(#{item.activityId},#{item.userId},#{item.vipFlag},#{item.giveVipFlag},#{item.practiceFlag},
 			#{item.givePracticeFlag},#{item.memberFlag},#{item.giveMemberFlag},NOW(),NOW(),#{item.paymentOrderId},#{item.vipGroupId},
 			#{item.giveVipGroupId},#{item.practiceGroupId},#{item.givePracticeGroupId},#{item.returnFee},
-			 #{item.memberOrderId},#{item.giveMemberOrderId},#{item.teacherId},#{item.actualPrice},#{item.addMemo},#{item.cutMemo})
+			 #{item.memberOrderId},#{item.giveMemberOrderId},#{item.teacherId},#{item.actualPrice},#{item.addMemo},#{item.cutMemo},#{item.tenantId})
 		</foreach>
 	</insert>
 
@@ -132,7 +133,7 @@
 				give_member_flag_ = #{giveMemberFlag},
 			</if>
 			update_time_ = NOW()
-		</set>WHERE id_ = #{id}
+		</set>WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	<update id="use">
 		UPDATE activity_user_mapper SET
@@ -165,30 +166,26 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="ActivityUserMapper" parameterType="map">
-		SELECT * FROM activity_user_mapper
-		<where>
-			<if test="userId != null">
-				AND user_id_ = #{userId}
-			</if>
-			<if test="activityId != null">
-				AND activity_id_ = #{activityId}
-			</if>
-		</where>
+		SELECT * FROM activity_user_mapper where tenant_id_ = #{tenantId}
+		<if test="userId != null">
+			AND user_id_ = #{userId}
+		</if>
+		<if test="activityId != null">
+			AND activity_id_ = #{activityId}
+		</if>
 		ORDER BY id_ DESC
 		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM activity_user_mapper
-		<where>
-			<if test="userId != null">
-				AND user_id_ = #{userId}
-			</if>
-			<if test="activityId != null">
-				AND activity_id_ = #{activityId}
-			</if>
-		</where>
+		SELECT COUNT(*) FROM activity_user_mapper where tenant_id_ = #{tenantId}
+		<if test="userId != null">
+			AND user_id_ = #{userId}
+		</if>
+		<if test="activityId != null">
+			AND activity_id_ = #{activityId}
+		</if>
 	</select>
     <select id="findByStudentIdList" resultMap="ActivityUserMapper">
 		SELECT * FROM activity_user_mapper

+ 7 - 5
mec-biz/src/main/resources/config/mybatis/ChargeTypeMapper.xml

@@ -14,6 +14,7 @@
         <result column="course_form_" property="courseForm"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
         <collection property="subjects" ofType="com.ym.mec.biz.dal.entity.Subject">
             <result property="id" column="subject_id_"/>
             <result property="name" column="subject_name_"/>
@@ -27,14 +28,14 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="ChargeType">
-		SELECT * FROM charge_type WHERE del_flag_ = 0 ORDER BY id_
+		SELECT * FROM charge_type WHERE del_flag_ = 0 and tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ChargeType" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-        INSERT INTO charge_type (id_,name_,description_,course_form_,create_time_,update_time_)
-        VALUES(#{id},#{name},#{description},#{courseForm},now(),now())
+        INSERT INTO charge_type (id_,name_,description_,course_form_,create_time_,update_time_,tenant_id_)
+        VALUES(#{id},#{name},#{description},#{courseForm},now(),now(),#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -57,7 +58,7 @@
                 name_ = #{name},
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 根据主键删除一条记录 -->
@@ -71,12 +72,13 @@
         FROM (SELECT * FROM charge_type WHERE del_flag_ = 0 <include refid="global.limit"/>) ct
         LEFT JOIN charge_type_subject_mapper ctsm ON ct.id_ = ctsm.charge_type_id_
         LEFT JOIN `subject` s ON ctsm.subject_id_ = s.id_
+        where tenant_id_ = #{tenantId}
         ORDER BY ct.update_time_
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM charge_type WHERE del_flag_ = 0
+		SELECT COUNT(*) FROM charge_type WHERE del_flag_ = 0 and tenant_id_ = #{tenantId}
 	</select>
     <select id="queryNameByIds" resultType="java.util.Map" parameterType="list">
         SELECT id_ `key`,name_ `value` FROM charge_type WHERE FIND_IN_SET(id_,#{chargeTypeIds})

+ 7 - 5
mec-biz/src/main/resources/config/mybatis/ChargeTypeOrganizationFeeMapper.xml

@@ -12,6 +12,7 @@
 		<result column="course_fee_" property="courseFee" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -21,7 +22,7 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="chargeTypeOrganizationFee">
-		SELECT * FROM charge_type_organization_fee
+		SELECT * FROM charge_type_organization_fee where tenant_id_ = #{tenantId}
 		ORDER BY id_
 	</select>
 
@@ -29,8 +30,8 @@
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ChargeTypeOrganizationFee"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO charge_type_organization_fee
-		(id_,charge_type_id_,organ_id_,course_fee_,create_time_,update_time_)
-		VALUES(#{id},#{chargeTypeId},#{organId},#{courseFee},NOW(),NOW())
+		(id_,charge_type_id_,organ_id_,course_fee_,create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{chargeTypeId},#{organId},#{courseFee},NOW(),NOW(),#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -50,7 +51,7 @@
 				update_time_ = #{updateTime},
 			</if>
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -64,13 +65,14 @@
 		FROM charge_type_organization_fee ctof
 		LEFT JOIN organization o ON o.id_ = ctof.organ_id_
 		LEFT JOIN charge_type ct ON ctof.charge_type_id_ = ct.id_
+		where tenant_id_ = #{tenantId}
 		ORDER BY ctof.create_time_ DESC
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM charge_type_organization_fee
+		SELECT COUNT(*) FROM charge_type_organization_fee where tenant_id_ = #{tenantId}
 	</select>
 
     <select id="findByOrganId" resultMap="chargeTypeOrganizationFee">

+ 10 - 13
mec-biz/src/main/resources/config/mybatis/ChargeTypeSubjectMapperMapper.xml

@@ -17,6 +17,7 @@
         <result column="deposit_fee_" property="depositFee"/>
         <result column="fee_" property="fee"/>
         <result column="goods_discount_rate_" property="goodsDiscountRate"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -29,7 +30,7 @@
     <!-- 全查询 -->
     <select id="findAll" resultMap="ChargeTypeSubjectMapper">
         SELECT *
-        FROM charge_type_subject_mapper
+        FROM charge_type_subject_mapper where tenant_id_ = #{tenantId}
         ORDER BY id_
     </select>
 
@@ -37,20 +38,20 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ChargeTypeSubjectMapper" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
         INSERT INTO charge_type_subject_mapper (charge_type_id_, subject_id_, kit_group_purchase_type_, deposit_fee_,
-                                                fee_, goods_discount_rate_, create_time_, update_time_)
+                                                fee_, goods_discount_rate_, create_time_, update_time_,tenant_id_)
         VALUES (#{chargeTypeId}, #{subjectId},
                 #{kitGroupPurchaseTypeEnum,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{depositFee},
-                #{fee}, #{goodsDiscountRate}, now(), now())
+                #{fee}, #{goodsDiscountRate}, now(), now(),#{tenantId})
     </insert>
 
     <!-- 向数据库增加一条记录 -->
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO charge_type_subject_mapper
-        (charge_type_id_,subject_id_,kit_group_purchase_type_,deposit_fee_,fee_,goods_discount_rate_,create_time_,update_time_)
+        (charge_type_id_,subject_id_,kit_group_purchase_type_,deposit_fee_,fee_,goods_discount_rate_,create_time_,update_time_,tenant_id_)
         VALUES
         <foreach collection="list" item="item" separator=",">
-            (#{item.chargeTypeId},#{item.subjectId},#{item.kitGroupPurchaseTypeEnum,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.depositFee},#{item.fee},#{item.goodsDiscountRate},now(),now())
+            (#{item.chargeTypeId},#{item.subjectId},#{item.kitGroupPurchaseTypeEnum,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.depositFee},#{item.fee},#{item.goodsDiscountRate},now(),now(),#{item.tenantId})
         </foreach>
     </insert>
 
@@ -81,7 +82,7 @@
                 update_time_ = NOW(),
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <update id="batchUpdate" parameterType="java.util.List">
@@ -111,7 +112,7 @@
                     update_time_ = NOW(),
                 </if>
             </set>
-            WHERE id_ = #{item.id}
+            WHERE id_ = #{item.id} tenant_id_ = #{item.tenantId}
         </foreach>
     </update>
 
@@ -130,30 +131,26 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ChargeTypeSubjectMapper" parameterType="map">
-        SELECT * FROM charge_type_subject_mapper 
-        <where>
+        SELECT * FROM charge_type_subject_mapper where  tenant_id_ = #{tenantId}
         	<if test="chargeTypeId != null">
         		and charge_type_id_ = #{chargeTypeId}
         	</if>
         	<if test="subjectId != null">
         		and subject_id_ = #{subjectId}
         	</if>
-        </where>
         ORDER BY id_ desc
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-        SELECT COUNT(*) FROM charge_type_subject_mapper
-        <where>
+        SELECT COUNT(*) FROM charge_type_subject_mapper where tenant_id_ = #{tenantId}
         	<if test="chargeTypeId != null">
         		and charge_type_id_ = #{chargeTypeId}
         	</if>
         	<if test="subjectId != null">
         		and subject_id_ = #{subjectId}
         	</if>
-        </where>
     </select>
 
     <!-- 根据收费类型获取乐团乐器折扣 -->

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/ChildrenDayDegreeDetailDao.xml

@@ -14,6 +14,7 @@
         <result column="order_id_" property="orderId"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <select id="get" parameterType="java.lang.Integer" resultMap="ChildrenDayDegreeDetail">
@@ -31,9 +32,9 @@
         <!--@mbg.generated-->
         insert into children_day_degree_detail (reserve_id_, user_id_, type_, subject_id_, level_, price_,
         status_,order_id_,
-        create_time_, update_time)
+        create_time_, update_time,tenant_id_)
         values (#{reserveId}, #{userId}, #{type}, #{subjectId}, #{level}, #{price}, #{status},#{orderId},
-        #{createTime}, #{updateTime})
+        #{createTime}, #{updateTime},#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.ChildrenDayDegreeDetail">
         <!--@mbg.generated-->
@@ -70,7 +71,7 @@
                 update_time = #{updateTime},
             </if>
         </set>
-        where id_ = #{id}
+        where id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <select id="getByUserIdAndStatus" resultMap="ChildrenDayDegreeDetail">
@@ -82,12 +83,12 @@
 
     <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
         INSERT INTO children_day_degree_detail
-        (reserve_id_, user_id_, type_, subject_id_, level_, price_,status_,order_id_,create_time_,update_time)
+        (reserve_id_, user_id_, type_, subject_id_, level_, price_,status_,order_id_,create_time_,update_time,tenant_id_)
         VALUE
         <foreach collection="details" item="detail" separator=",">
             (#{detail.reserveId}, #{detail.userId}, #{detail.type}, #{detail.subjectId}, #{detail.level},
             #{detail.price}, #{detail.status},#{detail.orderId},
-            now(),now())
+            now(),now(),#{detail.tenantId})
         </foreach>
     </insert>
 

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/ChildrenDayDegreeInfoDao.xml

@@ -19,6 +19,7 @@
         <result column="order_id_" property="orderId"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <select id="get" parameterType="java.lang.Integer" resultMap="ChildrenDayDegreeInfo">
@@ -39,10 +40,10 @@
         <!--@mbg.generated-->
         insert into children_day_degree_info (reserve_id_, user_id_, subject_id_, grade_level_, grade_price_,
         theory_level_,theory_price_, vip_1v1_price_, vip_1v2_price_, theory_course_price_, total_amount_,order_id_,
-        create_time_, update_time_)
+        create_time_, update_time_,tenant_id_)
         values (#{reserveId}, #{userId}, #{subjectId}, #{gradeLevel}, #{gradePrice}, #{theoryLevel},
         #{theoryPrice}, #{vip1v1Price}, #{vip1v2Price}, #{theoryCoursePrice}, #{totalAmount},#{orderId},
-        NOW(), NOW())
+        NOW(), NOW(),#{tenantId})
     </insert>
 
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.ChildrenDayDegreeInfo">
@@ -92,19 +93,19 @@
                 update_time_ = NOW(),
             </if>
         </set>
-        where id_ = #{id}
+        where id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ChildrenDayDegreeInfo" parameterType="map">
-        SELECT * FROM children_day_degree_info
+        SELECT * FROM children_day_degree_info where tenant_id_ = #{tenantId}
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*)
-        FROM children_day_degree_info
+        FROM children_day_degree_info where tenant_id_ = #{tenantId}
     </select>
 
     <select id="getPayedUser" resultType="java.lang.Integer">

+ 9 - 5
mec-biz/src/main/resources/config/mybatis/ChildrenDayReserveMapper.xml

@@ -12,6 +12,7 @@
         <result column="is_send_msg_" property="isSendMsg" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <select id="get" parameterType="java.lang.Integer" resultMap="ChildrenDayReserve">
@@ -29,9 +30,9 @@
             useGeneratedKeys="true">
         <!--@mbg.generated-->
         insert into children_day_reserve (user_id_, organ_id_, cooperation_organ_id_, music_group_id_, is_reserve_,
-        create_time_, update_time_)
+        create_time_, update_time_,tenant_id_)
         values (#{userId}, #{organId}, #{cooperationOrganId}, #{musicGroupId},
-        #{isReserve,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(), NOW())
+        #{isReserve,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},NOW(), NOW(),#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.ChildrenDayReserve">
         <!--@mbg.generated-->
@@ -62,19 +63,19 @@
                 update_time_ = #{updateTime},
             </if>
         </set>
-        where id_ = #{id}
+        where id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ChildrenDayReserve" parameterType="map">
-        SELECT * FROM children_day_reserve
+        SELECT * FROM children_day_reserve where tenant_id_ = #{tenantId}
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*)
-        FROM children_day_reserve
+        FROM children_day_reserve where tenant_id_ = #{tenantId}
     </select>
     <resultMap id="ChildrenStatisticsDtoMap" type="com.ym.mec.biz.dal.dto.ChildrenStatisticsDto">
         <result property="buyMusicTheoryAmount" column="buy_music_theory_amount_"/>
@@ -255,6 +256,9 @@
                 AND (cdr.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE
                 CONCAT('%',#{search},'%'))
             </if>
+            <if test="tenantId != null">
+                AND cdr.tenant_id_ = #{tenantId}
+            </if>
             <if test="isReserve != null">
                 AND cdr.is_reserve_ = #{isReserve}
             </if>

+ 47 - 11
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -24,6 +24,7 @@
         <result column="img_" property="img"/>
         <result column="memo_" property="memo"/>
         <result column="current_class_times_" property="currentClassTimes"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.entity.ClassGroup4Teacher" id="ClassGroup4Teacher">
@@ -66,6 +67,7 @@
             <if test="img!=null">img_,</if>
             <if test="memo!=null">memo_,</if>
             <if test="delFlag!=null">del_flag_,</if>
+            <if test="tenantId!=null">tenant_id_,</if>
         </trim>
         VALUES
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -84,6 +86,7 @@
             <if test="img!=null">#{img},</if>
             <if test="memo!=null">#{memo},</if>
             <if test="delFlag!=null">#{delFlag},</if>
+            <if test="tenantId!=null">#{tenantId},</if>
         </trim>
     </insert>
 
@@ -103,7 +106,7 @@
     <!-- 全查询 -->
     <select id="findAll" resultMap="ClassGroup">
         SELECT *
-        FROM class_group
+        FROM class_group where tenant_id_ = #{tenantId}
         ORDER BY id_
     </select>
 
@@ -151,7 +154,7 @@
                 del_flag_ = #{delFlag},
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 根据主键删除一条记录 -->
@@ -169,6 +172,9 @@
         	<if test="id != null">
 				and id_ = #{id}
 			</if>
+        	<if test="tenantId != null">
+				and tenant_id_ = #{tenantId}
+			</if>
         	<if test="type != null">
 				and type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
@@ -196,6 +202,9 @@
         	<if test="id != null">
 				and id_ = #{id}
 			</if>
+        	<if test="tenantId != null">
+				and tenant_id_ = #{tenantId}
+			</if>
         	<if test="type != null">
 				and type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
@@ -339,6 +348,9 @@
             <if test="userId != null">
                 AND cgsm.user_id_ = #{userId}
             </if>
+            <if test="tenantId != null">
+                AND cgsm.tenant_id_ = #{tenantId}
+            </if>
             <if test="search != null and search != ''">
                 AND (cg.name_ LIKE CONCAT('%',#{search},'%') OR cg.group_name_ LIKE CONCAT('%',#{search},'%') OR mg.name_ LIKE CONCAT('%',#{search},'%'))
             </if>
@@ -357,6 +369,9 @@
             <if test="userId != null">
                 AND cgsm.user_id_ = #{userId}
             </if>
+            <if test="tenantId != null">
+                AND cgsm.tenant_id_ = #{tenantId}
+            </if>
             <if test="search != null and search != ''">
                 AND cg.name_ LIKE CONCAT('%',#{search},'%')
             </if>
@@ -374,6 +389,9 @@
             <if test="userId != null">
                 AND cgsm.user_id_ = #{userId}
             </if>
+            <if test="tenantId != null">
+                AND cgsm.tenant_id_ = #{tenantId}
+            </if>
             <if test="search != null and search != ''">
                 AND cg.name_ LIKE CONCAT('%',#{search},'%')
             </if>
@@ -391,6 +409,9 @@
             <if test="userId != null">
                 AND cgsm.user_id_ = #{userId}
             </if>
+            <if test="tenantId != null">
+                AND cgsm.tenant_id_ = #{tenantId}
+            </if>
             <if test="search != null and search != ''">
                 AND cg.name_ LIKE CONCAT('%',#{search},'%')
             </if>
@@ -431,6 +452,9 @@
             <if test="userId != null">
                 AND spo.user_id_ = #{userId}
             </if>
+            <if test="tenantId != null">
+                AND spo.tenant_id_ = #{tenantId}
+            </if>
             <if test="type != null">
                 AND spo.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
@@ -455,6 +479,9 @@
             <if test="userId != null">
                 AND spo.user_id_ = #{userId}
             </if>
+            <if test="tenantId != null">
+                AND spo.tenant_id_ = #{tenantId}
+            </if>
             <if test="type != null">
                 AND spo.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
@@ -834,6 +861,9 @@
             <if test="musicGroupId != null">
                 AND cg.music_group_id_ = #{musicGroupId}
             </if>
+            <if test="tenantId != null">
+                AND cg.tenant_id_ = #{tenantId}
+            </if>
         </where>
     </sql>
 
@@ -864,6 +894,9 @@
             <if test="isSettlement == 1">
                 AND csts.settlement_time_ IS NOT NULL
             </if>
+            <if test="tenantId != null">
+                AND cg.tenant_id_ = #{tenantId}
+            </if>
         </where>
     </sql>
     <resultMap id="MusicGroupCourseScheduleDto" type="com.ym.mec.biz.dal.dto.MusicGroupCourseScheduleDto">
@@ -1227,7 +1260,7 @@
         FROM class_group cg
         LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
         LEFT JOIN sys_user su ON su.id_ = cgsm.user_id_
-        WHERE su.id_ IS NOT NULL
+        WHERE su.id_ IS NOT NULL and cg.tenant_id_ = #{tenantId}
     </select>
 
     <select id="queryTeacherGroup" resultMap="ImGroupModelMap">
@@ -1235,7 +1268,7 @@
         FROM class_group cg
         LEFT JOIN class_group_teacher_mapper cgtm ON cg.id_ = cgtm.class_group_id_
         LEFT JOIN sys_user su ON su.id_ = cgtm.user_id_
-        WHERE su.id_ IS NOT NULL
+        WHERE su.id_ IS NOT NULL and cg.tenant_id_ = #{tenantId}
     </select>
     <resultMap id="ImUserModelMap" type="com.ym.mec.common.entity.ImUserModel">
         <result property="name" column="real_name_"/>
@@ -1245,7 +1278,7 @@
     <select id="queryImUser" resultMap="ImUserModelMap">
         SELECT su.id_,su.real_name_,su.avatar_ head_url_
         FROM sys_user su
-        WHERE su.id_ IS NOT NULL
+        WHERE su.id_ IS NOT NULL and su.tenant_id_ = #{tenantId}
     </select>
     <select id="findByGroupAndType" resultMap="ClassGroup">
         SELECT * FROM class_group WHERE music_group_id_=#{groupId} AND group_type_=#{groupType} LIMIT 1
@@ -1305,7 +1338,7 @@
                     del_flag_ = #{classGroup.delFlag},
                 </if>
             </set>
-            WHERE id_ = #{classGroup.id}
+            WHERE id_ = #{classGroup.id} and tenant_id_ = #{classGroup.tenantId}
         </foreach>
     </update>
     <update id="updateGroupName">
@@ -1366,6 +1399,9 @@
             <if test="classGroupType!=null">
                 AND cg.type_=#{classGroupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
+            <if test="tenantId != null">
+                AND cg.tenant_id_=#{tenantId}
+            </if>
         </where>
     </sql>
     <select id="superFindClassGroups" resultMap="SuperClassGroupInfo">
@@ -1390,7 +1426,7 @@
         FROM
             class_group_student_mapper cgsm
             LEFT JOIN sys_user su ON cgsm.user_id_ = su.id_
-        WHERE su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}
+        WHERE (su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}) and cgsm.tenant_id_ = #{tenantId}
     </select>
     <select id="findClassGroupIdsByTeacher" resultType="int">
         SELECT
@@ -1398,10 +1434,7 @@
         FROM
             class_group_teacher_mapper cgtm
             LEFT JOIN sys_user su ON cgtm.user_id_ = su.id_
-        WHERE su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}
-    </select>
-    <select id="countClassNumByType" resultType="java.lang.Integer">
-        SELECT COUNT(id_) FROM class_group WHERE type_ IN ('HIGH','HIGH_ONLINE') AND del_flag_ = '0'
+        WHERE (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}) and cgtm.tenant_id_ = #{tenantId}
     </select>
 
     <select id="findClassGroupSubjectNameMaps" resultType="java.util.Map">
@@ -1478,6 +1511,9 @@
             <if test="educationUserId != null">
                 AND mg.educational_teacher_id_ = #{educationUserId}
             </if>
+            <if test="tenant_id_  != null">
+                AND cg.tenant_id_ = #{tenantId}
+            </if>
             <if test="search != null and search != ''">
                 AND (cg.id_ LIKE CONCAT('%',#{search},'%') OR cg.name_ LIKE CONCAT('%',#{search},'%') OR mg.name_ LIKE CONCAT('%',#{search},'%') OR cg.music_group_id_ LIKE CONCAT('%',#{search},'%'))
             </if>

+ 8 - 7
mec-biz/src/main/resources/config/mybatis/ClassGroupRelationMapper.xml

@@ -11,6 +11,7 @@
         <result column="class_group_id_" property="classGroupId"/>
         <result column="sub_class_group_id_" property="subClassGroupId"/>
         <result column="create_time_" property="createTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -21,7 +22,7 @@
     <!-- 全查询 -->
     <select id="findAll" resultMap="ClassGroupRelation">
         SELECT *
-        FROM class_group_relation
+        FROM class_group_relation where tenant_id_ = #{tenantId}
         ORDER BY id_
     </select>
 
@@ -33,8 +34,8 @@
         SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
         </selectKey>
         -->
-        INSERT INTO class_group_relation (id_,class_group_id_,sub_class_group_id_,create_time_)
-        VALUES(#{id},#{classGroupId},#{subClassGroupId},now())
+        INSERT INTO class_group_relation (id_,class_group_id_,sub_class_group_id_,create_time_,tenant_id_)
+        VALUES(#{id},#{classGroupId},#{subClassGroupId},now(),#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -61,21 +62,21 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ClassGroupRelation" parameterType="map">
-        SELECT * FROM class_group_relation ORDER BY id_
+        SELECT * FROM class_group_relation where tenant_id_ = #{tenantId} ORDER BY id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*)
-        FROM class_group_relation
+        FROM class_group_relation where tenant_id_ = #{tenantId}
     </select>
 
     <!-- 班级关系批量插入 -->
     <insert id="classGroupRelationsInsert" parameterType="java.util.List">
-        INSERT INTO class_group_relation (class_group_id_,sub_class_group_id_,create_time_) VALUES
+        INSERT INTO class_group_relation (class_group_id_,sub_class_group_id_,create_time_,tenant_id_) VALUES
         <foreach collection="classGroupRelationList" item="item" index="index" separator=",">
-            (#{item.classGroupId},#{item.subClassGroupId},now())
+            (#{item.classGroupId},#{item.subClassGroupId},now(),#{item.tenantId})
         </foreach>
     </insert>
 

+ 20 - 7
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -16,6 +16,7 @@
         <result column="update_time_" property="updateTime"/>
         <result column="username_" property="userName"/>
         <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <resultMap id="ClassGroupStudentInfoDto" type="com.ym.mec.biz.dal.dto.ClassGroupStudentInfoDto" extends="ClassGroupStudentMapper">
@@ -30,14 +31,14 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="ClassGroupStudentMapper">
-		SELECT * FROM class_group_student_mapper ORDER BY id_
+		SELECT * FROM class_group_student_mapper where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ClassGroupStudentMapper" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
-        INSERT INTO class_group_student_mapper (id_,group_type_,music_group_id_,class_group_id_,user_id_,status_,create_time_,update_time_)
-        VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{classGroupId},#{userId},#{status},now(),now())
+        INSERT INTO class_group_student_mapper (id_,group_type_,music_group_id_,class_group_id_,user_id_,status_,create_time_,update_time_,tenant_id_)
+        VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{classGroupId},#{userId},#{status},now(),now(),#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -97,21 +98,21 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ClassGroupStudentMapper" parameterType="map">
-        SELECT * FROM class_group_student_mapper ORDER BY id_
+        SELECT * FROM class_group_student_mapper where tenant_id_ = #{tenantId} ORDER BY id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM class_group_student_mapper
+		SELECT COUNT(*) FROM class_group_student_mapper where tenant_id_ = #{tenantId}
 	</select>
 
     <!-- 班级学生批量插入 -->
     <insert id="classGroupStudentsInsert" parameterType="java.util.List">
-        INSERT INTO class_group_student_mapper (group_type_,music_group_id_,class_group_id_,user_id_,status_,create_time_)
+        INSERT INTO class_group_student_mapper (group_type_,music_group_id_,class_group_id_,user_id_,status_,create_time_,tenant_id_)
         VALUE
         <foreach collection="classGroupStudentMapperList" item="item" index="index" separator=",">
-            (#{item.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.musicGroupId},#{item.classGroupId},#{item.userId},#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now())
+            (#{item.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.musicGroupId},#{item.classGroupId},#{item.userId},#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),#{item.tenantId})
         </foreach>
     </insert>
     
@@ -492,6 +493,9 @@
             <if test="classGroupId!=null">
                 AND cgsm.class_group_id_=#{classGroupId}
             </if>
+            <if test="tenantId!=null">
+                AND cgsm.tenant_id_=#{tenantId}
+            </if>
         </where>
     </select>
     <select id="findGroupStudents" resultMap="ClassGroupStudentMapper">
@@ -509,6 +513,9 @@
             <if test="status!=null">
                 AND status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>
+            <if test="tenantId!=null">
+                AND cgsm.tenant_id_=#{tenantId}
+            </if>
         </where>
     </select>
     <select id="getStudentEducationalTeachers" resultType="com.ym.mec.biz.dal.dto.StudentEduTeacherDto">
@@ -611,6 +618,9 @@
             <if test="musicGroupId != null">
                 AND music_group_id_ = #{musicGroupId}
             </if>
+            <if test="tenantId!=null">
+                AND tenant_id_=#{tenantId}
+            </if>
         </where>
     </sql>
     <select id="getStudentClassGroupBishopTeacherMap" resultType="com.ym.mec.biz.dal.dto.BaseMapDto">
@@ -635,6 +645,9 @@
                 #{studentId}
             </foreach>
         </if>
+        <if test="tenantId!=null">
+            AND cgsm.tenant_id_=#{tenantId}
+        </if>
     </select>
 
     <select id="getLessThenThreeClassGroupIds" resultType="java.lang.Long">

+ 15 - 8
mec-biz/src/main/resources/config/mybatis/ClassGroupTeacherMapperMapper.xml

@@ -15,6 +15,7 @@
         <result column="salary_" property="salary"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <resultMap id="ClassGroupTeacherMapDto" type="com.ym.mec.biz.dal.dto.ClassGroupTeacherMapDto" extends="ClassGroupTeacherMapper">
@@ -30,7 +31,7 @@
     <!-- 全查询 -->
     <select id="findAll" resultMap="ClassGroupTeacherMapper">
         SELECT *
-        FROM class_group_teacher_mapper
+        FROM class_group_teacher_mapper where tenant_id_ = #{tenantId}
         ORDER BY id_
     </select>
 
@@ -38,9 +39,9 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper"
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO class_group_teacher_mapper
-        (group_type_,music_group_id_,class_group_id_,teacher_role_,user_id_,salary_,create_time_,update_time_)
+        (group_type_,music_group_id_,class_group_id_,teacher_role_,user_id_,salary_,create_time_,update_time_,tenant_id_)
         VALUES(#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},
-               #{classGroupId},#{teacherRole},#{userId},#{salary},NOW(),NOW())
+               #{classGroupId},#{teacherRole},#{userId},#{salary},NOW(),NOW(),#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -69,7 +70,7 @@
                 music_group_id_ = #{musicGroupId},
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <update id="updateTeacher">
@@ -92,23 +93,23 @@
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ClassGroupTeacherMapper"
             parameterType="map">
-        SELECT * FROM class_group_teacher_mapper ORDER BY id_
+        SELECT * FROM class_group_teacher_mapper where tenant_id_ = #{tenantId} ORDER BY id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*)
-        FROM class_group_teacher_mapper
+        FROM class_group_teacher_mapper where tenant_id_ = #{tenantId}
     </select>
 
     <!-- 批量插入班级老师 -->
     <insert id="classGroupTeachersInsert" parameterType="java.util.List">
         INSERT INTO class_group_teacher_mapper
-        (id_,group_type_,music_group_id_,class_group_id_,teacher_role_,user_id_,salary_,create_time_,update_time_)
+        (id_,group_type_,music_group_id_,class_group_id_,teacher_role_,user_id_,salary_,create_time_,update_time_,tenant_id_)
         VALUE
         <foreach collection="classGroupTeacherMapperList" item="item" index="index" separator=",">
-            (#{item.id},#{item.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.musicGroupId},#{item.classGroupId},#{item.teacherRole},#{item.userId},#{item.salary},NOW(),NOW())
+            (#{item.id},#{item.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.musicGroupId},#{item.classGroupId},#{item.teacherRole},#{item.userId},#{item.salary},NOW(),NOW(),#{item.tenantId})
         </foreach>
     </insert>
 
@@ -151,6 +152,9 @@
             <if test="musicGroupId != null">
                 AND ct.music_group_id_=#{musicGroupId}
             </if>
+            <if test="tenantId != null">
+                AND ct.tenant_id_=#{tenantId}
+            </if>
         </where>
     </select>
 
@@ -239,6 +243,9 @@
             <if test="musicGroupId != null">
                 AND music_group_id_ = #{musicGroupId}
             </if>
+            <if test="tenantId != null">
+                AND tenant_id_ = #{tenantId}
+            </if>
         </where>
     </sql>
 </mapper>

+ 10 - 3
mec-biz/src/main/resources/config/mybatis/ClassGroupTeacherSalaryMapper.xml

@@ -12,6 +12,7 @@
     <result column="online_classes_salary_" jdbcType="DECIMAL" property="onlineClassesSalary" />
     <result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
     <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime" />
+	<result column="tenant_id_" property="tenantId" />
   </resultMap>
   <select id="get" parameterType="java.lang.Long" resultMap="ClassGroupTeacherSalary">
      select * from class_group_teacher_salary where id_ = #{id}
@@ -53,6 +54,9 @@
       <if test="updateTime != null">
         update_time_,
       </if>
+      <if test="tenantId != null">
+        tenant_id_,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="groupType != null">
@@ -82,6 +86,9 @@
       <if test="updateTime != null">
         NOW(),
       </if>
+      <if test="tenantId != null">
+        #{tenantId},
+      </if>
     </trim>
   </insert>
   <update id="update" parameterType="com.ym.mec.biz.dal.entity.ClassGroupTeacherSalary">
@@ -111,7 +118,7 @@
       </if>
       update_time_ = NOW()
     </set>
-    where id_ = #{id,jdbcType=BIGINT}
+    where id_ = #{id,jdbcType=BIGINT} and tenant_id_ = #{tenantId}
   </update>
     <update id="updateTeacher">
       UPDATE class_group_teacher_salary SET user_id_ = #{teacherId},update_time_ = NOW()
@@ -119,13 +126,13 @@
     </update>
     <!-- 分页查询 -->
   <select id="queryPage" resultMap="ClassGroupTeacherSalary" parameterType="map">
-    SELECT * FROM class_group_teacher_salary ORDER BY id_
+    SELECT * FROM class_group_teacher_salary where tenant_id_ = #{tenantId} ORDER BY id_
     <include refid="global.limit"/>
   </select>
 
   <!-- 查询当前表的总记录数 -->
   <select id="queryCount" resultType="int">
-    SELECT COUNT(*) FROM class_group_teacher_salary
+    SELECT COUNT(*) FROM class_group_teacher_salary where tenant_id_ = #{tenant_id_}
   </select>
 
   <!-- 获取乐团老师课酬配置表 -->

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/CloudTeacherMapper.xml

@@ -12,6 +12,7 @@
         <result column="version_" property="version"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <select id="get" parameterType="java.lang.Integer" resultMap="CloudTeacher">
@@ -28,8 +29,8 @@
             useGeneratedKeys="true">
         <!--@mbg.generated-->
         insert into cloud_teacher (student_id_, level_, start_time_, end_time_, version_, create_time_,
-        update_time_)
-        values (#{studentId}, #{level}, #{startTime}, #{endTime}, #{version}, NOW(),NOW())
+        update_time_,tenant_id_)
+        values (#{studentId}, #{level}, #{startTime}, #{endTime}, #{version}, NOW(),NOW(),#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudTeacher">
         <!--@mbg.generated-->
@@ -53,25 +54,25 @@
             update_time_ = NOW(),
             version_ = version_+1
         </set>
-        where id_ = #{id} AND version_ = #{version}
+        where id_ = #{id} AND version_ = #{version} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="CloudTeacher">
         SELECT *
-        FROM cloud_teacher
+        FROM cloud_teacher where tenant_id_ = #{tenantId}
     </select>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="CloudTeacher" parameterType="map">
-        SELECT * FROM cloud_teacher
+        SELECT * FROM cloud_teacher where tenant_id_ = #{tenantId}
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*)
-        FROM cloud_teacher
+        FROM cloud_teacher where tenant_id_ = #{tenantId}
     </select>
 
     <select id="getByStudentId" resultMap="CloudTeacher">

+ 16 - 6
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -22,6 +22,7 @@
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="music_group_id_" property="musicGroupId"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
     
     <resultMap type="com.ym.mec.biz.dal.dto.CloudTeacherOrderDto" id="CloudTeacherOrderDto">
@@ -59,9 +60,9 @@
             useGeneratedKeys="true">
         <!--@mbg.generated-->
         insert into cloud_teacher_order (organ_id_,student_id_, type_, level_, time_, amount_, refund_amount_, status_,
-        order_id_,start_time_,end_time_,remark_, create_time_, update_time_,music_group_id_,active_remark_)
+        order_id_,start_time_,end_time_,remark_, create_time_, update_time_,music_group_id_,active_remark_,tenant_id_)
         values (#{organId},#{studentId}, #{type},#{level}, #{time}, #{amount}, #{refundAmount},
-        #{status},#{orderId},#{startTime},#{endTime}, #{remark}, NOW(), NOW(),#{musicGroupId},#{activeRemark})
+        #{status},#{orderId},#{startTime},#{endTime}, #{remark}, NOW(), NOW(),#{musicGroupId},#{activeRemark},#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherOrder">
         <!--@mbg.generated-->
@@ -112,7 +113,7 @@
             version_ = version_+1,
             update_time_ = NOW(),
         </set>
-        where id_ = #{id} AND version_ = #{version}
+        where id_ = #{id} AND version_ = #{version} and tenant_id_ = #{tenantId}
     </update>
 
     <update id="updateOrderStatusOK">
@@ -127,7 +128,7 @@
     <!-- 全查询 -->
     <select id="findAll" resultMap="CloudTeacherOrder">
         SELECT *
-        FROM cloud_teacher_order
+        FROM cloud_teacher_order where tenant_id_ = #{tenantId}
     </select>
 
     <!-- 分页查询 -->
@@ -142,6 +143,9 @@
         <if test="studentId != null">
         	and cto.student_id_ = #{studentId}
         </if>
+        <if test="tenantId != null">
+        	and cto.tenant_id_ = #{tenantId}
+        </if>
         order by spo.pay_time_ desc,spo.id_ desc
         <include refid="global.limit"/>
     </select>
@@ -157,13 +161,16 @@
         <if test="studentId != null">
         	and cto.student_id_ = #{studentId}
         </if>
+        <if test="tenantId != null">
+        	and cto.tenant_id_ = #{tenantId}
+        </if>
         order by cto.create_time_ desc
     </select>
 
     <select id="getNoStartCloudTeacherOrder" resultMap="CloudTeacherOrder">
         SELECT cto.*
         FROM cloud_teacher_order cto
-        WHERE cto.status_ = 1
+        WHERE cto.status_ = 1 and cto.tenant_id_ = #{tenantId}
     </select>
 
     <select id="getStudentCloudTeacherOrders" resultMap="CloudTeacherOrder">
@@ -271,7 +278,7 @@
         </if>
     </select>
     <select id="getStudentIds" resultType="java.lang.Integer">
-        SELECT DISTINCT student_id_ FROM cloud_teacher_order WHERE active_remark_ IS NULL AND status_ != 0
+        SELECT DISTINCT student_id_ FROM cloud_teacher_order WHERE active_remark_ IS NULL AND status_ != 0 and tenant_id_ = #{tenantId}
     </select>
     <select id="queryActiveAmountMap" resultType="java.util.Map">
         SELECT student_id_ 'key',SUM(amount_) 'value' FROM cloud_teacher_order
@@ -411,6 +418,9 @@
             <if test="teacherId != null">
                 AND st.teacher_id_ = #{teacherId}
             </if>
+            <if test="tenantId != null">
+                AND cto.tenant_id_ = #{tenantId}
+            </if>
             <if test="remarkType != null and remarkType != ''">
                 AND cto.remark_ = #{remarkType}
             </if>

+ 10 - 9
mec-biz/src/main/resources/config/mybatis/CooperationOrganLinkmanMapper.xml

@@ -11,6 +11,7 @@
 		<result column="mobile_no_" property="mobileNo" />
 		<result column="job_" property="job" />
 		<result column="create_time_" property="createTime" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -22,7 +23,7 @@
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CooperationOrganLinkman">
 		SELECT * FROM
-		cooperation_organ_linkman ORDER BY id_
+		cooperation_organ_linkman where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
 	<!-- 向数据库增加一条记录 -->
@@ -31,16 +32,16 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO cooperation_organ_linkman
-		(id_,cooperation_organ_id_,linkman_,mobile_no_,job_,create_time_)
-		VALUES(#{id},#{cooperationOrganId},#{linkman},#{mobileNo},#{job},#{createTime})
+		(id_,cooperation_organ_id_,linkman_,mobile_no_,job_,create_time_,tenant_id_)
+		VALUES(#{id},#{cooperationOrganId},#{linkman},#{mobileNo},#{job},#{createTime},#{tenantId})
 	</insert>
 	
 	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO cooperation_organ_linkman
-		(id_,cooperation_organ_id_,linkman_,mobile_no_,job_,create_time_)
+		(id_,cooperation_organ_id_,linkman_,mobile_no_,job_,create_time_,tenant_id_)
 		VALUES
 		<foreach collection="list" item="item" separator=",">
-		(#{item.id},#{item.cooperationOrganId},#{item.linkman},#{item.mobileNo},#{item.job},#{item.createTime})
+		(#{item.id},#{item.cooperationOrganId},#{item.linkman},#{item.mobileNo},#{item.job},#{item.createTime},#{itemm.tenantId})
 		</foreach>
 	</insert>
 
@@ -67,7 +68,7 @@
 				create_time_ = #{createTime},
 			</if>
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	
 	<update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.CooperationOrganLinkman">
@@ -93,7 +94,7 @@
 					create_time_ = #{cooperationOrganLinkman.createTime},
 				</if>
 			</set>
-			WHERE id_ = #{cooperationOrganLinkman.id}
+			WHERE id_ = #{cooperationOrganLinkman.id} and tenant_id_ = #{cooperationOrganLinkman.tenantId}
         </foreach>
 	</update>
 
@@ -104,13 +105,13 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="CooperationOrganLinkman" parameterType="map">
-		SELECT * FROM cooperation_organ_linkman ORDER BY id_
+		SELECT * FROM cooperation_organ_linkman where tenant_id_ = #{tenantId} ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM cooperation_organ_linkman
+		SELECT COUNT(*) FROM cooperation_organ_linkman where tenant_id_ = #{tenantId}
 	</select>
 	
 	<select id="queryByCooperationOrganId" resultMap="CooperationOrganLinkman">

+ 10 - 6
mec-biz/src/main/resources/config/mybatis/CooperationOrganMapper.xml

@@ -20,6 +20,7 @@
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="full_job_resource_" property="fullJobResource"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.entity.CooperationOrgan" id="ExtCooperationOrgan" extends="CooperationOrgan">
@@ -42,7 +43,7 @@
     <select id="findAll" resultMap="CooperationOrgan">
         SELECT *
         FROM cooperation_organ
-        WHERE del_flag_ != 1
+        WHERE del_flag_ != 1 and tenant_id_ = #{tenantId}
         ORDER BY id_
     </select>
 
@@ -51,10 +52,10 @@
             useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO cooperation_organ
         (id_, name_, linkman_, job_, mobile_no_, address_, organ_id_, create_time_, update_time_, ownership_type_,
-         is_enable_, full_job_resource_,education_user_id_)
+         is_enable_, full_job_resource_,education_user_id_,tenant_id_)
         VALUES (#{id}, #{name}, #{linkman}, #{job}, #{mobileNo}, #{address}, #{organId}, now(), now(),
                 #{ownershipType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{isEnable},
-                #{fullJobResource},#{educationUserId})
+                #{fullJobResource},#{educationUserId},#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -95,7 +96,7 @@
                 is_enable_ = #{isEnable},
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 根据主键删除一条记录 -->
@@ -133,6 +134,9 @@
             <if test="isEnable != null">
                 AND co.is_enable_ = #{isEnable}
             </if>
+            <if test="tenantId != null">
+                AND co.tenant_id_ = #{tenantId}
+            </if>
             <if test="fullJobResource != null">
                 AND co.full_job_resource_ = #{fullJobResource}
             </if>
@@ -165,7 +169,7 @@
         SELECT organ_id_ organId, COUNT(*) num
         FROM cooperation_organ
         WHERE full_job_resource_ = 1
-          AND del_flag_ = 0
+          AND del_flag_ = 0 and tenant_id_ = #{tenantId}
         GROUP BY organ_id_
     </select>
 
@@ -173,7 +177,7 @@
     <select id="getAllCooperationOrgan" resultMap="CooperationOrgan">
         SELECT *
         FROM cooperation_organ
-        WHERE del_flag_ = 0
+        WHERE del_flag_ = 0 and tenant_id_ = #{tenantId}
     </select>
 
     <!-- 获取合作单位乐团的的学校缴费 -->

+ 16 - 5
mec-biz/src/main/resources/config/mybatis/CourseHomeworkMapper.xml

@@ -20,6 +20,7 @@
 		<result column="completed_num_" property="completedNum" />
 		<result column="expect_num_" property="expectNum" />
 		<result column="expiry_date_" property="expiryDate" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 	<resultMap type="com.ym.mec.biz.dal.dto.CourseHomeworkListDto" id="CourseHomeworkDto">
@@ -53,16 +54,16 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CourseHomework">
-		SELECT * FROM course_homework ORDER BY id_
+		SELECT * FROM course_homework where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseHomework" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO course_homework (group_type_,course_schedule_id_,attachments_,
-		                             title_,content_,create_time_,update_time_,music_group_id_,class_group_id_,completed_num_,expect_num_,expiry_date_)
+		                             title_,content_,create_time_,update_time_,music_group_id_,class_group_id_,completed_num_,expect_num_,expiry_date_,tenant_id_)
 		VALUES(#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 		       #{courseScheduleId},#{attachments},#{title},#{content},now(),now(),#{musicGroupId},
-		       #{classGroupId},#{completedNum},#{expectNum},#{expiryDate})
+		       #{classGroupId},#{completedNum},#{expectNum},#{expiryDate},#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -102,7 +103,7 @@
 			</if>
 			update_time_ = NOW()
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	
 	<!-- 根据主键删除一条记录 -->
@@ -125,6 +126,9 @@
 			<if test="userId != null">
 				and cs.actual_teacher_id_ = #{userId}
 			</if>
+			<if test="tenantId != null">
+				and ch.tenant_id_ = #{tenantId}
+			</if>
 		</where>
 	</sql>
 	
@@ -154,6 +158,7 @@
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM course_homework
+		<include refid="queryCondition"/>
 	</select>
 
 	<resultMap id="teacherHomeworkListDto" type="com.ym.mec.biz.dal.dto.TeacherHomeworkListDto">
@@ -204,6 +209,9 @@
 			<if test="classGroupId!=null">
 				AND ch.class_group_id_=#{classGroupId}
 			</if>
+			<if test="tenantId != null">
+				AND ch.tenant_id_=#{tenantId}
+			</if>
 			<if test="createTime!=null">
 				AND DATE_FORMAT(class_date_, '%Y-%m')=DATE_FORMAT(#{createTime}, '%Y-%m')
 			</if>
@@ -220,6 +228,9 @@
 			<if test="classGroupId!=null">
 				AND ch.class_group_id_=#{classGroupId}
 			</if>
+			<if test="tenantId != null">
+				AND ch.tenant_id_=#{tenantId}
+			</if>
 			<if test="createTime!=null">
 				AND DATE_FORMAT(class_date_, '%Y-%m')=DATE_FORMAT(#{createTime}, '%Y-%m')
 			</if>
@@ -299,7 +310,7 @@
 	</select>
 	<sql id="queryHomePageSql">
 		<where>
-			cs.group_type_ = #{groupType}
+			cs.group_type_ = #{groupType} and cs.tenant_id_ = #{tenantId}
 			<if test="organId != null">
 				AND FIND_IN_SET(cs.organ_id_,#{organId})
 			</if>

+ 8 - 4
mec-biz/src/main/resources/config/mybatis/CourseHomeworkTemplateMapper.xml

@@ -17,6 +17,7 @@
                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="subject_id_" property="subjectId"/>
         <result column="subject_name_" property="subjectName"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -26,7 +27,7 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="CourseHomeworkTemplate">
-		SELECT * FROM course_homework_template ORDER BY id_
+		SELECT * FROM course_homework_template where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->
@@ -38,8 +39,8 @@
         </selectKey>
         -->
         INSERT INTO course_homework_template
-        (id_,name_,content_,create_time_,update_time_,class_group_type_,subject_id_)
-        VALUES(#{id},#{name},#{content},now(),now(),#{classGroupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{subjectId})
+        (id_,name_,content_,create_time_,update_time_,class_group_type_,subject_id_,tenant_id_)
+        VALUES(#{id},#{name},#{content},now(),now(),#{classGroupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{subjectId},#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -65,7 +66,7 @@
                 name_ = #{name},
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 根据主键删除一条记录 -->
@@ -85,6 +86,9 @@
             <if test="classType != null and classType!=''">
                 and class_group_type_ = #{classType}
             </if>
+            <if test="tenantId != null">
+                and cht.tenant_id_ = #{tenantId}
+            </if>
         </where>
     </sql>
 

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/CourseScheduleComplaintsMapper.xml

@@ -19,6 +19,7 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="score_" property="score" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -28,7 +29,7 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CourseScheduleComplaints">
-		SELECT * FROM course_schedule_complaints ORDER BY id_
+		SELECT * FROM course_schedule_complaints where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
 	<!-- 向数据库增加一条记录 -->
@@ -38,7 +39,7 @@
 		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
 		</selectKey>
 		-->
-		INSERT INTO course_schedule_complaints (id_,user_id_,course_schedule_id_,reason_,status_,wf_process_id_,wf_order_id_,create_time_,update_time_,teacher_liability_ratio_,student_liability_ratio_,score_) VALUES(#{id},#{userId},#{courseScheduleId},#{reason},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{wfProcessId},#{wfOrderId},now(),now(),#{teacherLiabilityRatio},#{studentLiabilityRatio},#{score})
+		INSERT INTO course_schedule_complaints (id_,user_id_,course_schedule_id_,reason_,status_,wf_process_id_,wf_order_id_,create_time_,update_time_,teacher_liability_ratio_,student_liability_ratio_,score_,tenant_id_) VALUES(#{id},#{userId},#{courseScheduleId},#{reason},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{wfProcessId},#{wfOrderId},now(),now(),#{teacherLiabilityRatio},#{studentLiabilityRatio},#{score},#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -78,7 +79,7 @@
 			<if test="score != null">
 				score_ = #{score},
 			</if>
-		</set> WHERE id_ = #{id}
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -97,12 +98,12 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="CourseScheduleComplaints" parameterType="map">
-		SELECT * FROM course_schedule_complaints WHERE score_ &lt;= 2 ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM course_schedule_complaints WHERE score_ &lt;= 2 and tenant_id_ = #{tenantId} ORDER BY id_ <include refid="global.limit"/>
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM course_schedule_complaints
+		SELECT COUNT(*) FROM course_schedule_complaints WHERE score_ &lt;= 2 and tenant_id_ = #{tenantId}
 	</select>
     <select id="findByUserAndCourse" resultMap="CourseScheduleComplaints">
 		SELECT * FROM course_schedule_complaints WHERE user_id_=#{userId} AND course_schedule_id_=#{courseScheduleId}

+ 24 - 5
mec-biz/src/main/resources/config/mybatis/CourseScheduleEvaluateMapper.xml

@@ -26,6 +26,7 @@
         <result column="student_id_list_" jdbcType="VARCHAR" property="studentIdList"/>
         <result column="group_name_" jdbcType="VARCHAR" property="groupName"/>
         <result column="status_" jdbcType="TINYINT" property="status"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
@@ -33,14 +34,14 @@
                                               song_, times_, total_minutes_,
                                               teaching_material_, teacher_id_, item_, comment_, create_time_,
                                               update_time_,
-                                              student_id_list_, version_, status_)
+                                              student_id_list_, version_, status_, tenant_id_)
         values (#{musicGroupId,jdbcType=VARCHAR}, #{classGroupId,jdbcType=INTEGER}, #{courseScheduleId,jdbcType=BIGINT},
                 #{musicTheory,jdbcType=VARCHAR}, #{song,jdbcType=VARCHAR}, #{times,jdbcType=INTEGER}, #{totalMinutes},
                 #{teachingMaterial,jdbcType=VARCHAR},
                 #{teacherId,jdbcType=INTEGER}, #{item,jdbcType=VARCHAR}, #{comment,jdbcType=LONGVARCHAR},
                 #{createTime,jdbcType=TIMESTAMP},
                 #{updateTime,jdbcType=TIMESTAMP}, #{studentIdList}, #{version,jdbcType=INTEGER},
-                #{status,jdbcType=TINYINT})
+                #{status,jdbcType=TINYINT},#{tenantId})
     </insert>
 
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleEvaluate">
@@ -92,7 +93,7 @@
                 update_time_ = #{updateTime}
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <select id="get" resultMap="CourseScheduleEvaluate">
@@ -138,6 +139,7 @@
         WHERE group_status_ != 'LOCK'
           AND group_status_ != 'CANCEL'
           AND type_='FREE'
+          and tenant_id_ = #{tenantId}
         GROUP BY organ_id_
     </select>
 
@@ -148,6 +150,7 @@
         WHERE group_status_ != 'LOCK'
           AND group_status_ != 'CANCEL'
           AND buy_months_ >= 1
+          and tenant_id_ = #{tenantId}
         GROUP BY organ_id_
     </select>
 
@@ -159,6 +162,7 @@
             AND pg.type_='FREE'
             AND pg.group_status_ != 'LOCK'
             AND cse.status_ = 1
+          and cse.tenant_id_ = #{tenantId}
         GROUP BY pg.organ_id_
     </select>
 
@@ -173,6 +177,7 @@
           AND cs.del_flag_ = 0
           AND pg.type_='FREE'
           AND pg.group_status_ != 'LOCK'
+          and cs.tenant_id_ = #{tenantId}
         GROUP BY cs.class_group_id_, pg.organ_id_
     </select>
 
@@ -182,12 +187,14 @@
         FROM student_payment_order
         WHERE group_type_ = 'PRACTICE'
           AND status_ = 'SUCCESS'
+          and tenant_id_ = #{tenantId}
         GROUP BY organ_id_
     </select>
     <select id="findExpiredDateBeforeReport" resultMap="CourseScheduleEvaluate">
         SELECT *
         FROM course_schedule_evaluate
         WHERE status_ = 1
+          and tenant_id_ = #{tenantId}
           AND create_time_ &lt;= #{expiredDate}
           AND (is_pushed_ = 0 OR is_pushed_ IS NULL)
     </select>
@@ -223,6 +230,7 @@
         LEFT JOIN practice_group pg on cse.music_group_id_ = pg.id_
         LEFT JOIN sys_user su ON pg.student_id_=su.id_
         WHERE status_= 0
+          and tenant_id_ = #{tenantId}
         <if test="teacherId != null">
             AND cse.teacher_id_ = #{teacherId}
         </if>
@@ -233,7 +241,7 @@
         INSERT INTO course_schedule_evaluate (music_group_id_, class_group_id_, course_schedule_id_, music_theory_,
         song_,teaching_material_, teacher_id_, item_, comment_, create_time_,update_time_,student_id_list_, version_,
         status_,
-        times_,total_minutes_)
+        times_,total_minutes_,tenant_id_)
         VALUE
         <foreach collection="list" item="evaluate" separator=",">
             (#{evaluate.musicGroupId,jdbcType=VARCHAR}, #{evaluate.classGroupId,jdbcType=INTEGER},
@@ -244,7 +252,7 @@
             #{evaluate.comment,jdbcType=LONGVARCHAR}, #{evaluate.createTime,jdbcType=LONGVARCHAR},
             #{evaluate.updateTime,jdbcType=LONGVARCHAR}, #{evaluate.studentIdList},
             #{evaluate.version,jdbcType=INTEGER}, #{evaluate.status,jdbcType=TINYINT},
-            #{evaluate.times,jdbcType=INTEGER},#{evaluate.totalMinutes,jdbcType=INTEGER})
+            #{evaluate.times,jdbcType=INTEGER},#{evaluate.totalMinutes,jdbcType=INTEGER},#{evaluate.tenantId})
         </foreach>
     </insert>
 
@@ -271,6 +279,7 @@
           AND group_status_ != 'CANCEL'
           AND buy_months_ >= 1
           AND be_renew_group_id_ >= 1
+          and tenant_id_ = #{tenantId}
         GROUP BY organ_id_
     </select>
 
@@ -281,6 +290,7 @@
         WHERE type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
           AND create_time_ >= #{startTime}
           AND status_ = 'SUCCESS'
+          and tenant_id_ = #{tenantId}
         GROUP BY organ_id_
     </select>
 
@@ -295,6 +305,7 @@
         WHERE group_status_ != 'LOCK'
         AND group_status_ != 'CANCEL'
         AND buy_months_ >= 1
+        and tenant_id_ = #{tenantId}
         <if test="type==@com.ym.mec.biz.dal.enums.OrderTypeEnum@PRACTICE_GROUP_BUY">
             <![CDATA[ AND be_renew_group_id_ IS NULL AND create_time_ < #{startTime} ]]>
         </if>
@@ -327,6 +338,7 @@
         WHERE pg.group_status_ IN ('NORMAL', 'FINISH')
           AND s.operating_tag_ = 1
           AND pg.type_='FREE'
+          and pg.tenant_id_ = #{tenantId}
         GROUP BY pg.organ_id_
     </select>
 
@@ -338,6 +350,7 @@
         WHERE pg.group_status_ IN ('NORMAL', 'FINISH')
           AND pg.buy_months_ >= 1
           AND s.operating_tag_ = 0
+          and pg.tenant_id_ = #{tenantId}
         GROUP BY pg.organ_id_
     </select>
 
@@ -352,6 +365,7 @@
           AND vg.id_ >= 1
           AND (cs.is_lock_ IS NULL OR cs.is_lock_ = 0)
           AND s.operating_tag_ = 0
+          and cssp.tenant_id_ = #{tenantId}
         GROUP BY vg.organ_id_
     </select>
 
@@ -367,6 +381,7 @@
           AND cs.id_ >= 1
           AND (cs.is_lock_ IS NULL OR cs.is_lock_ = 0)
           AND s.operating_tag_ = 0
+          and pg.tenant_id_ = #{tenantId}
         GROUP BY pg.organ_id_
     </select>
 
@@ -382,6 +397,7 @@
         AND cs.teach_mode_ = 'ONLINE'
         AND (cs.is_lock_ IS NULL OR cs.is_lock_=0)
         AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
+          and cssp.tenant_id_ = #{tenantId}
         GROUP BY su.organ_id_
     </select>
 
@@ -399,6 +415,7 @@
         <if test="endDate != null">
             <![CDATA[AND CONCAT(cs.class_date_, ' ', cs.end_class_time_) < #{endDate}]]>
         </if>
+          and cssp.tenant_id_ = #{tenantId}
         AND pg.buy_months_ >= 1
         GROUP BY pg.organ_id_
     </select>
@@ -424,6 +441,7 @@
             <![CDATA[AND CONCAT(vcs.class_date_, ' ', vcs.end_class_time_) < #{endDate}
             AND CONCAT(pcs.class_date_, ' ', pcs.end_class_time_) < #{endDate}]]>
         </if>
+          and pg.tenant_id_ = #{tenantId}
         AND pg.buy_months_ >= 1
         GROUP BY pg.organ_id_
     </select>
@@ -435,6 +453,7 @@
                  LEFT JOIN sys_user su ON su.id_ = s.user_id_
         WHERE s.operating_tag_ = 1
           AND su.organ_id_ > 0
+          and s.tenant_id_ = #{tenantId}
           AND su.user_type_ LIKE '%STUDENT%'
         GROUP BY su.organ_id_
     </select>

+ 34 - 255
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -181,7 +181,7 @@
     <!-- 全查询 -->
     <select id="findAll" resultMap="CourseSchedule">
         SELECT <include refid="resultSql"/>
-        FROM course_schedule cs
+        FROM course_schedule cs where tenant_id_ = #{tenantId}
         ORDER BY cs.id_
     </select>
 
@@ -222,9 +222,6 @@
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseSchedule">
         UPDATE course_schedule
         <set>
-            <if test="tenantId != null">
-                tenant_id_ = #{tenantId},
-            </if>
             <if test="validEndTime != null">
                 valid_end_time_ = #{validEndTime},
             </if>
@@ -299,7 +296,7 @@
             </if>
             update_time_ = NOW()
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 根据主键删除一条记录 -->
@@ -392,14 +389,14 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="CourseSchedule" parameterType="map">
-        SELECT * FROM course_schedule ORDER BY id_
+        SELECT * FROM course_schedule where tenant_id_ = #{tenantId} ORDER BY id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*)
-        FROM course_schedule
+        FROM course_schedule where tenant_id_ = #{tenantId}
     </select>
 
     <resultMap type="com.ym.mec.biz.dal.dto.TeacherAttendanceDto" id="TeacherAttendanceViewUtilEntity">
@@ -564,7 +561,7 @@
                 LEFT JOIN music_group mg ON cs.music_group_id_=mg.id_
             </if>
         WHERE
-            (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL) AND cs.pre_course_flag_ = 0
+            (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL) AND cs.pre_course_flag_ = 0 and cs.tenant_id_ = #{tenantId}
             <if test="organIds!=null and organIds.size()>0">
                 AND cs.organ_id_ IN
                 <foreach collection="organIds" item="organId" separator="," open="(" close=")">
@@ -604,7 +601,7 @@
                 LEFT JOIN music_group mg ON cs.music_group_id_=mg.id_
             </if>
         WHERE
-        (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL) AND cs.pre_course_flag_ = 0
+        (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL) AND cs.pre_course_flag_ = 0 and cs.tenant_id_ = #{tenantId}
         AND cs.id_ IS NOT NULL
         <if test="organIds!=null and organIds.size()>0">
             AND cs.organ_id_ IN
@@ -737,7 +734,7 @@
         LEFT JOIN teacher_attendance ta ON cs.id_=ta.course_schedule_id_ AND ta.teacher_id_=#{teacherId}
         WHERE
         (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
-        AND (cs.is_lock_=0 OR cs.is_lock_ IS NULL)
+        AND (cs.is_lock_=0 OR cs.is_lock_ IS NULL) and cs.tenant_id_ = #{tenantId}
         <if test="teacherId!=null">
             AND cs.actual_teacher_id_=#{teacherId}
         </if>
@@ -847,7 +844,8 @@
         FROM
         course_schedule cs
         WHERE
-        cs.class_date_ IN
+        cs.tenant_id_ = #{tenantId}
+        and cs.class_date_ IN
         <foreach collection="dates" item="date" open="(" close=")" separator=",">
             DATE_FORMAT(#{date},'%Y-%m-%d')
         </foreach>
@@ -875,7 +873,7 @@
         FROM
         course_schedule cs
         LEFT JOIN course_schedule_teacher_salary csts ON cs.id_ = csts.course_schedule_id_
-        WHERE
+        WHERE cs.tenant_id_ = #{tenantId} and
         cs.class_date_ IN
         <foreach collection="dates" item="date" open="(" close=")" separator=",">
             DATE_FORMAT(#{date},'%Y-%m-%d')
@@ -966,7 +964,7 @@
         WHERE
         (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
         AND (cs.is_lock_=0 OR cs.is_lock_ IS NULL)
-        AND cg.del_flag_ = 0
+        AND cg.del_flag_ = 0 and cs.tenant_id_ = #{tenantId}
         <if test="teacherId!=null">
             AND cs.actual_teacher_id_=#{teacherId}
         </if>
@@ -1041,7 +1039,7 @@
                 LEFT JOIN music_group mg ON cs.music_group_id_=mg.id_
             </if>
         WHERE
-            (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL) AND cs.pre_course_flag_ = 0
+            (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL) AND cs.pre_course_flag_ = 0 and cs.tenant_id_ = #{tenantId}
             <if test="organIds!=null and organIds.size()>0">
                 AND cs.organ_id_ IN
                 <foreach collection="organIds" item="organId" separator="," open="(" close=")">
@@ -1240,17 +1238,16 @@
         teach_mode_
         FROM
         course_schedule
-        <where>
-            <if test="classGroupId!=null">
-                AND class_group_id_ = #{classGroupId}
-            </if>
-            <if test="classDates!=null">
-                AND class_date_ IN
-                <foreach collection="classDates" item="classDate" open="(" close=")" separator=",">
-                    #{classDate}
-                </foreach>
-            </if>
-        </where>
+        where tenant_id_ = #{tenantId}
+        <if test="classGroupId!=null">
+            AND class_group_id_ = #{classGroupId}
+        </if>
+        <if test="classDates!=null">
+            AND class_date_ IN
+            <foreach collection="classDates" item="classDate" open="(" close=")" separator=",">
+                #{classDate}
+            </foreach>
+        </if>
     </select>
 
     <select id="findClassTypeByCourse" resultType="string">
@@ -1270,6 +1267,7 @@
                  LEFT JOIN teacher t ON cs.actual_teacher_id_ = t.id_
         WHERE cs.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
           AND date_format(#{monthDate}, '%Y%m') = date_format(cs.class_date_, '%Y%m')
+          and cs.tenant_id_ = #{tenantId}
         GROUP BY vp.organ_id_, cs.actual_teacher_id_
     </select>
 
@@ -1339,7 +1337,7 @@
                 </if>
                 update_time_ = NOW()
             </set>
-            WHERE id_ = #{item.id}
+            WHERE id_ = #{item.id} and tenant_id_ = #{item.tenantId}
         </foreach>
     </update>
     <update id="updateByMusicGroupId">
@@ -1762,55 +1760,6 @@
           AND DATE_FORMAT(#{startTime}, '%H:%i:%S') &lt;= DATE_FORMAT(cs.end_class_time_, '%H:%i:%S')
           AND DATE_FORMAT(#{endTime}, '%H:%i:%S') &gt;= DATE_FORMAT(cs.start_class_time_, '%H:%i:%S')
     </select>
-    <select id="findByDateZone" resultMap="CourseSchedule">
-        SELECT cs.id_,
-               cs.class_group_id_,
-               cs.status_,
-               cs.subsidy_,
-               cs.class_date_,
-               CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
-               CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
-               cs.teacher_id_,
-               cs.actual_teacher_id_,
-               cs.create_time_,
-               cs.update_time_,
-               cs.teach_mode_,
-               cs.type_,
-               cs.name_,
-               cs.student_num_,
-               cs.leave_student_num_,
-               cs.schoole_id_
-        FROM course_schedule cs
-        WHERE (cs.class_date_ BETWEEN DATE_FORMAT(#{startTime}, '%Y%m%d') AND DATE_FORMAT(#{endTime}, '%Y%m%d'))
-          AND cs.status_ = 'NOT_START'
-    </select>
-    <select id="findAllCourseByDateZone" resultMap="CourseSchedule">
-        SELECT cs.id_,
-               cs.music_group_id_,
-               cs.group_type_,
-               cs.class_group_id_,
-               cs.status_,
-               cs.subsidy_,
-               cs.class_date_,
-               CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
-               CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
-               cs.teacher_id_,
-               cs.actual_teacher_id_,
-               cs.create_time_,
-               cs.update_time_,
-               cs.teach_mode_,
-               cs.type_,
-               cs.name_,
-               cs.student_num_,
-               cs.leave_student_num_,
-               cs.schoole_id_,
-               cg.type_                                          class_group_type_
-        FROM course_schedule cs
-                 left join class_group cg on cs.class_group_id_ = cg.id_
-        WHERE (cs.class_date_ BETWEEN DATE_FORMAT(#{startTime}, '%Y%m%d') AND DATE_FORMAT(#{endTime}, '%Y%m%d'))
-          AND (cs.del_flag_ IS NULL OR cs.del_flag_ = 0)
-          AND (cg.del_flag_ IS NULL OR cg.del_flag_ = 0)
-    </select>
 
     <select id="findByClassDate" resultMap="CourseSchedule">
         SELECT
@@ -1830,44 +1779,11 @@
             #{classDate}
         </foreach>
         )
+        and cs.tenant_id_ = #{tenantId}
         AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
         AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
     </select>
 
-    <select id="findByClassDateWithoutMusicGroup" resultMap="CourseSchedule">
-        SELECT
-        cs.id_,
-        cs.music_group_id_,
-        cs.class_group_id_,
-        cs.class_date_,
-        CONCAT(cs.class_date_,' ',cs.start_class_time_) start_class_time_,
-        CONCAT(cs.class_date_,' ',cs.end_class_time_) end_class_time_,
-        cs.type_,
-        cs.name_,
-        cs.actual_teacher_id_
-        FROM
-        course_schedule cs
-        WHERE
-        cs.group_type_!='MUSIC'
-        AND (cs.class_date_ IN
-        <foreach collection="classDates" item="classDate" open="(" close=")" separator=",">
-            #{classDate}
-        </foreach>
-        )
-        AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
-    </select>
-
-    <select id="findAllCourseByDateZone2" resultMap="CourseSchedule">
-        SELECT cs.id_,
-               cs.class_group_id_,
-               CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
-               CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
-               cs.actual_teacher_id_
-        FROM course_schedule cs
-        WHERE (cs.class_date_ BETWEEN DATE_FORMAT(#{startTime}, '%Y%m%d') AND DATE_FORMAT(#{endTime}, '%Y%m%d'))
-          AND (cs.del_flag_ IS NULL OR cs.del_flag_ = 0)
-    </select>
-
     <select id="queryStudentCoursesTimesOfTomorrow" resultMap="Mapper">
         select cssp.user_id_ key_, count(1) value_
         from course_schedule cs
@@ -1960,21 +1876,10 @@
             (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
             AND cs.class_date_ BETWEEN #{startDate} AND #{endDate}
           AND cs.group_type_ = 'MUSIC'
+          and cs.tenant_id_ = #{tenantId}
           AND (cs.del_flag_ IS NULL OR cs.del_flag_ = 0) AND cs.pre_course_flag_ = 0
     </select>
 
-    <select id="countIsSalaryGroupTypes" resultType="int">
-        SELECT
-            COUNT(DISTINCT csts.group_type_)
-        FROM
-            course_schedule_teacher_salary csts
-                LEFT JOIN course_schedule cs ON csts.course_schedule_id_ = cs.id_
-        WHERE
-            cs.class_date_ BETWEEN #{startDate} AND #{endDate}
-          AND ( cs.del_flag_ IS NULL OR cs.del_flag_ = 0 )
-          AND csts.settlement_time_ IS NOT NULL
-    </select>
-
     <select id="findByClassGroup" resultMap="CourseSchedule">
         select cs.id_,
                cs.class_group_id_,
@@ -2064,29 +1969,6 @@
         GROUP BY user_id_
     </select>
 
-    <select id="findAllCourseSches" resultMap="CourseSchedule">
-        select cs.id_,
-               cs.class_group_id_,
-               cs.status_,
-               cs.subsidy_,
-               cs.class_date_,
-               CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
-               CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
-               cs.start_class_time_                              start_class_time_str_,
-               cs.end_class_time_                                end_class_time_str_,
-               cs.teacher_id_,
-               cs.actual_teacher_id_,
-               cs.create_time_,
-               cs.update_time_,
-               cs.teach_mode_,
-               cs.type_,
-               cs.name_,
-               cs.student_num_,
-               cs.leave_student_num_,
-               cs.schoole_id_
-        from course_schedule cs
-    </select>
-
     <select id="findOneCourseScheduleByClassGroupId" resultMap="CourseSchedule">
         SELECT *
         FROM course_schedule
@@ -2191,48 +2073,6 @@
         DELETE FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = 'MUSIC' AND pre_course_flag_ = 1
     </delete>
 
-    <select id="queryUnsignedStudentList" resultMap="StudentAttendance">
-        SELECT cssp.user_id_,
-               cs.actual_teacher_id_ teacher_id_,
-               cs.id_                course_schedule_id_,
-               cs.class_group_id_,
-               cs.music_group_id_,
-               cs.group_type_,
-               cg.current_class_times_
-        FROM course_schedule_student_payment cssp
-                 LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
-                 LEFT JOIN class_group cg ON cg.id_ = cs.class_group_id_
-                 LEFT JOIN student_attendance sa
-                           ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND cssp.user_id_ = sa.user_id_
-        WHERE CONCAT(cs.class_date_, ' ', cs.end_class_time_) &lt;= DATE_ADD(NOW(), INTERVAL -1 HOUR)
-          AND sa.id_ IS NULL
-    </select>
-    <select id="getNextCourseSchedule" resultMap="CourseSchedule">
-        SELECT cs.id_,
-               cs.class_group_id_,
-               cs.status_,
-               cs.subsidy_,
-               cs.class_date_,
-               CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
-               CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
-               cs.start_class_time_                              start_class_time_str_,
-               cs.end_class_time_                                end_class_time_str_,
-               cs.teacher_id_,
-               cs.actual_teacher_id_,
-               cs.create_time_,
-               cs.update_time_,
-               cs.teach_mode_,
-               cs.type_,
-               cs.name_,
-               cs.student_num_,
-               cs.leave_student_num_,
-               cs.schoole_id_
-        FROM course_schedule cs
-        WHERE cs.class_group_id_ = #{classGroupId}
-          AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) &gt; NOW()
-        ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_)
-        LIMIT 1
-    </select>
     <select id="countCurrentTimes" resultType="int">
         SELECT COUNT(*)
         FROM course_schedule
@@ -2519,7 +2359,7 @@
 
     <sql id="endFindCourseSchedulesCondition">
         <where>
-            cs.del_flag_ = 0 AND cs.pre_course_flag_ = 0
+            cs.del_flag_ = 0 AND cs.pre_course_flag_ = 0 and cs.tenant_id_ = #{tenantId}
             <include refid="queryVipCourseScheduleIds"/>
         </where>
     </sql>
@@ -2589,20 +2429,6 @@
         LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_ = cs.id_
         <include refid="endFindCourseSchedulesCondition"/>
     </select>
-    <select id="findCourseIdsByStudent" resultType="int">
-        SELECT cssp.course_schedule_id_
-        FROM course_schedule_student_payment cssp
-        LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
-        WHERE su.username_ LIKE CONCAT('%', #{search}, '%')
-           OR su.id_ = #{search}
-    </select>
-    <select id="findCourseIdsByTeacher" resultType="int">
-        SELECT csts.course_schedule_id_
-        FROM course_schedule_teacher_salary csts
-                 LEFT JOIN sys_user su ON csts.user_id_ = su.id_
-        WHERE real_name_ LIKE CONCAT('%', #{search}, '%')
-           OR su.id_ = #{search}
-    </select>
     <select id="findClassGroupCourseSchedulesWithDate" resultMap="CourseSchedule">
         SELECT <include refid="resultSql"/>
         FROM course_schedule cs
@@ -2631,21 +2457,6 @@
         WHERE group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
           AND music_group_id_ = #{groupId}
     </select>
-    <select id="queryMusicCourseScheduleIds" resultType="java.lang.Integer">
-        SELECT cs.id_ FROM course_schedule cs
-        LEFT JOIN music_group mg ON cs.music_group_id_ = mg.id_
-        LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
-        WHERE cs.group_type_ = 'MUSIC' AND cs.del_flag_ = 0 AND cg.del_flag_ = 0
-        <if test="search != null and search != ''">
-            AND (mg.id_ = #{search} OR mg.name_ LIKE CONCAT('%',#{search},'%')
-            OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%')
-            OR cg.id_ = #{search} OR cg.name_ LIKE CONCAT('%',#{search},'%'))
-        </if>
-        <if test="organIdList != null and organIdList != ''">
-            AND FIND_IN_SET(mg.organ_id_,#{organIdList})
-        </if>
-        <include refid="queryVipCourseScheduleIds"/>
-    </select>
     <sql id="queryVipCourseScheduleIds">
         <if test="mergeCourseType != null and mergeCourseType != ''">
             <if test="mergeCourseType == 'MASTER'">
@@ -2715,6 +2526,9 @@
         <if test="courseIdSearch != null">
             AND cs.id_ = #{courseIdSearch}
         </if>
+        <if test="tenantId != null">
+            AND cs.tenant_id_ = #{tenantId}
+        </if>
         <if test="searchType == 'ERR_ATTENDANCE'">
             AND ta.teacher_id_ = cs.actual_teacher_id_
             AND cs.status_ = 'OVER'
@@ -2740,37 +2554,6 @@
             </foreach>
         </if>
     </sql>
-    <select id="queryPracticeCourseScheduleIds" resultType="java.lang.Integer">
-        SELECT cs.id_ FROM course_schedule cs
-        LEFT JOIN practice_group pg ON cs.music_group_id_ = pg.id_
-        LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
-        WHERE cs.group_type_ = 'PRACTICE' AND cs.del_flag_ = 0 AND cg.del_flag_ = 0
-        AND pg.group_status_='NORMAL'
-        <if test="search != null and search != ''">
-            AND (pg.id_ = #{search} OR pg.name_ LIKE CONCAT('%',#{search},'%')
-            OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%')
-            OR cg.id_ = #{search} OR cg.name_ LIKE CONCAT('%',#{search},'%'))
-        </if>
-        <if test="organIdList != null and organIdList != ''">
-            AND FIND_IN_SET(pg.organ_id_,#{organIdList})
-        </if>
-        <include refid="queryVipCourseScheduleIds"/>
-    </select>
-    <select id="queryVipCourseScheduleIds" resultType="java.lang.Integer">
-        SELECT cs.id_ FROM course_schedule cs
-        LEFT JOIN vip_group vg ON cs.music_group_id_ = vg.id_
-        LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
-        WHERE cs.group_type_ = 'VIP' AND cs.del_flag_ = 0 AND cg.del_flag_ = 0
-        <if test="search != null and search != ''">
-            AND (vg.id_ = #{search} OR vg.name_ LIKE CONCAT('%',#{search},'%')
-            OR cs.id_ = #{search} OR cs.name_ LIKE CONCAT('%',#{search},'%')
-            OR cg.id_ = #{search} OR cg.name_ LIKE CONCAT('%',#{search},'%'))
-        </if>
-        <if test="organIdList != null and organIdList != ''">
-            AND FIND_IN_SET(vg.organ_id_,#{organIdList})
-        </if>
-        <include refid="queryVipCourseScheduleIds"/>
-    </select>
     <select id="findTeachersCoursesWithDateRange" resultMap="CourseSchedule">
         SELECT
         cs.id_,
@@ -3254,7 +3037,7 @@
         cs.status_
         FROM course_schedule cs
         LEFT JOIN course_schedule_evaluate cse ON cs.id_ = cse.course_schedule_id_
-        WHERE cs.group_type_ = #{groupType} AND cs.pre_course_flag_ = 0
+        WHERE cs.group_type_ = #{groupType} AND cs.pre_course_flag_ = 0 and cs.tenant_id_ = #{tenantId}
         <if test="groupId != null">
             AND cs.music_group_id_ = #{groupId}
         </if>
@@ -3337,12 +3120,10 @@
         WHERE cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         AND cs.del_flag_ = 0
         AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = 0) AND cs.pre_course_flag_ = 0
-        <if test="groupIds!=null and groupIds.size()>0">
-            AND cs.music_group_id_ IN
+        AND cs.music_group_id_ IN
             <foreach collection="groupIds" item="groupId" open="(" close=")" separator=",">
                 #{groupId}
             </foreach>
-        </if>
     </select>
     <select id="queryScheduleByAttendance" resultMap="CourseSchedule">
         SELECT cs.*
@@ -3408,9 +3189,7 @@
             LEFT JOIN `sys_user` edut ON edut.`id_` = vg.`educational_teacher_id_`
         WHERE cssp.`group_type_` = 'VIP'
         AND vg.group_status_!=3
-        <if test="organIds != null and organIds != ''">
-            AND FIND_IN_SET(vg.organ_id_, #{organIds})
-        </if>
+        AND FIND_IN_SET(vg.organ_id_, #{organIds})
         GROUP BY cssp.`user_id_`,o.id_
     </select>
 
@@ -4088,7 +3867,7 @@
         LEFT JOIN course_schedule_student_payment cssp ON s.user_id_ = cssp.user_id_
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.group_type_ = #{groupType} AND cs.del_flag_ = 0 AND cs.pre_course_flag_ = 0
         LEFT JOIN sys_user su ON su.id_ = s.user_id_
-        WHERE 1=1
+        WHERE 1=1 and s.tenant_id_ = #{tenantId}
         <if test="hasMember != null">
             <if test="hasMember == 1">
                 AND s.member_rank_setting_id_ IS NOT NULL

+ 6 - 4
mec-biz/src/main/resources/config/mybatis/CourseScheduleModifyLogMapper.xml

@@ -11,6 +11,7 @@
 		<result column="previous_course_schedule_" property="previousCourseSchedule" />
 		<result column="current_course_schedule_" property="currentCourseSchedule" />
 		<result column="create_time_" property="createTime" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 
@@ -28,19 +29,20 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO course_schedule_modify_log
-		(id_,course_schedule_id_,operator_id_,previous_course_schedule_,current_course_schedule_,create_time_)
-		VALUES(#{id},#{courseScheduleId},#{operatorId},#{previousCourseSchedule},#{currentCourseSchedule},#{createTime})
+		(id_,course_schedule_id_,operator_id_,previous_course_schedule_,current_course_schedule_,create_time_,tenant_id_)
+		VALUES(#{id},#{courseScheduleId},#{operatorId},#{previousCourseSchedule},#{currentCourseSchedule},#{createTime},#{tenantId})
 	</insert>
     <insert id="batchInsert">
 		INSERT INTO course_schedule_modify_log
-		(course_schedule_id_,operator_id_,previous_course_schedule_,current_course_schedule_,create_time_)
+		(course_schedule_id_,operator_id_,previous_course_schedule_,current_course_schedule_,create_time_,tenant_id_)
 		VALUES
 		<foreach collection="scheduleModifyLogs" item="item" separator=",">
-			(#{item.courseScheduleId},#{item.operatorId},#{item.previousCourseSchedule},#{item.currentCourseSchedule},#{item.createTime})
+			(#{item.courseScheduleId},#{item.operatorId},#{item.previousCourseSchedule},#{item.currentCourseSchedule},#{item.createTime},#{tenantId})
 		</foreach>
 	</insert>
 	<sql id="queryPageSql">
 		<where>
+			tenant_id_ = #{tenantId}
 			<if test="courseScheduleId != null">
 				AND course_schedule_id_ = #{courseScheduleId}
 			</if>

+ 14 - 7
mec-biz/src/main/resources/config/mybatis/CourseScheduleReviewMapper.xml

@@ -26,6 +26,7 @@
         <result column="student_name_" jdbcType="VARCHAR" property="studentName"/>
         <result column="student_avatar_" jdbcType="VARCHAR" property="studentAvatar"/>
         <result column="class_date_" jdbcType="DATE" property="classDate"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <select id="get" parameterType="java.lang.Integer" resultMap="CourseScheduleReview">
@@ -58,23 +59,23 @@
         song_, memo_, pronunciation_,
         tempo_, music_theory_, has_liaison_,
         hand_homework_, course_review_, create_time_,
-        update_time_)
+        update_time_,tenant_id_)
         values (#{courseScheduleId,jdbcType=INTEGER}, #{classGroupId,jdbcType=INTEGER}, #{teacherId,jdbcType=INTEGER},
         #{educationalTeacherId,jdbcType=INTEGER}, #{studentId,jdbcType=INTEGER}, #{teachingMaterial,jdbcType=VARCHAR},
         #{song,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, #{pronunciation,jdbcType=INTEGER},
         #{tempo,jdbcType=INTEGER}, #{musicTheory,jdbcType=INTEGER}, #{hasLiaison,jdbcType=TINYINT},
         #{handHomework,jdbcType=TINYINT}, #{courseReview,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
-        #{updateTime,jdbcType=TIMESTAMP})
+        #{updateTime,jdbcType=TIMESTAMP},#{tenantId})
     </insert>
 
     <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO course_schedule_review (course_schedule_id_, class_group_id_, teacher_id_, student_id_,
-        teaching_material_,memo_, create_time_,update_time_)
+        teaching_material_,memo_, create_time_,update_time_,tenant_id_)
         VALUE
         <foreach collection="courseScheduleReviews" item="courseScheduleReview" separator=",">
             (#{courseScheduleReview.courseScheduleId,jdbcType=INTEGER},#{courseScheduleReview.classGroupId,jdbcType=INTEGER},
             #{courseScheduleReview.teacherId,jdbcType=INTEGER},#{courseScheduleReview.studentId,jdbcType=INTEGER},
-            #{courseScheduleReview.teachingMaterial,jdbcType=VARCHAR},#{courseScheduleReview.memo,jdbcType=VARCHAR},NOW(),now())
+            #{courseScheduleReview.teachingMaterial,jdbcType=VARCHAR},#{courseScheduleReview.memo,jdbcType=VARCHAR},NOW(),now(),#{tenantId})
         </foreach>
     </insert>
 
@@ -129,7 +130,7 @@
             </if>
             update_time_ = NOW()
         </set>
-        where id_ = #{id,jdbcType=INTEGER}
+        where id_ = #{id,jdbcType=INTEGER} and tenant_id_ = #{tenantId}
     </update>
     <resultMap id="CourseReviewDto" type="com.ym.mec.biz.dal.dto.CourseReviewDto">
         <id column="id_" jdbcType="INTEGER" property="id"/>
@@ -181,6 +182,9 @@
             <if test="subjectId != null">
                 AND pg.subject_id_=#{subjectId}
             </if>
+            <if test="tenantId != null">
+                AND pg.tenant_id_=#{tenantId}
+            </if>
             <if test="teacherId != null">
                 AND cs.actual_teacher_id_=#{teacherId}
             </if>
@@ -288,6 +292,9 @@
             <if test="eduTeacherId != null">
                 AND csr.educational_teacher_id_=#{eduTeacherId}
             </if>
+            <if test="tenantId != null">
+                AND csr.tenant_id_=#{tenantId}
+            </if>
             <if test='hasReview !=null and hasReview=="1"'>
                 AND csr.course_review_ IS NOT NULL
             </if>
@@ -419,7 +426,7 @@
     <sql id="courseReviewsQueryCondition">
         <where>
             AND cs.type_ IN ('PRACTICE','VIP') AND cs.teach_mode_='ONLINE' AND cs.status_='OVER' AND (cs.del_flag_ = 0
-            OR cs.del_flag_ IS NULL)
+            OR cs.del_flag_ IS NULL) and cs.tenant_id_ = #{tenantId}
             <if test="search!=null and search!=''">
                 AND (cs.name_ LIKE CONCAT('%',#{search},'%') OR cs.id_= #{search})
             </if>
@@ -506,7 +513,7 @@
 
     <sql id="vipGroupReviewsQueryCondition">
         <where>
-            AND vg.id_ > 0 AND cs.group_type_='VIP' AND cs.status_='OVER' AND (cs.del_flag_ = 0 OR cs.del_flag_ IS NULL)
+            AND vg.id_ > 0 AND cs.group_type_='VIP' AND cs.status_='OVER' AND (cs.del_flag_ = 0 OR cs.del_flag_ IS NULL) and cs.tenant_id_ = #{tenantId}
             <if test="search!=null and search!=''">
                 AND (cs.name_ LIKE CONCAT('%',#{search},'%') OR cs.id_= #{search})
             </if>

+ 11 - 7
mec-biz/src/main/resources/config/mybatis/CourseScheduleRewardsMapper.xml

@@ -19,6 +19,7 @@
 		<result column="teacher_id_" property="teacherId" />
 		<result column="subject_id_" property="subjectIds" />
 		<result column="subject_name_" property="subjectName" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -28,7 +29,7 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CourseScheduleRewardsRules">
-		SELECT * FROM course_schedule_rewards_rules ORDER BY id_
+		SELECT * FROM course_schedule_rewards_rules where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
 	<!-- 向数据库增加一条记录 -->
@@ -37,9 +38,9 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO course_schedule_rewards_rules
-		(id_,name_,course_schedule_type_,reward_mode_,organ_id_,rewards_rules_json_,create_time_,update_time_,vip_group_category_id_list_,teacher_id_,subject_id_)
+		(id_,name_,course_schedule_type_,reward_mode_,organ_id_,rewards_rules_json_,create_time_,update_time_,vip_group_category_id_list_,teacher_id_,subject_id_,tenant_id_)
 		VALUES(#{id},#{name},#{courseScheduleType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-		#{rewardMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{organId},#{rewardsRulesJson},now(),now(),#{vipGroupCategoryIdList},#{teacherId},#{subjectIds})
+		#{rewardMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{organId},#{rewardsRulesJson},now(),now(),#{vipGroupCategoryIdList},#{teacherId},#{subjectIds},#{tenantId})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -76,7 +77,7 @@
 				rewards_rules_json_ = #{rewardsRulesJson},
 			</if>
 		</set>
-		WHERE id_ = #{id}
+		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<!-- 根据主键删除一条记录 -->
@@ -87,13 +88,13 @@
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="CourseScheduleRewardsRules"
 		parameterType="map">
-		SELECT * FROM course_schedule_rewards_rules ORDER BY id_
+		SELECT * FROM course_schedule_rewards_rules where tenant_id_ = #{tenantId} ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM course_schedule_rewards_rules
+		SELECT COUNT(*) FROM course_schedule_rewards_rules where tenant_id_ = #{tenantId}
 	</select>
 	
 	<select id="query" resultType="map">
@@ -102,7 +103,7 @@
 	</select>
 	
 	<select id="queryOrganIdList" resultType="java.lang.String">
-		SELECT organ_id_ FROM course_schedule_rewards_rules
+		SELECT organ_id_ FROM course_schedule_rewards_rules where tenant_id_ = #{tenantId}
 	</select>
 	<select id="findByTeacherAndCategory" resultMap="CourseScheduleRewardsRules">
 		SELECT * FROM course_schedule_rewards_rules csrr
@@ -183,6 +184,9 @@
 			<if test="rewardMode">
 				AND csrr.reward_mode_ = #{rewardMode}
 			</if>
+			<if test="tenantId">
+				AND csrr.tenant_id_ = #{tenantId}
+			</if>
 			<if test="vipGroupCategoryId">
 				AND FIND_IN_SET(#{vipGroupCategoryId},csrr.vip_group_category_id_list_)
 			</if>

+ 17 - 40
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -21,6 +21,7 @@
 		<result column="class_group_id_" property="classGroupId" />
 		<result column="batch_no_" property="batchNo"/>
 		<result column="be_merged_" property="beMerged"/>
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 	<resultMap type="com.ym.mec.biz.dal.dto.StudentCourseTimesDto" id="studentCourseTimesDto">
@@ -43,23 +44,23 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CourseScheduleStudentPayment">
-		SELECT * FROM course_schedule_student_payment ORDER BY id_
+		SELECT * FROM course_schedule_student_payment where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO course_schedule_student_payment (id_,group_type_,music_group_id_,course_schedule_id_,user_id_,
-			original_price_,expect_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_)
+			original_price_,expect_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_,tenant_id_)
 		VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{courseScheduleId},#{userId},
-			#{originalPrice},#{expectPrice},#{actualPrice},#{createTime},NOW(),#{settlementTime},#{classGroupId},#{batchNo},#{beMerged})
+			#{originalPrice},#{expectPrice},#{actualPrice},#{createTime},NOW(),#{settlementTime},#{classGroupId},#{batchNo},#{beMerged},#{tenantId})
 	</insert>
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
 		INSERT INTO course_schedule_student_payment (id_,group_type_,music_group_id_,course_schedule_id_,user_id_,expect_price_,
-				original_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_)
+				original_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_,tenant_id_)
 		VALUE
 		<foreach collection="list" item="data" separator=",">
 			(#{data.id},#{data.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{data.musicGroupId},#{data.courseScheduleId},#{data.userId},#{data.expectPrice},
-			#{data.originalPrice},#{data.actualPrice},now(),now(),#{data.settlementTime},#{data.classGroupId},#{data.batchNo},#{data.beMerged})
+			#{data.originalPrice},#{data.actualPrice},now(),now(),#{data.settlementTime},#{data.classGroupId},#{data.batchNo},#{data.beMerged},#{data.tenantId})
 		</foreach>
     </insert>
 
@@ -104,7 +105,7 @@
 				be_merged_ = #{beMerged},
 			</if>
 				update_time_ = NOW()
-		</set> WHERE id_ = #{id}
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment">
@@ -148,7 +149,7 @@
 					be_merged_ = #{courseScheduleStudentPayment.beMerged},
 				</if>
 				update_time_ = NOW()
-			</set> WHERE id_ = #{courseScheduleStudentPayment.id}
+			</set> WHERE id_ = #{courseScheduleStudentPayment.id} and tenant_id_ = #{courseScheduleStudentPayment.tenantId}
 		</foreach>
 	</update>
     <update id="adjustPlayMidi">
@@ -182,12 +183,12 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="CourseScheduleStudentPayment" parameterType="map">
-		SELECT * FROM course_schedule_student_payment ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM course_schedule_student_payment where tenant_id_ = #{tenantId} ORDER BY id_ <include refid="global.limit"/>
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM course_schedule_student_payment
+		SELECT COUNT(*) FROM course_schedule_student_payment where tenant_id_ = #{tenantId}
 	</select>
 
     <select id="findByCourseScheduleIds" resultMap="CourseScheduleStudentPayment">
@@ -290,13 +291,13 @@
 		SELECT cssp.user_id_ FROM course_schedule_student_payment cssp
 		LEFT JOIN music_group mg ON cssp.music_group_id_ = mg.id_ AND cssp.group_type_ = 'MUSIC'
 		LEFT JOIN student_registration sr ON cssp.user_id_ = sr.user_id_ AND cssp.music_group_id_ = sr.music_group_id_
-		WHERE mg.status_ = 'PROGRESS' AND sr.music_group_status_ != 'QUIT'
+		WHERE mg.status_ = 'PROGRESS' AND sr.music_group_status_ != 'QUIT' and cssp.tenant_id_ = #{tenantId}
 		GROUP BY cssp.user_id_
 	</select>
     <select id="queryVipStudentPer" resultType="java.lang.Integer">
 		SELECT cssp.user_id_ FROM course_schedule_student_payment cssp
 		LEFT JOIN vip_group vg ON cssp.music_group_id_ = vg.id_
-		WHERE vg.group_status_ IN (2,4) AND cssp.group_type_ = 'VIP'
+		WHERE vg.group_status_ IN (2,4) AND cssp.group_type_ = 'VIP' and cssp.tenant_id_ = #{tenantId}
 		GROUP BY cssp.user_id_
 	</select>
     <select id="countCourseStudentNum" resultType="java.util.Map">
@@ -365,31 +366,6 @@
 		<result property="actualTeacherId" column="actual_teacher_id_"/>
 	</resultMap>
 
-    <select id="findNoPracticeStudentIdsOnWeek" resultMap="Practice4ExercisesSituationDto">
-		SELECT
-			cssp.user_id_,
-			CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
-			pg.user_id_ actual_teacher_id_
-		FROM
-			course_schedule_student_payment cssp
-			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
-			LEFT JOIN practice_group pg ON cssp.music_group_id_=pg.id_
-			LEFT JOIN student s ON cssp.user_id_=s.user_id_
-		WHERE
-			cssp.group_type_ = 'PRACTICE'
-			AND s.service_tag_=1
-			AND cssp.user_id_ NOT IN (
-			SELECT
-				cssp1.user_id_
-			FROM
-				course_schedule_student_payment cssp1
-				LEFT JOIN course_schedule cs1 ON cssp1.course_schedule_id_ = cs1.id_
-			WHERE cssp1.group_type_ = 'PRACTICE'
-				AND cs1.class_date_ BETWEEN #{monday} AND #{sunday}
-			)
-		ORDER BY
-			cssp.user_id_
-	</select>
 	<select id="findNoPracticeStudentTeacherId" resultType="java.lang.Integer">
 		SELECT cs.actual_teacher_id_
 		FROM course_schedule_student_payment cssp
@@ -466,7 +442,7 @@
 			LEFT JOIN course_schedule_student_payment cssp ON s.user_id_=cssp.user_id_
 			LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
 			LEFT JOIN class_group_teacher_mapper cgtm ON cssp.class_group_id_=cgtm.class_group_id_
-		WHERE cs.type_ IN ('PRACTICE', 'VIP', 'SINGLE', 'MIX') AND cs.pre_course_flag_ = 0 AND cgtm.teacher_role_='BISHOP';
+		WHERE cs.type_ IN ('PRACTICE', 'VIP', 'SINGLE', 'MIX') AND cs.pre_course_flag_ = 0 AND cgtm.teacher_role_='BISHOP' and s.tenant_id_ = #{tenantId};
 	</select>
     <select id="findCoursePayment" resultType="map">
 		SELECT
@@ -602,8 +578,9 @@
 
 	<sql id="queryAllCondition">
 		<where>
+			teannt_id_ = #{tenantId}
 			<if test="courseScheduleId != null">
-				course_schedule_id_ = #{courseScheduleId}
+				and course_schedule_id_ = #{courseScheduleId}
 			</if>
 		</where>
 	</sql>
@@ -837,7 +814,7 @@
 		SELECT CASE WHEN s.user_id_ = NULL THEN 0 ELSE 1 END hasCourse FROM student s
 		LEFT JOIN sys_user su ON s.user_id_ = su.id_
 		LEFT JOIN course_schedule_student_payment cssp FORCE INDEX(group_type_) ON cssp.user_id_ = s.user_id_
-		WHERE cssp.group_type_ IN ('VIP','PRACTICE')
+		WHERE cssp.group_type_ IN ('VIP','PRACTICE') and cssp.tenant_id_ = #{tenantId}
 		<if test="organId != null and organId != ''">
 			AND FIND_IN_SET(su.organ_id_,#{organId})
 		</if>
@@ -871,7 +848,7 @@
 		LEFT JOIN organization o ON o.id_ = su.organ_id_
 		LEFT JOIN `subject` sb ON sb.id_ = s.subject_id_list_
 		LEFT JOIN sys_user_cash_account uca ON uca.user_id_ = s.user_id_
-		WHERE cssp.group_type_ IN ('VIP','PRACTICE')
+		WHERE cssp.group_type_ IN ('VIP','PRACTICE') and cssp.tenant_id_ = #{tenantId}
 		<if test="organId != null">
 			AND FIND_IN_SET(su.organ_id_,#{organId})
 		</if>

+ 24 - 32
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -34,6 +34,7 @@
 		<result column="deduction_reason_" property="deductionReason"/>
 		<result column="belong_to_daya_" property="belongToDaya" />
 		<result column="enable_change_salary_" property="enableChangeSalary" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<resultMap type="com.ym.mec.biz.dal.dto.TeacherVipSalaryDto" id="teacherVipSalaryDto" extends="CourseScheduleTeacherSalary">
@@ -50,28 +51,28 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CourseScheduleTeacherSalary">
-		SELECT * FROM course_schedule_teacher_salary ORDER BY id_
+		SELECT * FROM course_schedule_teacher_salary where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO course_schedule_teacher_salary (id_,group_type_,music_group_id_,course_schedule_id_,teacher_role_,
 		user_id_,expect_salary_,create_time_,update_time_,subsidy_,actual_salary_,settlement_time_,class_group_id_,
-		reduce_salary,confirm_status_,memo_,enable_change_salary_)
+		reduce_salary,confirm_status_,memo_,enable_change_salary_,tenant_id_)
 		VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{courseScheduleId},
 		#{teacherRole},#{userId},#{expectSalary},now(),now(),#{subsidy},#{actualSalary},#{settlementTime},#{classGroupId},
-		#{reduceSalary},#{confirmStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memo},#{enableChangeSalary})
+		#{reduceSalary},#{confirmStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memo},#{enableChangeSalary},#{tenantId})
 	</insert>
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
 		INSERT INTO course_schedule_teacher_salary (id_,group_type_,music_group_id_,course_schedule_id_,teacher_role_,
 		user_id_,expect_salary_,create_time_,update_time_,subsidy_,actual_salary_,settlement_time_,class_group_id_,
-		reduce_salary,confirm_status_,memo_,enable_change_salary_)
+		reduce_salary,confirm_status_,memo_,enable_change_salary_,tenant_id_)
 		VALUES
 		<foreach collection="list" item="data" separator=",">
 			(#{data.id},#{data.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{data.musicGroupId},#{data.courseScheduleId},
 			#{data.teacherRole},#{data.userId},#{data.expectSalary},now(),now(),#{data.subsidy},#{data.actualSalary},#{data.settlementTime},
 			#{data.classGroupId},#{data.reduceSalary},#{data.confirmStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{data.memo},
-			#{data.enableChangeSalary})
+			#{data.enableChangeSalary},#{data.tenantId})
 		</foreach>
     </insert>
 
@@ -130,7 +131,7 @@
 			<if test="enableChangeSalary != null">
 				enable_change_salary_ = #{enableChangeSalary},
 			</if>
-		</set> WHERE id_ = #{id} 
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 
 	<update id="batchUpdateTeacherExpectSalarys">
@@ -207,18 +208,21 @@
 			<if test="teacherId != null">
 				AND csts.user_id_ = #{teacherId}
 			</if>
+			<if test="tenantId != null">
+				AND csts.tenant_id_ = #{tenantId}
+			</if>
 		</where>
 	</sql>
 
     <!-- 分页查询 -->
 	<select id="queryPage" resultMap="CourseScheduleTeacherSalary" parameterType="map">
-		SELECT * FROM course_schedule_teacher_salary
+		SELECT * FROM course_schedule_teacher_salary where tenant_id_ = #{tenantId}
 		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(id_) FROM course_schedule_teacher_salary
+		SELECT COUNT(id_) FROM course_schedule_teacher_salary where tenant_id_ = #{tenantId}
 	</select>
 
 	<select id="countSalaries" resultType="java.lang.Integer">
@@ -301,7 +305,7 @@
 			course_schedule_teacher_salary csts
 			LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
 			LEFT JOIN vip_group vg ON vg.id_ = cs.music_group_id_
-		WHERE 1=1
+		WHERE csts.tenant_id_ = #{tenantId}
 		<if test="startDate != null">
 			AND cs.class_date_ BETWEEN #{startDate} AND #{endDate}
 		</if>
@@ -309,18 +313,6 @@
 		AND csts.settlement_time_ IS NULL
 		AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
     </select>
-	<select id="findTemp" resultMap="CourseScheduleTeacherSalary">
-		SELECT
-		cs.class_date_,
-		csts.*
-		FROM
-		course_schedule_teacher_salary csts
-		LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
-		WHERE
-		cs.id_ IN (961473)
-		AND csts.settlement_time_ IS NULL
-		AND (cs.del_flag_ IS NULL OR cs.del_flag_=0)
-	</select>
     <select id="findTeacherCourseSalaryNoSettlement" resultMap="CourseScheduleTeacherSalary">
 		SELECT
 		cs.class_date_,
@@ -331,7 +323,7 @@
 		FROM
 			course_schedule_teacher_salary csts
 			LEFT JOIN course_schedule cs ON cs.id_ = csts.course_schedule_id_
-		WHERE 1=1
+		WHERE csts.tenant_id_ = #{tenantId}
 		<if test="startDate != null">
 			AND cs.class_date_ BETWEEN #{startDate} AND #{endDate}
 		</if>
@@ -570,7 +562,7 @@
 				<if test="bean.enableChangeSalary != null">
 					enable_change_salary_ = #{bean.enableChangeSalary},
 				</if>
-			</set> WHERE id_ = #{bean.id}
+			</set> WHERE id_ = #{bean.id} and tenant_id_ = #{bean.tenantId}
 		</foreach>
 	</update>
 
@@ -767,7 +759,7 @@
 		LEFT JOIN organization mgo ON mgo.id_ = mg.organ_id_
 		LEFT JOIN charge_type ct ON ct.id_ = mg.charge_type_id_
 		WHERE cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth} AND cs.`del_flag_` != 1 AND cs.group_type_ = 'MUSIC' AND ts.settlement_time_ IS NOT NULL
-		AND t.is_settlement_salary_ = 1
+		AND t.is_settlement_salary_ = 1 and ts.tenant_id_ = #{tenantId}
 		<if test="courseTypeList != null">
 			and cs.type_ in (#{courseTypeList})
 		</if>
@@ -808,7 +800,7 @@
 		left join vip_group_category vgc on vgc.id_ = vg.vip_group_category_id_
 		WHERE vg.organ_id_ != 41 AND cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth} AND cs.`del_flag_` != 1
 		AND cs.group_type_ = 'VIP' AND ts.settlement_time_ IS NOT NULL
-		AND t.is_settlement_salary_ = 1
+		AND t.is_settlement_salary_ = 1 and ts.tenant_id_ = #{tenantId}
 		<if test="courseTypeList != null">
 			and cs.type_ in (#{courseTypeList})
 		</if>
@@ -848,7 +840,7 @@
 		LEFT JOIN practice_group pg ON (pg.id_ = ts.music_group_id_ AND ts.group_type_ = 'PRACTICE')
 		LEFT JOIN organization pgo ON pgo.id_ = pg.organ_id_
 		WHERE cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth} AND cs.`del_flag_` != 1 AND cs.group_type_ = 'PRACTICE' AND ts.settlement_time_ IS NOT NULL
-		AND t.is_settlement_salary_ = 1
+		AND t.is_settlement_salary_ = 1 and ts.tenant_id_ = #{tenantId}
 		<if test="courseTypeList != null">
 			and cs.type_ in (#{courseTypeList})
 		</if>
@@ -863,7 +855,7 @@
 		left join teacher t on t.id_ = csts.user_id_ 
 		WHERE cs.`group_type_` = 'VIP'
 		  AND csts.settlement_time_ IS NULL
-		  and cs.class_date_ between #{startDate} and #{endDate}
+		  and cs.class_date_ between #{startDate} and #{endDate} and csts.tenant_id_ = #{tenantId}
 	</select>
 
     <select id="isTeacher" resultType="java.lang.Boolean">
@@ -905,7 +897,7 @@
 			(cs.del_flag_ IS NULL OR cs.del_flag_=0)
             AND csts.group_type_!='COMM'
 			AND csts.settlement_time_ IS NOT NULL
-			AND t.is_settlement_salary_ = 1
+			AND t.is_settlement_salary_ = 1 and csts.tenant_id_ = #{tenantId}
 			<if test="teacherId!=null">
 				AND csts.user_id_=#{teacherId}
 			</if>
@@ -1050,7 +1042,7 @@
 		WHERE
 			( cs.del_flag_ IS NULL OR cs.del_flag_ = 0 )
 			AND csts.group_type_!='COMM'
-			AND csts.settlement_time_ IS NOT NULL
+			AND csts.settlement_time_ IS NOT NULL and csts.tenant_id_ = #{tenantId}
 			<if test="teacherId!=null">
 				AND csts.user_id_ = #{teacherId}
 			</if>
@@ -1065,7 +1057,7 @@
         WHERE
         	( cs.del_flag_ IS NULL OR cs.del_flag_ = 0 )
 			AND csts.group_type_!='COMM'
-        	AND csts.settlement_time_ IS NOT NULL
+        	AND csts.settlement_time_ IS NOT NULL and csts.tenant_id_ = #{tenantId}
         	AND DATE_FORMAT( cs.class_date_, '%Y-%m' ) = #{month}
     </select>
 
@@ -1078,7 +1070,7 @@
 		WHERE
 			DATE_FORMAT( cs.class_date_, '%Y-%m' ) = #{month}
 			AND csts.group_type_!='COMM'
-			AND csts.settlement_time_ IS NOT NULL
+			AND csts.settlement_time_ IS NOT NULL and csts.tenant_id_ = #{tenantId}
 			<if test="confirmStatus!=null">
 				AND csts.confirm_status_=#{confirmStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
@@ -1148,7 +1140,7 @@
 		WHERE
 			cs.class_date_ BETWEEN #{startDate} AND #{endDate}
 		  AND ( cs.del_flag_ IS NULL OR cs.del_flag_ = 0 )
-		  AND csts.settlement_time_ IS NOT NULL
+		  AND csts.settlement_time_ IS NOT NULL and csts.tenant_id_ = #{tenantId}
 	</select>
 
     <select id="getTeacherSalaryOverview" resultType="com.ym.mec.biz.dal.dto.TeacherIncomeReviewDto">

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/CoursesGroupMapper.xml

@@ -27,6 +27,7 @@
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="educational_teacher_id_" property="educationalTeacherId" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 
 	<resultMap id="CourseGroupExtendDto" type="com.ym.mec.biz.dal.dto.CourseGroupExtendDto" extends="CoursesGroup">
@@ -44,18 +45,18 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="CoursesGroup">
-		SELECT * FROM courses_group ORDER BY id_
+		SELECT * FROM courses_group where tenant_id_ = #{tanentId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CoursesGroup" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO courses_group (id_,name_,subject_id_,courses_start_date_,courses_end_date_,teaching_arrangement_,
 		organ_id_,single_class_minutes_,status_,memo_,teacher_id_,max_student_num_,apply_closing_date_,
-		teaching_plan_,teacher_salary_settlement_method_,total_courses_price_,total_course_discount_price_,create_time_,update_time_,educational_teacher_id_)
+		teaching_plan_,teacher_salary_settlement_method_,total_courses_price_,total_course_discount_price_,create_time_,update_time_,educational_teacher_id_, tenant_id_)
 		VALUES(#{id},#{name},#{subjectId},#{coursesStartDate},#{coursesEndDate},#{teachingArrangement},
 		#{organId},#{singleClassMinutes},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 		#{memo},#{teacherId},#{maxStudentNum},#{applyClosingDate},#{teachingPlan},#{teacherSalarySettlementMethod},
-		#{totalCoursesPrice},#{totalCourseDiscountPrice},NOW(),NOW(),#{educationalTeacherId})
+		#{totalCoursesPrice},#{totalCourseDiscountPrice},NOW(),NOW(),#{educationalTeacherId},#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -120,7 +121,7 @@
 				single_class_minutes_ = #{singleClassMinutes},
 			</if>
 			update_time_ = NOW()
-		</set> WHERE id_ = #{id}
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	<update id="updateGroupStatus">
 		UPDATE courses_group SET status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} WHERE id_ IN
@@ -136,12 +137,12 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="CoursesGroup" parameterType="map">
-		SELECT * FROM courses_group ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM courses_group where tenant_id_  = #{tenantId} ORDER BY id_ <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM courses_group
+		SELECT COUNT(*) FROM courses_group where tenant_id_ = #{tenantId}
 	</select>
 
     <select id="findTeacherCourseGroups" resultMap="CoursesGroup">

+ 5 - 4
mec-biz/src/main/resources/config/mybatis/CoursesGroupModifyLogDao.xml

@@ -14,6 +14,7 @@
         <result column="previous_group_" property="previousGroup"/>
         <result column="current_group_" property="currentGroup"/>
         <result column="create_time_" property="createTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -23,14 +24,14 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="CoursesGroupModifyLog">
-		SELECT * FROM courses_group_modify_log ORDER BY id_
+		SELECT * FROM courses_group_modify_log where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CoursesGroupModifyLog" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-        INSERT INTO courses_group_modify_log (group_id_,group_type_,operator_id_,previous_group_,current_group_,create_time_)
-        VALUES(#{groupId},#{groupType},#{operatorId},#{previousGroup},#{currentGroup},now())
+        INSERT INTO courses_group_modify_log (group_id_,group_type_,operator_id_,previous_group_,current_group_,create_time_,tenant_id_)
+        VALUES(#{groupId},#{groupType},#{operatorId},#{previousGroup},#{currentGroup},now(),#{tenantId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -53,7 +54,7 @@
                 current_group_ = #{currentGroup},
             </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 根据主键删除一条记录 -->

+ 7 - 6
mec-biz/src/main/resources/config/mybatis/DataChangeLogMapper.xml

@@ -13,6 +13,7 @@
 		<result column="change_info_" property="changeInfo" />
 		<result column="create_time_" property="createTime" />
 		<result column="class_name_" property="className" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -22,13 +23,13 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="DataChangeLog">
-		SELECT * FROM data_change_log ORDER BY id_
+		SELECT * FROM data_change_log where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.DataChangeLog" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO data_change_log (id_,data_id_,operator_id_,change_info_,create_time_,class_name_)
-		VALUES(#{id},#{dataId},#{operatorId},#{changeInfo},NOW(),#{className})
+		INSERT INTO data_change_log (id_,data_id_,operator_id_,change_info_,create_time_,class_name_,tenant_id_)
+		VALUES(#{id},#{dataId},#{operatorId},#{changeInfo},NOW(),#{className},#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -47,7 +48,7 @@
 			<if test="changeInfo != null">
 				change_info_ = #{changeInfo},
 			</if>
-		</set> WHERE id_ = #{id}
+		</set> WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>
 	
 	<!-- 根据主键删除一条记录 -->
@@ -57,11 +58,11 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="DataChangeLog" parameterType="map">
-		SELECT * FROM data_change_log ORDER BY id_ <include refid="global.limit"/>
+		SELECT * FROM data_change_log where tenant_id_ = #{tenantId} ORDER BY id_ <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM data_change_log
+		SELECT COUNT(*) FROM data_change_log where tenant_id_ = #{tenantId}
 	</select>
 </mapper>

+ 5 - 4
mec-biz/src/main/resources/config/mybatis/DegreeLevelFeeMapper.xml

@@ -10,6 +10,7 @@
         <result column="theory_" property="theory"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
     <select id="get" parameterType="java.lang.Integer" resultMap="DegreeLevelFee">
         <!--@mbg.generated-->
@@ -25,8 +26,8 @@
     <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.DegreeLevelFee"
             useGeneratedKeys="true">
         <!--@mbg.generated-->
-        insert into degree_level_fee (level_, grade_, theory_, create_time_, update_time_)
-        values (#{level}, #{grade}, #{theory}, #{createTime}, #{updateTime})
+        insert into degree_level_fee (level_, grade_, theory_, create_time_, update_time_,tenant_id_)
+        values (#{level}, #{grade}, #{theory}, #{createTime}, #{updateTime},#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.DegreeLevelFee">
         <!--@mbg.generated-->
@@ -48,13 +49,13 @@
                 update_time_ = #{updateTime},
             </if>
         </set>
-        where id_ = #{id}
+        where id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
 
     <!-- 全查询 -->
     <select id="getAll" resultMap="DegreeLevelFee">
         SELECT *
-        FROM degree_level_fee
+        FROM degree_level_fee where tenant_id_ = #{tenantId}
         ORDER BY level_ ASC
     </select>
 </mapper>

+ 9 - 8
mec-biz/src/main/resources/config/mybatis/courseScheduleStudentMusicScoreMapper.xml

@@ -21,6 +21,7 @@
         <result column="music_score_name_" property="musicScoreName"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+		<result column="tenant_id_" property="tenantId" />
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -30,20 +31,20 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="CourseScheduleStudentMusicScore">
-		SELECT * FROM course_schedule_student_music_score ORDER BY id_
+		SELECT * FROM course_schedule_student_music_score where tenant_id_ = #{tenantId} ORDER BY id_
 	</select>
 
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentMusicScore" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-        INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,music_score_accompaniment_id_,play_status_,accompaniment_play_status_,speed_,create_time_,update_time_)
-        VALUES(#{courseScheduleId},#{userId},#{userType},#{downStatus},#{musicScoreAccompanimentId},#{playStatus},#{accompanimentPlayStatus},#{speed},now(),now())
+        INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,music_score_accompaniment_id_,play_status_,accompaniment_play_status_,speed_,create_time_,update_time_,tenant_id_)
+        VALUES(#{courseScheduleId},#{userId},#{userType},#{downStatus},#{musicScoreAccompanimentId},#{playStatus},#{accompanimentPlayStatus},#{speed},now(),now(),#{tenantId})
     </insert>
     <insert id="batchInsert">
-        INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,music_score_accompaniment_id_,play_status_,accompaniment_play_status_,speed_,create_time_,update_time_)
+        INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,music_score_accompaniment_id_,play_status_,accompaniment_play_status_,speed_,create_time_,update_time_,tenant_id_)
         VALUE
         <foreach collection="scheduleStudentMusicScores" item="item" separator=",">
-            (#{item.courseScheduleId},#{item.userId},#{item.userType},#{item.downStatus},#{item.musicScoreAccompanimentId},#{item.playStatus},#{item.accompanimentPlayStatus},#{item.speed},now(),now())
+            (#{item.courseScheduleId},#{item.userId},#{item.userType},#{item.downStatus},#{item.musicScoreAccompanimentId},#{item.playStatus},#{item.accompanimentPlayStatus},#{item.speed},now(),now(),#{item.tenantId})
         </foreach>
     </insert>
 
@@ -65,7 +66,7 @@
             </if>
             update_time_ = NOW()
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
     <update id="closePlayStatus">
         UPDATE course_schedule_student_music_score SET play_status_ = 0,accompaniment_play_status_ = 0,update_time_ = NOW()
@@ -100,13 +101,13 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="CourseScheduleStudentMusicScore" parameterType="map">
-        SELECT * FROM course_schedule_student_music_score
+        SELECT * FROM course_schedule_student_music_score where tenant_id_ = #{tenantId}
         <include refid="global.limit" />
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM course_schedule_student_music_score
+		SELECT COUNT(*) FROM course_schedule_student_music_score where tenant_id_ = #{tenantId}
 	</select>
     <select id="queryByScoreIdAndCourseId"
             resultMap="CourseScheduleStudentMusicScore">

+ 0 - 6
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -6,8 +6,6 @@ import org.springframework.web.bind.annotation.GetMapping;
 import com.ym.mec.common.config.FeignConfiguration;
 import com.ym.mec.task.fallback.TaskRemoteServiceFallback;
 
-import java.util.Date;
-
 @FeignClient(name = "web-server", contextId = "TaskRemoteService", configuration = { FeignConfiguration.class }, fallback = TaskRemoteServiceFallback.class)
 public interface TaskRemoteService {
 
@@ -188,10 +186,6 @@ public interface TaskRemoteService {
 	@GetMapping("task/salaryMarkNew")
 	void salaryMarkNew();
 
-	//乐团云教练订单
-	@GetMapping("task/checkCloudOrderStart")
-	void checkCloudOrderStart();
-
 	//同步即时通讯聊天记录
 	@GetMapping("task/syncImHistoryMessageTask")
     void syncImHistoryMessageTask();

+ 0 - 5
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -233,11 +233,6 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 		logger.error("大雅基本工资标记失败");
 	}
 
-	@Override
-	public void checkCloudOrderStart() {
-		logger.error("乐团云教练订单生效处理失败");
-	}
-
     @Override
     public void syncImHistoryMessageTask() {
 		logger.error("同步即时通讯聊天记录失败");

+ 12 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/page/QueryInfo.java

@@ -7,6 +7,8 @@
  */
 package com.ym.mec.common.page;
 
+import com.ym.mec.common.tenant.TenantContextHolder;
+
 /**
  * 查询对象基类
  */
@@ -29,6 +31,8 @@ public class QueryInfo {
 	private String order = "DESC";
 	
 	private String search;
+
+	private Integer tenantId = TenantContextHolder.getTenantId();
 	
 	public String getSearch() {
 		return search;
@@ -85,4 +89,12 @@ public class QueryInfo {
 	public void setOrder(String order) {
 		this.order = order;
 	}
+
+	public Integer getTenantId() {
+		return tenantId;
+	}
+
+	public void setTenantId(Integer tenantId) {
+		this.tenantId = tenantId;
+	}
 }

+ 4 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/service/impl/BaseServiceImpl.java

@@ -11,7 +11,9 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.session.SqlSession;
 import org.apache.ibatis.session.SqlSessionFactory;
@@ -79,6 +81,8 @@ public abstract class BaseServiceImpl<PK extends Serializable, T> implements Bas
 	 * @return
 	 */
 	public List<T> findAll(Map<String, Object> params) {
+		
+		params.put("tenantId", TenantContextHolder.getTenantId());
 		return this.getDAO().findAll(params);
 	}
 

+ 110 - 47
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -1,48 +1,109 @@
 package com.ym.mec.student.controller;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.util.DigestUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.dao.ChildrenDayDegreeDetailDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao;
+import com.ym.mec.biz.dal.dao.DegreeRegistrationDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
+import com.ym.mec.biz.dal.dao.StudentGoodsSellDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.SysCouponCodeDao;
+import com.ym.mec.biz.dal.dao.VipGroupActivityDao;
+import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
+import com.ym.mec.biz.dal.dto.LuckStatisDto;
+import com.ym.mec.biz.dal.dto.OrderStatisDto;
+import com.ym.mec.biz.dal.dto.Practice4OrganDto;
+import com.ym.mec.biz.dal.dto.PracticeGroupStatisDto;
+import com.ym.mec.biz.dal.dto.PracticeGroupsDto;
+import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
+import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
+import com.ym.mec.biz.dal.dto.VipBuyResultDto;
+import com.ym.mec.biz.dal.entity.DegreeRegistration;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.LuckDrawCount;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.entity.SellOrder;
+import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.entity.TenantPaymentOrder;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
-import com.ym.mec.biz.service.*;
+import com.ym.mec.biz.service.CloudTeacherOrderService;
+import com.ym.mec.biz.service.LuckDrawCountService;
+import com.ym.mec.biz.service.MusicGroupService;
+import com.ym.mec.biz.service.SellOrderService;
+import com.ym.mec.biz.service.SporadicChargeInfoService;
+import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.TenantOrderRecordService;
+import com.ym.mec.biz.service.TenantPaymentOrderService;
+import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
 import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.yqpay.Msg;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.DigestUtils;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
 
 @RequestMapping("studentOrder")
 @Api(tags = "订单回调")
@@ -501,17 +562,18 @@ public class StudentOrderController extends BaseController {
     @GetMapping("/getPracticeGroupStatis")
     public HttpResponseResult getPracticeGroupStatis() {
         List<Organization> organs = organizationDao.findAllOrgans();
-        List<PracticeGroupsDto> hasReportNums = courseScheduleEvaluateDao.getHasReportNums();
-        List<PracticeGroupsDto> organMoneys = courseScheduleEvaluateDao.getOrganMoney();
-        List<PracticeGroupsDto> organPracticeGroups = courseScheduleEvaluateDao.getOrganPracticeGroups();
-        List<PracticeGroupsDto> practiceGroupsFrees = courseScheduleEvaluateDao.getPracticeGroupsFree();
-        List<PracticeGroupsDto> practiceGroupsBuys = courseScheduleEvaluateDao.getPracticeGroupsBuy();
-        List<PracticeGroupsDto> practiceGroupsRenews = courseScheduleEvaluateDao.getPracticeGroupsRenew();
+        Integer tenantId = TenantContextHolder.getTenantId();
+        List<PracticeGroupsDto> hasReportNums = courseScheduleEvaluateDao.getHasReportNums(tenantId);
+        List<PracticeGroupsDto> organMoneys = courseScheduleEvaluateDao.getOrganMoney(tenantId);
+        List<PracticeGroupsDto> organPracticeGroups = courseScheduleEvaluateDao.getOrganPracticeGroups(tenantId);
+        List<PracticeGroupsDto> practiceGroupsFrees = courseScheduleEvaluateDao.getPracticeGroupsFree(tenantId);
+        List<PracticeGroupsDto> practiceGroupsBuys = courseScheduleEvaluateDao.getPracticeGroupsBuy(tenantId);
+        List<PracticeGroupsDto> practiceGroupsRenews = courseScheduleEvaluateDao.getPracticeGroupsRenew(tenantId);
 
         Date startTime = DateUtil.getFirstDayOfMonth(new Date());
 
-        List<PracticeGroupsDto> monthOrganBuyMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_BUY, startTime);
-        List<PracticeGroupsDto> monthOrganRenewMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_RENEW, startTime);
+        List<PracticeGroupsDto> monthOrganBuyMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_BUY, startTime, tenantId);
+        List<PracticeGroupsDto> monthOrganRenewMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_RENEW, startTime, tenantId);
 
         //List<PracticeGroupsDto> monthOrganBuyMoneys = courseScheduleEvaluateDao.getOrganNewPracticeGroupsOfMonth(OrderTypeEnum.PRACTICE_GROUP_BUY,startTime);
         //List<PracticeGroupsDto> monthOrganRenewMoneys = courseScheduleEvaluateDao.getOrganNewPracticeGroupsOfMonth(OrderTypeEnum.PRACTICE_GROUP_RENEW,startTime);
@@ -645,38 +707,39 @@ public class StudentOrderController extends BaseController {
     public HttpResponseResult getPracticeStatis() {
         Date nowDate = new Date();
         List<Organization> organs = organizationDao.findAllOrgans();
+        Integer tenantId = TenantContextHolder.getTenantId();
         //除去禁止的体验人数
 //        List<Practice4OrganDto> organTryNums = courseScheduleEvaluateDao.getTryNums();
 //        List<Practice4OrganDto> organPracticeTryNums = courseScheduleEvaluateDao.getPracticeTryNums();
 //        List<Practice4OrganDto> organVipTryNums = courseScheduleEvaluateDao.getVipTryNums();
 //        List<Practice4OrganDto> organPracticeAndVipTryNums = courseScheduleEvaluateDao.getPracticeAndVipTryNums();
-        List<Practice4OrganDto> allTryNums = courseScheduleEvaluateDao.getAllTryNums();
+        List<Practice4OrganDto> allTryNums = courseScheduleEvaluateDao.getAllTryNums(tenantId);
 
-        List<Practice4OrganDto> practiceBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(nowDate, null);
-        List<Practice4OrganDto> vipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(nowDate, null);
+        List<Practice4OrganDto> practiceBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(nowDate, null, tenantId);
+        List<Practice4OrganDto> vipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(nowDate, null, tenantId);
 
-        List<Practice4OrganDto> practiceAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(nowDate, null);
+        List<Practice4OrganDto> practiceAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(nowDate, null, tenantId);
         Date startTime = DateUtil.getFirstDayOfMonth(nowDate);
         Date endTime = DateUtil.addMonths(startTime, 1);
 
 
         //当月新增网管课人数
-        List<PracticeGroupsDto> monthOrganPracticeBuyMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_BUY, startTime);
+        List<PracticeGroupsDto> monthOrganPracticeBuyMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_BUY, startTime, tenantId);
         //当月新增VIP人数
-        List<PracticeGroupsDto> monthOrganVipBuyMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.SMALL_CLASS_TO_BUY, startTime);
+        List<PracticeGroupsDto> monthOrganVipBuyMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.SMALL_CLASS_TO_BUY, startTime, tenantId);
         //当月续费人数
-        List<PracticeGroupsDto> monthOrganRenewMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_RENEW, startTime);
+        List<PracticeGroupsDto> monthOrganRenewMoneys = courseScheduleEvaluateDao.getMonthOrganMoney(OrderTypeEnum.PRACTICE_GROUP_RENEW, startTime, tenantId);
 
         //本月总人数
-        List<Practice4OrganDto> nowMonthPracticeBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(startTime, endTime);
-        List<Practice4OrganDto> nowMonthVipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(startTime, endTime);
-        List<Practice4OrganDto> nowMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(startTime, endTime);
+        List<Practice4OrganDto> nowMonthPracticeBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(startTime, endTime, tenantId);
+        List<Practice4OrganDto> nowMonthVipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(startTime, endTime, tenantId);
+        List<Practice4OrganDto> nowMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(startTime, endTime, tenantId);
 
         //上月总人数
         Date lastMonthStartTime = DateUtil.addMonths(startTime, -1);
-        List<Practice4OrganDto> lastMonthPracticeBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(lastMonthStartTime, startTime);
-        List<Practice4OrganDto> lastMonthVipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(lastMonthStartTime, startTime);
-        List<Practice4OrganDto> lastMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(lastMonthStartTime, startTime);
+        List<Practice4OrganDto> lastMonthPracticeBuyNums = courseScheduleEvaluateDao.getPracticeBuyNums(lastMonthStartTime, startTime, tenantId);
+        List<Practice4OrganDto> lastMonthVipBuyNums = courseScheduleEvaluateDao.getVipBuyNums(lastMonthStartTime, startTime, tenantId);
+        List<Practice4OrganDto> lastMonthPracticeAndVipBuyNums = courseScheduleEvaluateDao.getPracticeAndVipNums(lastMonthStartTime, startTime, tenantId);
 
         List<Practice4OrganDto> practice4Organs = new ArrayList<>();
         for (Organization organ : organs) {

+ 47 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SysTenantConfigController.java

@@ -0,0 +1,47 @@
+package com.ym.mec.student.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.service.SysTenantConfigService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.tenant.TenantContextHolder;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/** 
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysTenantConfig")
+public class SysTenantConfigController extends BaseController {
+
+	@Autowired
+	private SysTenantConfigService sysTenantConfigService;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "queryAll")
+	public Object queryAll(String group) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		Map<String,Object> params = new HashMap<String, Object>(2);
+		params.put("group", group);
+		params.put("tenantId", sysUser.getTenantId());
+		return succeed(sysTenantConfigService.queryAll(params));
+	}
+
+	@ApiOperation(value = "获取单个配置")
+	@PostMapping(value = "findByName")
+	public Object findByName(String configName) {
+		return succeed(sysTenantConfigService.getTenantConfigValue(configName,TenantContextHolder.getTenantId()));
+	}
+}

+ 0 - 19
mec-task/src/main/java/com/ym/mec/task/jobs/CloudTeacherOrderTask.java

@@ -1,19 +0,0 @@
-package com.ym.mec.task.jobs;
-
-import com.ym.mec.task.TaskRemoteService;
-import com.ym.mec.task.core.BaseTask;
-import com.ym.mec.task.core.TaskException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class CloudTeacherOrderTask extends BaseTask {
-
-	@Autowired
-	private TaskRemoteService taskRemoteService;
-
-	@Override
-	public void execute() throws TaskException {
-		taskRemoteService.checkCloudOrderStart();
-	}
-}

+ 48 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SysTenantConfigController.java

@@ -0,0 +1,48 @@
+package com.ym.mec.teacher.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.service.SysTenantConfigService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.tenant.TenantContextHolder;
+import com.yonge.log.model.AuditLogAnnotation;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/** 
+ * 系统配置控制层
+ */
+@RestController
+@Api(tags = "系统参数设置")
+@RequestMapping(value = "sysTenantConfig")
+public class SysTenantConfigController extends BaseController {
+
+	@Autowired
+	private SysTenantConfigService sysTenantConfigService;
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	@ApiOperation(value = "参数列表")
+	@GetMapping(value = "queryAll")
+	public Object queryAll(String group) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		Map<String,Object> params = new HashMap<String, Object>(2);
+		params.put("group", group);
+		params.put("tenantId", sysUser.getTenantId());
+		return succeed(sysTenantConfigService.queryAll(params));
+	}
+
+	@ApiOperation(value = "获取单个配置")
+	@PostMapping(value = "findByName")
+	public Object findByName(String configName) {
+		return succeed(sysTenantConfigService.getTenantConfigValue(configName,TenantContextHolder.getTenantId()));
+	}
+}

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleTeacherSalaryController.java

@@ -69,11 +69,11 @@ public class CourseScheduleTeacherSalaryController extends BaseController {
 
         Map<String, Object> result=new HashMap<>();
         result.put("pageInfo", courseScheduleTeacherSalaryService.findIsSettlementCourseSalarys(queryInfo));
-        int i = courseScheduleTeacherSalaryDao.countOpenConfirmSalarysWithMonth(queryInfo.getMonth(), TeacherSalaryConfirmStatus.UNCONFIRMED);
+        int i = courseScheduleTeacherSalaryDao.countOpenConfirmSalarysWithMonth(queryInfo.getMonth(), TeacherSalaryConfirmStatus.UNCONFIRMED, queryInfo.getTeacherId());
         if(i>0){
             result.put("isOpenConfirm", 1);
         }else{
-            int j = courseScheduleTeacherSalaryDao.countOpenConfirmSalarysWithMonth(queryInfo.getMonth(), null);
+            int j = courseScheduleTeacherSalaryDao.countOpenConfirmSalarysWithMonth(queryInfo.getMonth(), null, queryInfo.getTeacherId());
             if(j<=0){
                 result.put("isOpenConfirm", 2);
             }else{

+ 5 - 1
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -14,11 +14,14 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.IdGeneratorService;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
+
 import java.io.IOException;
 import java.io.OutputStream;
 import java.math.BigDecimal;
@@ -1504,7 +1508,7 @@ public class ExportController extends BaseController {
     @RequestMapping("export/studentVipPractice")
     @PreAuthorize("@pcs.hasPermissions('export/studentVipPractice')")
     public HttpResponseResult exportStudentVipPractice(String organId) throws IOException {
-        boolean hasCourse = courseScheduleStudentPaymentDao.hasCourse(organId);
+        boolean hasCourse = courseScheduleStudentPaymentDao.hasCourse(organId, TenantContextHolder.getTenantId());
         if (!hasCourse) {
             return failed("没有可导出的数据");
         }

+ 0 - 6
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -450,12 +450,6 @@ public class TaskController extends BaseController {
 		}
 	}
 
-	//处理未生效的乐团云教练订单
-	@GetMapping("/checkCloudOrderStart")
-	public void checkCloudOrderStart(){
-		cloudTeacherOrderService.checkCloudOrderStart();
-	}
-
 	//历史异常数据记录
 	@GetMapping("/indexErrDataRecordTask")
 	public void indexErrDataRecordTask(String date){