<select id="list" parameterType="domain.AccountQuery" resultMap="baseResult"> SELECT distinct a.id,a.accountId,a.password,a.status,a.platformId,a.createDate,a.lastModifyDate,a.lastLoginTime FROM T_AUTH_ACCOUNT a,T_AUTH_ACCOUNT_EXTENSION e where a.accountId=e.accountId and a.platformId=#{platformId} <if test="accountId != null"> AND a.accountId like '%' || #{accountId} || '%' </if> <if test="roleId != null and groupId == null"> AND a.id in (select accountId from T_TUAH_ACCOUNT_ROLE r where r.roleId=#{roleId}) </if> <if test="groupId != null and roleId == null"> AND a.id in (select accountId from T_AUTH_ACCOUNT_GROUP g where g.groupId=#{groupId}) </if> <if test="roleId != null and groupId != null"> AND a.id in (select r.accountId from T_AUTH_ACCOUNT_GROUP g,T_TUAH_ACCOUNT_ROLE r where r.accountId=g.accountId and r.roleId=#{roleId} and g.groupId=#{groupId}) </if> <if test="accountExts != null"> AND a.accountId in( select accountId from <foreach collection="accountExts" item="ext" separator=" join " index="index"> (select accountId from T_AUTH_ACCOUNT_EXTENSION e1 where e1.propBTypeId = #{ext.propBTypeId} AND e1.propSTypeCode = #{ext.propSTypeCode} AND e1.propValue=#{ext.propValue,jdbcType=VARCHAR}) t${index} <if test="index!=0"> using(accountId) </if> </foreach>) </if> <if test="limit != null"> LIMIT #{limit} </if> <if test="offset != null"> OFFSET #{offset} </if> </select>
MyBatis-foreach
猜你喜欢
转载自tiamo.iteye.com/blog/1705797
今日推荐
周排行