|  | @@ -21,6 +21,32 @@
 | 
	
		
			
				|  |  |  		<result column="demission_date_" property="demissionDate" />
 | 
	
		
			
				|  |  |  		<result column="contact_address_" property="contactAddress" />
 | 
	
		
			
				|  |  |  		<result column="postal_code_" property="postalCode" />
 | 
	
		
			
				|  |  | +		<result column="role_name_" property="roleName" />
 | 
	
		
			
				|  |  | +		<result column="del_flag_" property="delFlag" />
 | 
	
		
			
				|  |  | +		<association property="sysUser" javaType="com.keao.edu.auth.api.entity.SysUser">
 | 
	
		
			
				|  |  | +			<result column="id_" property="id"/>
 | 
	
		
			
				|  |  | +			<result column="username_" property="username"/>
 | 
	
		
			
				|  |  | +			<result column="real_name_" property="realName"/>
 | 
	
		
			
				|  |  | +			<result column="password_" property="password"/>
 | 
	
		
			
				|  |  | +			<result column="salt_" property="salt"/>
 | 
	
		
			
				|  |  | +			<result column="phone_" property="phone"/>
 | 
	
		
			
				|  |  | +			<result column="avatar_" property="avatar"/>
 | 
	
		
			
				|  |  | +			<result column="create_time_" property="createTime"/>
 | 
	
		
			
				|  |  | +			<result column="update_time_" property="updateTime"/>
 | 
	
		
			
				|  |  | +			<result column="lock_flag_" property="lockFlag"/>
 | 
	
		
			
				|  |  | +			<result column="del_flag_" property="delFlag"/>
 | 
	
		
			
				|  |  | +			<result column="wx_openid_" property="wxOpenid"/>
 | 
	
		
			
				|  |  | +			<result column="qq_openid_" property="qqOpenid"/>
 | 
	
		
			
				|  |  | +			<result column="user_type_" property="userType"/>
 | 
	
		
			
				|  |  | +			<result column="gender_" property="gender"/>
 | 
	
		
			
				|  |  | +			<result column="nation_" property="nation"/>
 | 
	
		
			
				|  |  | +			<result column="birthdate_" property="birthdate"/>
 | 
	
		
			
				|  |  | +			<result column="email_" property="email"/>
 | 
	
		
			
				|  |  | +			<result column="im_token_" property="imToken"/>
 | 
	
		
			
				|  |  | +			<result column="id_card_no_" property="idCardNo"/>
 | 
	
		
			
				|  |  | +			<result column="wechat_id_" property="wechatId"/>
 | 
	
		
			
				|  |  | +			<result column="is_super_admin_" property="isSuperAdmin"/>
 | 
	
		
			
				|  |  | +		</association>
 | 
	
		
			
				|  |  |  	</resultMap>
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 根据主键查询一条记录 -->
 | 
	
	
		
			
				|  | @@ -35,11 +61,6 @@
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 向数据库增加一条记录 -->
 | 
	
		
			
				|  |  |  	<insert id="insert" parameterType="com.keao.edu.user.entity.Employee" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | -		<!--
 | 
	
		
			
				|  |  | -		<selectKey resultClass="int" keyProperty="id" > 
 | 
	
		
			
				|  |  | -		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
 | 
	
		
			
				|  |  | -		</selectKey>
 | 
	
		
			
				|  |  | -		-->
 | 
	
		
			
				|  |  |  		INSERT INTO employee (user_id_,job_nature_,education_background_,graduate_school_,technical_titles_,entry_date_,
 | 
	
		
			
				|  |  |  		certificate_type_,certificate_num_,update_time_,create_time_,introduction_,demission_date_,contact_address_,postal_code_)
 | 
	
		
			
				|  |  |  		VALUES(#{userId},#{jobNature},#{educationBackground},#{graduateSchool},#{technicalTitles},#{entryDate},#{certificateType},
 | 
	
	
		
			
				|  | @@ -93,82 +114,44 @@
 | 
	
		
			
				|  |  |  		</if>
 | 
	
		
			
				|  |  |  		</set> WHERE user_id_ = #{userId}
 | 
	
		
			
				|  |  |  	</update>
 | 
	
		
			
				|  |  | -    <update id="batchAddEmployeeRole">
 | 
	
		
			
				|  |  | +    <insert id="batchAddEmployeeRole">
 | 
	
		
			
				|  |  |  		INSERT INTO sys_user_role(user_id_,role_id_) values
 | 
	
		
			
				|  |  |  		<foreach collection="roles" item="item" index="index" separator=",">
 | 
	
		
			
				|  |  |  			(#{userId},#{item})
 | 
	
		
			
				|  |  |  		</foreach>
 | 
	
		
			
				|  |  | +	</insert>
 | 
	
		
			
				|  |  | +	<!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  | +	<update id="delete" >
 | 
	
		
			
				|  |  | +		UPDATE employee SET del_flag_ = 0,update_time_ = NOW() WHERE user_id_ = #{userId}
 | 
	
		
			
				|  |  |  	</update>
 | 
	
		
			
				|  |  | -	<update id="updateUser" parameterType="com.keao.edu.auth.api.entity.SysUser">
 | 
	
		
			
				|  |  | -		UPDATE sys_user
 | 
	
		
			
				|  |  | -		<set>
 | 
	
		
			
				|  |  | -			<if test="delFlag != null">
 | 
	
		
			
				|  |  | -				del_flag_ = #{delFlag, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="wxOpenid != null">
 | 
	
		
			
				|  |  | -				wx_openid_ = #{wxOpenid},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="password != null">
 | 
	
		
			
				|  |  | -				password_ = #{password},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="avatar != null">
 | 
	
		
			
				|  |  | -				avatar_ = #{avatar},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="email != null">
 | 
	
		
			
				|  |  | -				email_ = #{email},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="gender != null">
 | 
	
		
			
				|  |  | -				gender_ = #{gender},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="salt != null">
 | 
	
		
			
				|  |  | -				salt_ = #{salt},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="username != null">
 | 
	
		
			
				|  |  | -				username_ = #{username},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="realName != null">
 | 
	
		
			
				|  |  | -				real_name_ = #{realName},
 | 
	
		
			
				|  |  | +	<sql id="employeeQueryPage">
 | 
	
		
			
				|  |  | +		<where>
 | 
	
		
			
				|  |  | +				e.del_flag_ = 1
 | 
	
		
			
				|  |  | +			<if test="search != null and search != ''">
 | 
	
		
			
				|  |  | +				AND (e.user_id_ = #{search} OR su.phone_ LIKE CONCAT('%',#{search},'%') OR su.real_name_ LIKE CONCAT('%',#{search},'%'))
 | 
	
		
			
				|  |  |  			</if>
 | 
	
		
			
				|  |  | -			<if test="userType != null">
 | 
	
		
			
				|  |  | -				user_type_ = #{userType},
 | 
	
		
			
				|  |  | +			<if test="roleId != null">
 | 
	
		
			
				|  |  | +				AND sur.role_id_ = #{roleId}
 | 
	
		
			
				|  |  |  			</if>
 | 
	
		
			
				|  |  | -			<if test="updateTime != null">
 | 
	
		
			
				|  |  | -				update_time_ = NOW(),
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="lockFlag != null">
 | 
	
		
			
				|  |  | -				lock_flag_ = #{lockFlag},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="birthdate != null">
 | 
	
		
			
				|  |  | -				birthdate_ = #{birthdate},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="phone != null">
 | 
	
		
			
				|  |  | -				phone_ = #{phone},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="qqOpenid != null">
 | 
	
		
			
				|  |  | -				qq_openid_ = #{qqOpenid},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="nation != null">
 | 
	
		
			
				|  |  | -				nation_ = #{nation},
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -			<if test="imToken != null">
 | 
	
		
			
				|  |  | -				im_token_ = #{imToken}
 | 
	
		
			
				|  |  | -			</if>
 | 
	
		
			
				|  |  | -		</set>
 | 
	
		
			
				|  |  | -		WHERE id_ = #{id}
 | 
	
		
			
				|  |  | -	</update>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	<!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  | -	<delete id="delete" >
 | 
	
		
			
				|  |  | -		DELETE FROM employee WHERE user_id_ = #{userId} 
 | 
	
		
			
				|  |  | -	</delete>
 | 
	
		
			
				|  |  | +		</where>
 | 
	
		
			
				|  |  | +	</sql>
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 分页查询 -->
 | 
	
		
			
				|  |  |  	<select id="queryPage" resultMap="Employee" parameterType="map">
 | 
	
		
			
				|  |  | -		SELECT * FROM employee ORDER BY user_id_ <include refid="global.limit"/>
 | 
	
		
			
				|  |  | +		SELECT su.*,e.*,GROUP_CONCAT(sr.role_name_) role_name_ FROM employee e
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_user su ON e.user_id_ = su.id_
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_user_role sur ON sur.user_id_ = su.id_
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_role sr ON sr.id_ = sur.role_id_
 | 
	
		
			
				|  |  | +		<include refid="employeeQueryPage"/>
 | 
	
		
			
				|  |  | +		GROUP BY e.user_id_
 | 
	
		
			
				|  |  | +		ORDER BY e.user_id_ <include refid="global.limit"/>
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  |  	<!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  |  	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  | -		SELECT COUNT(*) FROM employee
 | 
	
		
			
				|  |  | +		SELECT COUNT(DISTINCT e.user_id_) FROM employee e
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_user su ON e.user_id_ = su.id_
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_user_role sur ON sur.user_id_ = su.id_
 | 
	
		
			
				|  |  | +		<include refid="employeeQueryPage"/>
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  |  </mapper>
 |