<select id="selectLatestTemplateByVolume" parameterType="String" resultMap="ccpAsyncJobResultMap">
<bind name="jobCmdInfo" value="'volumeId":"'+_parameter+'"'" /><!-- volumeId":_parameter" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
如果傳入是個map ( accountId=1, volumeUuid="123123123")
寫法又不太一樣
<select id="selectLatestTemplateByVolume" parameterType="Map" resultMap="ccpAsyncJobResultMap">
<bind name="jobCmdInfo" value="'volumeId":"'+volumeUuid+'"'" /><!-- volumeId":#{volumeUuid}" -->
SELECT * FROM cloud.async_job
where instance_type='Template'
and job_cmd='org.apache.cloudstack.api.command.user.template.CreateTemplateCmd'
<![CDATA[ and instr(job_cmd_info,#{jobCmdInfo})>0 ]]>
order by id desc
limit 1
</select>
沒有留言:
張貼留言