<?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="WxUserMapper">
	<select id="selectById" resultType="WxUser">
		select * from wx_user where userId=#{userId}
	</select>

	<insert id="save">
		insert into wx_user(userId,name,departId,firstDepartName,firstDepartId,
			secondDepartName,secondDepartId,sapExists,delFlag) 
		values (#{userId},#{name},#{departId},#{firstDepartName},#{firstDepartId},
			#{secondDepartName},#{secondDepartId},'0','0')
	</insert>
	
	<update id="updateAllDelete">
		update wx_user set delFlag=1
	</update>
	
	<update id="update">
		update wx_user 
		set name=#{name},departId=#{departId},firstDepartName=#{firstDepartName},
			firstDepartId=#{firstDepartId},secondDepartName=#{secondDepartName},
			secondDepartId=#{secondDepartId},delFlag=0
		where userId=#{userId}
	</update>
	
	<select id="selectAllUserIds" resultType="String">
		SELECT userId from wx_user where delFlag=0
	</select>
</mapper>