Java 如何在IBATIS的迭代中使用select语句?

Java 如何在IBATIS的迭代中使用select语句?,java,mysql,spring,spring-mvc,ibatis,Java,Mysql,Spring,Spring Mvc,Ibatis,MySQL查询如下 update group_entity set deleted = 1 where entity_id in (select entity_id from entity where entity_row_id in ('1-424g','1-242T') and entity_type='Data'); <update id="updateData" parameterClass="abc.data.updateDataParameters"> up

MySQL查询如下

update  group_entity set deleted = 1  where entity_id in (select entity_id from entity where entity_row_id in ('1-424g','1-242T') and entity_type='Data');
<update id="updateData" parameterClass="abc.data.updateDataParameters">
    update group_entity set deleted = 1 where entity_id in
    <iterate open="(" close=")" conjunction=",">
        select entity_id from entity where entity_row_id in
         <iterate property="parentIds" open="(" close=")" conjunction=",">
            #parentIds[]#
        </iterate>
        and entity_type = #parentType#
    </iterate>
</update>
此查询在mysql中运行

我的Ibatis查询及其更改如下

update  group_entity set deleted = 1  where entity_id in (select entity_id from entity where entity_row_id in ('1-424g','1-242T') and entity_type='Data');
<update id="updateData" parameterClass="abc.data.updateDataParameters">
    update group_entity set deleted = 1 where entity_id in
    <iterate open="(" close=")" conjunction=",">
        select entity_id from entity where entity_row_id in
         <iterate property="parentIds" open="(" close=")" conjunction=",">
            #parentIds[]#
        </iterate>
        and entity_type = #parentType#
    </iterate>
</update>
请告诉我如何在迭代中使用select语句,比如从返回id列表的表中选择id

我的更新数据参数

class updateDataParameters
{
List<String> parentId;
string parentType;
// with getter and setter and receptive constructor  
}

第一个迭代元素不是必需的。 您的请求应该是:

<update id="updateData" parameterClass="abc.data.updateDataParameters">
    update group_entity set deleted = 1 where entity_id in (
        select entity_id from entity where entity_row_id in
        <iterate property="parentId" open="(" close=")" conjunction=",">
            #parentId[]#
        </iterate>
        ) and entity_type = #parentType#
</update>
还有一个输入错误:parentId应该是parentId以匹配类属性