<?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="cn.com.ctop.reimburse.mondule.mapper.ReimburseApplyProcessMapper">

    <select id="queryProcess" resultType="com.alibaba.fastjson.JSONObject">
        SELECT IFNULL(t4.role_name, '财务审核') as 'roleName', IFNULL(t2.realname, '-') as 'userName', IFNULL(t1.orders, '') as 'orders', IFNULL(t1.state, '') as 'state', IFNULL(t1.stat_time, '') as 'statTime', IFNULL(t1.type, '') as 'type'
        from ctop_reimburse_apply_process t1
                 LEFT JOIN sys_user t2 on t1.user_id = t2.id
                 LEFT JOIN sys_user_role t3 on t2.id = t3.user_id
                 LEFT JOIN sys_role t4 on t3.role_id = t4.id
        WHERE apply_id = #{applyId}
    </select>


    <select id="getListByApplyId" resultType="cn.com.ctop.reimburse.mondule.entity.ReimburseApplyProcess">
        SELECT *
        FROM ctop_reimburse_apply_process
        where apply_id = #{applyId}
        order by orders
    </select>


    <delete id="deleteByApplyId">
        delete
        from ctop_reimburse_apply_process
        where apply_id = #{applyId}
    </delete>
</mapper>