zouxuan 5 年 前
コミット
e0dc994a0e

+ 14 - 3
edu-auth/edu-auth-server/src/main/resources/config/mybatis/SysRoleMapper.xml

@@ -24,7 +24,11 @@
 
     <!-- 全查询 -->
     <select id="findAll" resultMap="SysRole">
-		SELECT * FROM sys_role WHERE del_flag_ = 0 AND tenant_id_ = #{tenantId} ORDER BY upate_time_ DESC
+		SELECT * FROM sys_role WHERE del_flag_ = 0
+        <if test="tenantId != null and tenantId != 0">
+            AND tenant_id_ = #{tenantId}
+        </if>
+		ORDER BY upate_time_ DESC
 	</select>
 
     <!-- 向数据库增加一条记录 -->
@@ -65,13 +69,20 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="SysRole" parameterType="map">
-        SELECT * FROM sys_role WHERE del_flag_ = 0 AND tenant_id_ = #{tenantId} ORDER BY update_time_ DESC
+        SELECT * FROM sys_role WHERE del_flag_ = 0
+        <if test="tenantId != null and tenantId != 0">
+            AND tenant_id_ = #{tenantId}
+        </if>
+        ORDER BY update_time_ DESC
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_role WHERE del_flag_ = 0 AND tenant_id_ = #{tenantId}
+		SELECT COUNT(*) FROM sys_role WHERE del_flag_ = 0
+        <if test="tenantId != null and tenantId != 0">
+            AND tenant_id_ = #{tenantId}
+        </if>
 	</select>
 
     <select id="findRoleByUserId" resultMap="SysRole">

+ 8 - 4
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamOrganizationRelationMapper.xml

@@ -166,14 +166,16 @@
 
 	<sql id="queryCondition">
 		<where>
-			ear.tenant_id_=#{tenantId}
-			AND ear.examination_basic_id_=#{examId}
+			ear.examination_basic_id_=#{examId}
 			<if test="organIds!=null">
 				AND ear.organ_id_ IN
 				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
 					#{organId}
 				</foreach>
 			</if>
+			<if test="tenantId != null and tenantId != 0">
+				AND ear.tenant_id_ = #{tenantId}
+			</if>
 			<if test="settlementType!=null">
 				AND ear.settlement_type_=#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
 			</if>
@@ -269,9 +271,11 @@
 
 	<sql id="queryUnRelatedOrgansCondition">
 		<where>
-			o.tenant_id_ = #{tenantId}
+			<if test="tenantId != null and tenantId != 0">
+				AND o.tenant_id_ = #{tenantId}
+			</if>
 			<if test="organIds!=null">
-				o.id_ IN
+				AND o.id_ IN
 				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
 					#{organId}
 				</foreach>

+ 4 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamSongMapper.xml

@@ -75,7 +75,10 @@
 
 	<sql id="queryCondition">
 		<where>
-			es.del_flag_=0 AND es.tenant_id_ = #{tenantId}
+			es.del_flag_ = 0
+			<if test="tenantId != null and tenantId != 0">
+				AND es.tenant_id_ = #{tenantId}
+			</if>
 			<if test="subjectList!=null">
 				AND FIND_IN_SET(#{subjectList}, es.subject_list_)
 			</if>

+ 7 - 8
edu-user/edu-user-server/src/main/resources/config/mybatis/MusicTheoryMapper.xml

@@ -26,7 +26,10 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="MusicTheory">
-		SELECT <include refid="Base_Column_List"/> FROM music_theory WHERE tenant_id_ = #{tenantId} ORDER BY id_
+		SELECT <include refid="Base_Column_List"/>
+		FROM music_theory
+		<include refid="queryCondition"/>
+		ORDER BY id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->
@@ -65,13 +68,9 @@
 
 	<sql id="queryCondition">
 		<where>
-			1=1 AND tenant_id_ = #{tenantId}
-			<!--<if test="subjectList!=null">-->
-				<!--AND FIND_IN_SET(#{subjectList}, subject_list_)-->
-			<!--</if>-->
-			<!--<if test="search!=null">-->
-				<!--AND (id_=#{search} OR song_name_ LIKE CONCAT('%', #{search}, '%'))-->
-			<!--</if>-->
+			<if test="tenantId != null and tenantId != 0">
+				tenant_id_ = #{tenantId}
+			</if>
 		</where>
 	</sql>
 

+ 10 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/OrganizationMapper.xml

@@ -102,10 +102,19 @@
 
 	<sql id="organQueryPage">
 		<where>
-			del_flag_ = 0 AND tenant_id_ = #{tenantId}
+			del_flag_ = 0
 			<if test="settlementType != null and settlementType != ''">
 				AND settlement_type_ = #{settlementType}
 			</if>
+			<if test="tenantId != null and tenantId != 0">
+				AND tenant_id_ = #{tenantId}
+			</if>
+			<if test="organIds != null">
+				AND id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 			<if test="isAllowArrangeExam != null">
 				AND is_allow_arrange_exam_ = #{isAllowArrangeExam}
 			</if>

+ 3 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/StudentMapper.xml

@@ -11,7 +11,6 @@
 		<result column="certificate_photo_" property="certificatePhoto" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
-		<result column="tenant_id_" property="tenantId" />
 		<result column="organ_id_" property="organId" />
 		<association property="sysUser" resultMap="com.keao.edu.user.dao.SysUserDao.SysUser"/>
 	</resultMap>
@@ -56,7 +55,9 @@
 
 	<sql id="queryCondition">
 		<where>
-			stu.tenant_id_ = #{tenantId}
+			<if test="tenantId != null and tenantId != 0">
+				AND stu.tenant_id_ = #{tenantId}
+			</if>
 			<if test="search != null and search != ''">
 				AND (stu.user_id_ = #{search} OR su.real_name_ LIKE CONCAT (#{search}, '%'))
 			</if>

+ 3 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -93,7 +93,9 @@
     </select>
 
     <select id="queryNameByIds" resultType="java.util.Map">
-        select id_ `key`,name_ `value` FROM `subject` s WHERE FIND_IN_SET(s.id_,#{subjectIds}) AND s.del_flag_ = 0 AND tenant_id_ = #{tenantId}
+        select id_ `key`,name_ `value` FROM `subject` s
+        WHERE FIND_IN_SET(s.id_,#{subjectIds}) AND s.del_flag_ = 0
+        AND tenant_id_ = #{tenantId}
     </select>
 
     <select id="findSubSubjects" resultMap="Subject">

+ 13 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/SysConfigMapper.xml

@@ -73,15 +73,26 @@
 		DELETE FROM sys_config WHERE id_ = #{id}
 	</delete>
 
+	<sql id="queryPageSql">
+		<where>
+			<if test="tenantId != null and tenantId != 0">
+				tenant_id_ = #{tenantId}
+			</if>
+		</where>
+	</sql>
+
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysConfig" parameterType="map">
-		SELECT * FROM sys_config WHERE tenant_id_ = #{tenantId} ORDER BY id_
+		SELECT * FROM sys_config
+		<include refid="queryPageSql"/>
+		ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_config WHERE tenant_id_ = #{tenantId}
+		SELECT COUNT(*) FROM sys_config
+		<include refid="queryPageSql"/>
 	</select>
 	
 	<select id="findByParamName" resultMap="SysConfig">

+ 10 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -84,12 +84,21 @@
 	</update>
 	<sql id="teacherQueryPage">
 		<where>
-			t.del_flag_ = 0 AND FIND_IN_SET(#{tenantId},t.tenant_id_)
+			t.del_flag_ = 0
 			<if test="search != null and search != ''">
 				AND (t.user_id_ = #{search}
 				OR su.real_name_ LIKE CONCAT('%',#{search},'%')
 				OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			</if>
+			<if test="tenantId != null and tenantId != 0">
+				AND t.tenant_id_ = #{tenantId}
+			</if>
+			<if test="organIds != null">
+				AND t.organ_id_ IN
+				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+					#{organId}
+				</foreach>
+			</if>
 			<if test="settlementType != null and settlementType != ''">
 				AND t.salary_settlement_type_ = #{settlementType}
 			</if>