Ibatis.net 属性字段中使用 IN 查询条件

时间:2022-12-15 21:42:25
 <!--查找用户权限-->
    <select id="FindStaffpermission" parameterClass="RolePermissionCondition" resultClass="ActStaffpermissionVW">
      SELECT sp.st_id AS StId,
      sp.rl_id AS RlId,
      rl.rl_name AS RoleName
      FROM act_staffpermission sp
      INNER JOIN act_role rl ON sp.rl_id = rl.rl_id
      WHERE 1=1
      <isGreaterThan property="UserId" compareValue="0">
        AND sp.st_id = #UserId#
      </isGreaterThan>
      <isNotEmpty property="WarehouseIds">
        AND rl.warehouse_id IN 
        <iterate open="(" close=")" conjunction="," property="WarehouseIds">
          #WarehouseIds[]#
        </iterate>
      </isNotEmpty>
    </select>