记录:
开始先调用这个
<select id="selectTest" parameterType="com.Estate.vo.FinancialNoticeVo"
resultMap="resultMap">
SELECT
DISTINCT c.CONTRACTINFOID,s.SATGEBEGINTIME
FROM
contractinfo c
INNER JOIN stagedetail s ON c.CONTRACTINFOID = s.CONTRACTINFOID
WHERE
c.CONTRACTINFOID = '98953b49-ad1b-4850-b5e3-1f1bc0af82ad'
AND s.SATGEBEGINTIME = '2018-07-18 08:00:00'
</select>
返回
<collection property="Java属性名" ofType="另一Java类名" javaType="ArrayList" column="关联主键ID(用于嵌套查询SQL语句传入参数,多个用逗号分开)" select="另一个select映射SQL的ID"/>
<resultMap type="com.Estate.vo.FinancialNoticeVo" id="resultMap">
<result column="contractinfoid" property="contractinfoid" />
<result column="satgebegintime" property="satgebegintime" />
<collection property="staList" ofType="com.Estate.model.Stagedetail"
select="selectStadail" column="{time=satgebegintime,id=contractinfoid}" />
</resultMap>
执行下一个sql
<select id="selectStadail" parameterType="java.util.Map"
resultType="com.Estate.model.Stagedetail">
SELECT *
FROM stagedetail
WHERE SATGEBEGINTIME = #{time}
AND CONTRACTINFOID =
#{id}
</select>
保存,以备之后再用