| 
					
				 | 
			
			
				@@ -71,6 +71,18 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         VALUES(#{isSuperAdmin},#{imToken},#{id},#{username},#{salt},#{phone},#{avatar},#{organId},now(),now(),#{wxOpenid},#{qqOpenid},#{userType}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #{gender},#{nation},#{birthdate},#{email},#{idCardNo},#{wechatId},#{realName}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <insert id="insertTeacher"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        INSERT INTO teacher 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        (id_,organ_id_,create_time_,update_time_)VALUES(#{userId},#{lesseeOrganId},NOW(),NOW()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <insert id="insertSysTenantAccount"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        INSERT INTO sys_tenant_account 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        (user_id_,available_minutes_,frozen_minutes_,status_,create_time_,update_time_) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		VALUES(#{userId},0,0,1,NOW(),NOW()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <insert id="saveStudent"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        INSERT INTO student (user_id_,create_time_,update_time_) VALUES(#{userId},NOW(),NOW()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 根据主键查询一条记录 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <update id="update" parameterType="com.ym.mec.auth.api.entity.SysUser"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -142,11 +154,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         WHERE id_ = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <update id="updatePassword"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         UPDATE sys_user SET password_ = #{password} WHERE phone_ = #{mobile} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <update id="refreshImToken"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         UPDATE sys_user SET im_token_ = #{imToken},update_time_ = NOW() WHERE id_ = #{userId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </update> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -177,19 +187,25 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="queryByPhone" resultMap="SysUser"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		select * from sys_user where phone_ = #{phone} OR username_ = #{phone} LIMIT 1 FOR UPDATE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <resultMap id="ImUserModel" type="com.ym.mec.common.entity.ImUserModel"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result column="id_" property="id"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result property="name" column="username_"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result property="portrait" column="avatar_"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </resultMap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="getBasic" resultMap="ImUserModel"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        select CASE WHEN user_type_ LIKE '%TEACHER%' OR user_type_ LIKE '%SYSTEM%' THEN real_name_ ELSE username_ END username_,id_,avatar_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from sys_user where id_ = #{userId} LIMIT 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="queryByStatus" resultMap="SysUser"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         select * from sys_user where lock_flag_ = #{status} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="getTeacherOrganId" resultType="java.lang.Integer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SELECT organ_id_ FROM teacher WHERE id_ = #{userId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="queryByPhoneAndClient" resultMap="SysUser"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         select * from sys_user where (phone_ = #{phone} OR username_ = #{phone}) AND user_type_ LIKE CONCAT('%',#{client},'%') LIMIT 1 FOR UPDATE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 |