<?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.cf.imes.module.system.dal.mysql.machine.MachineLimitMapper">


    <select id="selectOrganMachinePage" resultType="com.cf.imes.module.system.controller.admin.machine.vo.OrganMachineResp" parameterType="map">



        select distinct
            sml.organ_id,
            sml.cut_limit,
            sml.drill_limit,
            sml.label_limit,
            sml.saw_limit,
            sml.sealedge_limit,
            sml.updater,
            sml.update_time,
            so.name as organName,
            so.status
        from system_machine_limit sml
             join system_organization so on sml.organ_id = so.id
        <where>
            sml.deleted = false

        <if test="machinePage.organId !=null">
            and sml.organ_id = #{machinePage.organId}
        </if>

        <if test="machinePage.status !=null">
            and so.status = #{machinePage.status}
        </if>

        </where>

    </select>
</mapper>