ssm 多行数据提交到数据库

图片说明

看这个

        <foreach collection="relationMap" index="key"  item="ent" separator="union">
            SELECT *
            FROM BPM_DEF_USER
            where  RIGHT_TYPE=#{key}
            and OWNER_ID in 
            <foreach collection="ent"  item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </foreach>

</select>

提交一个对象集合到后台dao接口,通过xml文件遍历集合 在插入数据库

jquery,提交的时候,把这些数据存到对应的数组里面,后台用string[] 接受,遍历这些数组,查到数据库里;

在service层写一个保存对象集合的方法,把对象集合传递到action,然后调用service里的方法


select *
from EMPLOYEES e


e.DEPARTMENT_ID=#{departmentId}


AND e.EMPLOYEE_ID in
index="index" open="(" close=")" separator=",">
#{employeeId}