<select id="listCompleted" resultType="java.util.HashMap"> SELECT distinct wp.id as processinstId,DATE_FORMAT(wp.gmtCreatedOn,'%Y-%m-%d %H:%i:%s') as startDate ,DATE_FORMAT(wp.endDate,'%Y-%m-%d %H:%i:%s') as endDate,wp.businessId as docId,wp.gmtVersion,wp.`status` as wf_status ,wp.gmtCreatedOn ,arm.META_INFO_ as metaInfo,arm.NAME_ as `name` FROM wf_processinst wp LEFT JOIN act_re_model arm on arm.KEY_=wp.processDefinationKey WHERE wp.gmtCreatedBy = #{createdBy} -- 自己發起的 <if test="categoryId!=null and categoryId!=''"> and arm.CATEGORY_=#{categoryId} -- 分類 </if> and wp.`status` in <foreach item="wpStatus" collection="wpStatusList" open="(" separator="," close=")"> #{wpStatus} </foreach> -- 狀態(Draft:草稿;Approving:審批中;Finished:審批完成;ReRequest:駁回申請人;Declined:拒絕;Canceled:撤銷;Error:錯誤;Suspend:掛起) order by wp.gmtCreatedOn desc -- 完成后的formkey 去哪邊找 </select>