mybatis 传map中有list类型获取值

json:

 {"cuserid": "000178100000000UC4DN",
"pk_trade": "0001561000000030U9IR",
"fundsetList": [
{"fundtypeCode":"0101","fundsetCode":"010102"},
{"fundtypeCode":"0105","fundsetCode":"010501"}
]}         

mybatis:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nc.sale.mapper.OffetMapper">

<!-- @author lrm  -->
	<sql id="field1">
		pstp.pk_trade as "pk_trade",
		pbfs.vname AS "fundsetName",
		pbfs.vcode as "funtsetCode",
		pstp.nrealmny as "nrealmny",
		pstp.noffsetmny as "noffsetmny",
		pstp.ncansetmny as "ncansetmny",
		
		case to_char(pstp.fcollectstate)
		  when '1' then '收齐'
		    when '2' then '欠收'
		      when '3' then '超收'
		        else ''
		          end as "fcollectstate"
	</sql>
	
	<select id="getOffetInfo" parameterType="java.util.Map" resultType="java.util.Map">
       
        select distinct <include refid="field1"/> 
        from ps_sm_trade_pro pstp

        left join ps_bd_fundset pbfs on pbfs.pk_fundset = pstp.pk_fundset
        left join ps_bd_fundtype pbft on pbft.pk_fundtype = pbfs.pk_fundtype
		
        where pstp.pk_trade = #{pk_trade}
        <if test="fundsetList!=null"> 
        and <!-- ( -->

        <!-- <foreach collection="fundsetList" item="item" separator="," open="(" close=")"> -->

        <foreach collection="fundsetList" item="item" separator="or" open="(" close=")">
        
        <!-- <trim suffixOverrides="or"> -->
        (pbft.vcode = #{item.fundtypeCode} and pbfs.vcode = #{item.fundsetCode} ) <!-- or -->
        <!--  </trim> -->

        </foreach> 
        <!-- ) -->
        </if>
    
    </select>
</mapper>

 

mybatis 传map中有list类型获取值mybatis 传map中有list类型获取值 Colynlin 发布了80 篇原创文章 · 获赞 0 · 访问量 673 私信 关注
上一篇:trade 术语.


下一篇:使用存储过程批量造数