<?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.nbclass.activity.mapper.WxDepartmentMapper">
	
	<insert id="insertBatch" parameterType="java.util.List">
		insert into wx_department (id, `name`, parentid, `order`) 
		values 
		<foreach item="o" collection="list"  separator="," >
			(#{o.id}, #{o.name}, #{o.parentid}, #{o.order}) 
		</foreach>
		ON DUPLICATE KEY UPDATE `name` = VALUES(name), parentid = VALUES(parentid), `order` = VALUES(`order`)
	</insert>
	
	<select id="getChildDeptIds" parameterType="java.lang.Integer" resultType="java.lang.String">
		select getChildDeptIds(#{parentid})
	</select>
	
</mapper>