相关文章推荐
奋斗的机器人  ·  Unity ...·  1 年前    · 
沉稳的麻辣香锅  ·  cmap=cm.coolwarm-掘金·  1 年前    · 
没有腹肌的弓箭  ·  c# ...·  1 年前    · 
读研的红薯  ·  【问题解决】Error: ...·  1 年前    · 
小胡子的石榴  ·  python - TypeError at ...·  1 年前    · 


1、mapper文件中:

List<Object> getXXXXX(@Param("taskId")String taskId,@Param("taskType")String taskType);

2、xml文件中

<select id="" resultMap="" >

select tst.id subTaskId,......

from ......

</select>

<resultMap type="" id="">
<id property="id" column=""/>
<result property="" column=""/>
.....

<collection property="返回结果的key,对应实体内的字段" ofType="这里是查询返回的类型"
column="{subTaskId=subTaskId,taskType=taskType}" select="getVails"/>
</resultMap>

<select id="getVails" parameterType="java.util.Map" resultType="">
<choose>
<when test="taskType == '6'.toString">
SELECT .......
from ......
where
xxxxx = #{subTaskId}
</when>
<otherwise>
SELECT ......
from ......
where
xxxx = #{subTaskId}
</otherwise>
</choose>
</select>

重点是   column="{subTaskId=subTaskId,taskType=taskType}"    这句

和   parameterType="java.util.Map"  这句

注意:在这里省略了很多不必要的东西,不必介意,只需要看重点就好,如果有什么问题,可留言,我回及时回答的