<?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="com.xjrsoft.module.workflow.mapper.WorkflowApproveRecordMapper">
    <select id="myApproveRecord" resultType="com.xjrsoft.module.ledger.vo.WfSubscriptionPageVo">
    </select>

    <select id="getList" parameterType="com.xjrsoft.module.ledger.dto.WfSubscriptionPageDto" resultType="com.xjrsoft.module.ledger.vo.WfSubscriptionPageVo">
        select t1.id,t2.name as org_name,t3.name as user_name,t1.shen_qing_ri_qi4752, t1.folder_id,t1.number,t1.total_amount from wf_subscription t1
        left join xjr_department t2 on t1.application_department = t2.id
        left join xjr_user t3 on t1.user_id = t3.id
        where 1 = 1
        <if test="dto.orgId != null">
            and t1.id = #{dto.orgId}
        </if>
        <if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
            and t1.shen_qing_ri_qi4752 between #{dto.startDate} and #{dto.endDate}
        </if>
        <if test="dto.userName != null and dto.userName != ''">
            and t3.name like concat('%', #{dto.userName}, '%')
        </if>
        order by t1.shen_qing_ri_qi4752 desc
    </select>

    <select id="getInfoById" resultType="com.xjrsoft.module.ledger.vo.WfSubscriptionListInfoVo">
        select t1.id,t2.name as org_name,t3.name as user_name,t1.shen_qing_ri_qi4752,t1.folder_id from wf_subscription t1
        left join xjr_department t2 on t1.application_department = t2.id
        left join xjr_user t3 on t1.user_id = t3.id
        where t1.id = #{id}
    </select>

</mapper>