<?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.fjhx.purchase.mapper.subscribe.SubscribeMapper">
    <select id="getPage" resultType="com.fjhx.purchase.entity.subscribe.vo.SubscribeVo">
        select
            s.id,
            s.dept_name,
            s.subcribe_name,
            s.subcribe_time,
            s.code,
            s.subcribe_content,
            s.subcribe_status,
            s.approved_date,
            s.process_instance_id,
            s.del_flag,
            s.create_user,
            s.create_time,
            s.update_user,
            s.update_time
        from subscribe s
            ${ew.customSqlSegment}
    </select>
    <select id="getSubscribeCountList" resultType="com.fjhx.wms.entity.SubscribeDetailPo">
        SELECT
            sum( sd.count ) AS `count`,
            sd.bussiness_id
        FROM
            subscribe_detail sd
                JOIN subscribe s ON sd.subscribe_id = s.id
            ${ew.customSqlSegment}
    </select>

</mapper>
