ProcurementDomesticCustomerCreditMapper.xml 9.59 KB
<?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.lframework.xingyun.sc.procurement.mappers.credit.ProcurementDomesticCustomerCreditMapper">

    <resultMap id="ProcurementDomesticCustomerCredit"
               type="com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit">
        <id column="id" property="id"/>
        <result column="unit_name" property="unitName"/>
        <result column="customer_short_name" property="customerShortName"/>
        <result column="company_nature" property="companyNature"/>
        <result column="bank_name" property="bankName"/>
        <result column="bank_account" property="bankAccount"/>
        <result column="registered_capital" property="registeredCapital"/>
        <result column="legal_representative" property="legalRepresentative"/>
        <result column="company_established_time" property="companyEstablishedTime"/>
        <result column="address" property="address"/>
        <result column="business_principal" property="businessPrincipal"/>
        <result column="business_principal_position" property="businessPrincipalPosition"/>
        <result column="business_principal_phone" property="businessPrincipalPhone"/>
        <result column="legal_business_relation" property="legalBusinessRelation"/>
        <result column="factory_office_property" property="factoryOfficeProperty"/>
        <result column="factory_office_area" property="factoryOfficeArea"/>
        <result column="warehouse_yard_property" property="warehouseYardProperty"/>
        <result column="warehouse_yard_area" property="warehouseYardArea"/>
        <result column="main_equipment" property="mainEquipment"/>
        <result column="normal_inventory" property="normalInventory"/>
        <result column="main_varieties" property="mainVarieties"/>
        <result column="monthly_purchase_volume" property="monthlyPurchaseVolume"/>
        <result column="purchase_source" property="purchaseSource"/>
        <result column="stock_in_product_name" property="stockInProductName"/>
        <result column="product_name" property="productName"/>
        <result column="capacity" property="capacity"/>
        <result column="sales_channel" property="salesChannel"/>
        <result column="has_preferential_policy" property="hasPreferentialPolicy"/>
        <result column="invest_in_futures" property="investInFutures"/>
        <result column="has_penalty_record" property="hasPenaltyRecord"/>
        <result column="business_scope_match" property="businessScopeMatch"/>
        <result column="first_cooperation_year" property="firstCooperationYear"/>
        <result column="is_new_development" property="isNewDevelopment"/>
        <result column="operation_mode" property="operationMode"/>
        <result column="has_failed_plan_record" property="hasFailedPlanRecord"/>
        <result column="has_plan_performance_issue" property="hasPlanPerformanceIssue"/>
        <result column="accounting_process" property="accountingProcess"/>
        <result column="invoice_name_match" property="invoiceNameMatch"/>
        <result column="outbound_process_standard" property="outboundProcessStandard"/>
        <result column="transport_mode" property="transportMode"/>
        <result column="common_material_issue" property="commonMaterialIssue"/>
        <result column="other_issue" property="otherIssue"/>
        <result column="attachment_file_ids" property="attachmentFileIds"/>
        <result column="attachment_file_names" property="attachmentFileNames"/>
        <result column="investigator_id" property="investigatorId"/>
        <result column="investigator_name" property="investigatorName"/>
        <result column="purchase_department" property="purchaseDepartment"/>
        <result column="purchase_department_name" property="purchaseDepartmentName"/>
        <result column="purchase_department_code" property="purchaseDepartmentCode"/>
        <result column="region" property="region"/>
        <result column="region_name" property="regionName"/>
        <result column="review_valid_until" property="reviewValidUntil"/>
        <result column="status" property="status"/>
        <result column="freeze" property="freeze"/>
        <result column="create_by_id" property="createById"/>
        <result column="create_by" property="createBy"/>
        <result column="update_by_id" property="updateById"/>
        <result column="update_by" property="updateBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="ProcurementDomesticCustomerCreditSql">
        SELECT
            tb.id,
            tb.unit_name,
            tb.customer_short_name,
            tb.company_nature,
            tb.bank_name,
            tb.bank_account,
            tb.registered_capital,
            tb.legal_representative,
            tb.company_established_time,
            tb.address,
            tb.business_principal,
            tb.business_principal_position,
            tb.business_principal_phone,
            tb.legal_business_relation,
            tb.factory_office_property,
            tb.factory_office_area,
            tb.warehouse_yard_property,
            tb.warehouse_yard_area,
            tb.main_equipment,
            tb.normal_inventory,
            tb.main_varieties,
            tb.monthly_purchase_volume,
            tb.purchase_source,
            tb.stock_in_product_name,
            tb.product_name,
            tb.capacity,
            tb.sales_channel,
            tb.has_preferential_policy,
            tb.invest_in_futures,
            tb.has_penalty_record,
            tb.business_scope_match,
            tb.first_cooperation_year,
            tb.is_new_development,
            tb.operation_mode,
            tb.has_failed_plan_record,
            tb.has_plan_performance_issue,
            tb.accounting_process,
            tb.invoice_name_match,
            tb.outbound_process_standard,
            tb.transport_mode,
            tb.common_material_issue,
            tb.other_issue,
            tb.attachment_file_ids,
            tb.attachment_file_names,
            tb.investigator_id,
            tb.investigator_name,
            tb.purchase_department,
            sd.name AS purchase_department_name,
            sd.code AS purchase_department_code,
            tb.region,
            sd1.name AS region_name,
            tb.review_valid_until,
            tb.status,
            tb.freeze,
            tb.create_by_id,
            tb.create_by,
            tb.update_by_id,
            tb.update_by,
            tb.create_time,
            tb.update_time
        FROM procurement_domestic_customer_credit tb
        left join sys_dept as sd on sd.id = tb.purchase_department
        left join sys_dept as sd1 on sd1.id = tb.region
    </sql>

    <select id="query" resultMap="ProcurementDomesticCustomerCredit">
        <include refid="ProcurementDomesticCustomerCreditSql"/>
        <where>
            <if test="vo.unitName != null and vo.unitName != ''">
                AND tb.unit_name LIKE CONCAT('%', #{vo.unitName}, '%')
            </if>
            <if test="vo.customerShortName != null and vo.customerShortName != ''">
                AND tb.customer_short_name LIKE CONCAT('%', #{vo.customerShortName}, '%')
            </if>
            <if test="vo.companyNature != null and vo.companyNature != ''">
                AND tb.company_nature LIKE CONCAT('%', #{vo.companyNature}, '%')
            </if>
            <if test="vo.businessPrincipal != null and vo.businessPrincipal != ''">
                AND tb.business_principal LIKE CONCAT('%', #{vo.businessPrincipal}, '%')
            </if>
            <if test="vo.investigatorId != null and vo.investigatorId != ''">
                AND tb.investigator_id = #{vo.investigatorId}
            </if>
            <if test="vo.investigatorName != null and vo.investigatorName != ''">
                AND tb.investigator_name LIKE CONCAT('%', #{vo.investigatorName}, '%')
            </if>
            <if test="vo.purchaseDepartment != null and vo.purchaseDepartment != ''">
                AND tb.purchase_department = #{vo.purchaseDepartment}
            </if>
            <if test="vo.region != null and vo.region != ''">
                AND tb.region = #{vo.region}
            </if>
            <if test="vo.status != null and vo.status != ''">
                AND tb.status = #{vo.status}
            </if>
            <if test="vo.freeze != null">
                AND tb.freeze = #{vo.freeze}
            </if>
            <if test="vo.reviewValidUntilStart != null">
                AND tb.review_valid_until <![CDATA[ >= ]]> #{vo.reviewValidUntilStart}
            </if>
            <if test="vo.reviewValidUntilEnd != null">
                AND tb.review_valid_until <![CDATA[ <= ]]> #{vo.reviewValidUntilEnd}
            </if>
            <if test="vo.createDateStart != null">
                AND DATE(tb.create_time) <![CDATA[ >= ]]> #{vo.createDateStart}
            </if>
            <if test="vo.createDateEnd != null">
                AND DATE(tb.create_time) <![CDATA[ <= ]]> #{vo.createDateEnd}
            </if>
        </where>
        ORDER BY tb.create_time DESC
    </select>

    <select id="findById" resultMap="ProcurementDomesticCustomerCredit">
        <include refid="ProcurementDomesticCustomerCreditSql"/>
        WHERE tb.id = #{id}
    </select>

    <select id="getLatestFlowDefJson" resultType="java.lang.String">
        SELECT def_json
        FROM flow_instance
        WHERE business_id = #{id}
        ORDER BY create_time DESC
        LIMIT 1
    </select>
</mapper>