| 
					
				 | 
			
			
				@@ -0,0 +1,129 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<?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.keao.edu.user.dao.SubjectDao"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <resultMap type="com.keao.edu.user.entity.Subject" id="Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="id_" property="id"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="name_" property="name"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="code_" property="code"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="parent_subject_id_" property="parentSubjectId"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="img_" property="img"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="create_time_" property="createTime"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="update_time_" property="updateTime"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </resultMap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 根据主键查询一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="get" resultMap="Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT * FROM subject WHERE id_ = #{id}  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 全查询 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="findAll" resultMap="Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT * FROM subject ORDER BY id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 向数据库增加一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <insert id="insert" parameterType="com.keao.edu.user.entity.Subject" useGeneratedKeys="true" keyColumn="id" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            keyProperty="id"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        INSERT INTO subject (id_,name_,code_,parent_subject_id_,img_,create_time_,update_time_,tenant_id_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        VALUES(#{id},#{name},#{code},#{parentSubjectId},#{img},now(),now(),#{tenantId}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 根据主键查询一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <update id="update" parameterType="com.keao.edu.user.entity.Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        UPDATE subject 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="delFlag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                del_flag_ = #{delFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="parentSubjectId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                parent_subject_id_ = #{parentSubjectId}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="code != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                code_ = #{code}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="img != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                img_ = #{img}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="updateTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                update_time_ = NOW(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="name != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                name_ = #{name}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE id_ = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 根据主键删除一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <update id="delete"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        UPDATE `subject` SET del_flag_ = 1 WHERE id_ = #{id} OR parent_subject_id_ = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 分页查询 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="queryPage" resultMap="Subject" parameterType="map"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT * FROM subject 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <include refid="querySubPageSql"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ORDER BY id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <include refid="global.limit"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 查询当前表的总记录数 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="queryCount" resultType="int"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		SELECT COUNT(*) FROM subject <include refid="querySubPageSql"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="findByParentId" resultMap="Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT * FROM subject <include refid="querySubPageSql"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="findBySubIds" resultType="string"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT name_ FROM `subject` WHERE del_flag_ = 0 AND FIND_IN_SET (id_,#{subIds}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="findSubSubjects" resultMap="Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT * FROM `subject` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE parent_subject_id_ != 0 AND del_flag_ = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="tenantId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND tenant_id_ = #{tenantId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <sql id="querySubPageSql"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="parentId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                AND parent_subject_id_ = #{parentId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="tenantId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                AND tenant_id_ = #{tenantId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="delFlag != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                AND del_flag_ = #{delFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="findBySubjectByIdList" resultMap="Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT * FROM `subject` WHERE del_flag_ = 0 AND FIND_IN_SET(id_,#{subjectIdList}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="findNames" resultType="java.lang.String"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT GROUP_CONCAT(DISTINCT s.name_) FROM `subject` s WHERE FIND_IN_SET(s.id_,#{subjectIdList}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="findBySubjectIds" resultMap="Subject"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      SELECT * FROM subject WHERE id_ IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <foreach collection="subjectIds" item="subjectId" separator="," open="(" close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          #{subjectId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</mapper> 
			 |