mybatis 之parameterType="Long"
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis 之parameterType="Long"相关的知识,希望对你有一定的参考价值。
<select id="selectByPrimaryKeyByArrayMemberId" resultType="memberModel" parameterType="Long"> select <include refid="Base_Column_List"/> from member m where m.IS_DELETE = ‘N‘ and m.member_id IN <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> #{item,jdbcType=DECIMAL} </foreach> </select>
public ServiceMessage<List<Member>> selectByPrimaryKeyByArrayMemberId( List<Long> memberIds) { try { if (memberIds == null || memberIds.size()==0){ return super.returnParamsError("参数为空!"); } List<Member> list = memberMapper .selectByPrimaryKeyByArrayMemberId(memberIds); return super.returnCorrectResult(list); } catch (Throwable e) { return super.returnException(e); } }
public ServiceMessage<List<Member>> selectByPrimaryKeyByArrayMemberId(List<Long> memberIds);
List<Member> selectByPrimaryKeyByArrayMemberId(List<Long> memberIds);
@Test public void testSelectByPrimaryKeyByArrayMemberId() { InternalMemberService internalMemberService = J1SOAHessianHelper.getService(url,InternalMemberService.class); List<Long> memberIds = new ArrayList<Long>(); memberIds.add(1l); memberIds.add(2l); memberIds.add(1855l); ServiceMessage<List<Member>> sm = internalMemberService.selectByPrimaryKeyByArrayMemberId(memberIds); System.out.println(sm.getResult()); }
以上是关于mybatis 之parameterType="Long"的主要内容,如果未能解决你的问题,请参考以下文章
MyBatis应用开发映射之参数绑定parameterType
mybatis 之 parameterType="List" 2