<?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="org.jeecg.modules.sampleAndConsumableManagement.mapper.FdColumnManagementMapper">

    <select id="queryColumnByConId" resultType="org.jeecg.modules.sampleAndConsumableManagement.entity.FdColumnManagement">
        SELECT
            pf.contract_id AS pkContract,
            pf.project_name AS projectName,
            pf.customer_name AS pkBidParty,
            pf.contract_party AS pkContractParty,
            c.`code` AS contractCode,
            cus.`name` AS bidPartyName ,
            cus.abbreviation AS bidPartyNameAbbreviation,
            pf.project_file_no
        FROM
            fd_project_file pf
            LEFT JOIN fd_contract c ON c.id = pf.contract_id
            LEFT JOIN fd_customer cus ON cus.id = pf.customer_id
        WHERE
            c.del_flag = '0'
            and pf.id=#{0}
    </select>

    <select id="findByPage" resultType="org.jeecg.modules.sampleAndConsumableManagement.entity.FdColumnManagement">
        SELECT
            cm.id,
            cm.tracking_code,
            con.`code` AS contractCode,
            cm.purchase_order_no,
            cm.lot_no,
            cm.arrival_date,
            cm.column_supplier,
            cm.column_name,
            cm.column_number,
            cm.create_time,
            cus.NAME AS bidPartyName
        FROM
            fd_column_management cm
            LEFT JOIN fd_contract con ON cm.pk_contract = con.id
            LEFT JOIN fd_customer cus ON con.pk_customer_id = cus.id
             ${ew.customSqlSegment}
    </select>

    <select id="getFileContractList" resultType="org.jeecg.modules.projectManagement.entity.FdContract">
        SELECT
            c.id,
            c.CODE
        FROM
            fd_project_file pf
            LEFT JOIN fd_contract c ON c.id = pf.contract_id
        WHERE
            pf.del_flag = '0'
            and pf.status='1'
        ORDER BY
            pf.create_time
    </select>


    <select id="getContractPartyName" resultType="java.lang.String">
        SELECT
            sdi.item_text
            FROM
            sys_dict_item sdi
            WHERE sdi.item_value=#{0}
            and sdi.dict_id = "8c9b5d1ec447fda422f4a656af8055e2"
    </select>

    <select id="getColumnTypeName" resultType="java.lang.String">
        SELECT
            sdi.item_text
            FROM
            sys_dict_item sdi
            WHERE sdi.item_value=#{0}
            and sdi.dict_id = "07997c24b01eeda72e89f435362058c7"
    </select>

    <select id="getParticleSizeName" resultType="java.lang.String">
        SELECT
            sdi.item_text
            FROM
            sys_dict_item sdi
            WHERE sdi.item_value=#{0}
            and sdi.dict_id = "9dae4bcf9f13f5d9c6ca735a53cc91c5"
    </select>

    <select id="getColumnLengthName" resultType="java.lang.String">
        SELECT
            sdi.item_text
            FROM
            sys_dict_item sdi
            WHERE sdi.item_value=#{0}
            and sdi.dict_id = "5c90b14dd5454eabe363559a059e763f"
    </select>

    <select id="getColumnDiameter" resultType="java.lang.String">
        SELECT
            sdi.item_text
            FROM
            sys_dict_item sdi
            WHERE sdi.item_value=#{0}
            and sdi.dict_id = "a0f5f9bb136f3671508c83903703de6a"
    </select>
</mapper>