ReceiptLedgerInfoMapper.xml 7.6 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.mappers.ReceiptLedgerInfoMapper">

    <resultMap id="ReceiptLedgerInfo" type="com.lframework.xingyun.sc.entity.ReceiptLedgerInfo">
        <id column="id" property="id"/>
        <result column="parent_id" property="parentId"/>
        <result column="customer_short_id" property="customerShortId"/>
        <result column="customer_short_name" property="customerShortName"/>
        <result column="customer_type" property="customerType"/>
        <result column="quota" property="quota"/>
        <result column="settle_term" property="settleTerm"/>
        <result column="dept_id" property="deptId"/>
        <result column="dept_name" property="deptName"/>
        <result column="region" property="region"/>
        <result column="region_name" property="regionName"/>
        <result column="stock_up_company_id" property="stockUpCompanyId"/>
        <result column="stock_up_company_name" property="stockUpCompanyName"/>
        <result column="customer_id" property="customerId"/>
        <result column="customer_name" property="customerName"/>
        <result column="factory_type" property="factoryType"/>
        <result column="shipment_date" property="shipmentDate"/>
        <result column="start_account_receivable" property="startAccountReceivable"/>
        <result column="arrival_date" property="arrivalDate"/>
        <result column="processed_date" property="processedDate"/>
        <result column="actual_returned_date" property="actualReturnedDate"/>
        <result column="returned_amount" property="returnedAmount"/>
        <result column="actual_returned_amount" property="actualReturnedAmount"/>
        <result column="end_account_receivable" property="endAccountReceivable"/>
        <result column="apply_status" property="applyStatus"/>
        <result column="coordinate_date" property="coordinateDate"/>
        <result column="remark" property="remark"/>
        <result column="second_coordinate_date" property="secondCoordinateDate"/>
        <result column="third_coordinate_date" property="thirdCoordinateDate"/>
        <result column="fourth_coordinate_date" property="fourthCoordinateDate"/>
        <result column="fifth_coordinate_date" property="fifthCoordinateDate"/>
        <result column="description" property="description"/>
        <result column="del_flag" property="delFlag"/>
        <result column="create_by_id" property="createById"/>
        <result column="update_by_id" property="updateById"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="ReceiptLedgerInfo_sql">
        SELECT
            tb.id,
            tb.parent_id,
            tb.customer_short_id,
            cs.short_name as customer_short_name,
            cs.type as customer_type,
            tb.quota,
            tb.settle_term,
            tb.dept_id,
            d.name as dept_name,
            tb.region,
            r.name as region_name,
            tb.stock_up_company_id,
            sc.name as stock_up_company_name,
            tb.customer_id,
            oc.name as customer_name,
            tb.factory_type,
            tb.shipment_date,
            tb.start_account_receivable,
            tb.arrival_date,
            tb.processed_date,
            tb.actual_returned_date,
            tb.returned_amount,
            tb.actual_returned_amount,
            tb.end_account_receivable,
            tb.apply_status,
            tb.coordinate_date,
            tb.remark,
            tb.second_coordinate_date,
            tb.third_coordinate_date,
            tb.fourth_coordinate_date,
            tb.fifth_coordinate_date,
            tb.description,
            tb.del_flag,
            tb.create_by_id,
            tb.update_by_id,
            tb.create_time,
            tb.update_time
        FROM receipt_ledger_info AS tb
        LEFT JOIN base_data_customer_short cs ON tb.customer_short_id = cs.id
        LEFT JOIN base_data_customer sc ON tb.stock_up_company_id = sc.id
        LEFT JOIN base_data_customer oc ON tb.customer_id = oc.id
        LEFT JOIN sys_dept d ON tb.dept_id = d.id
        LEFT JOIN sys_dept r ON tb.region = r.id
    </sql>

    <select id="query" resultMap="ReceiptLedgerInfo">
        <include refid="ReceiptLedgerInfo_sql"/>
        <where>
            AND tb.del_flag = false
            <if test="vo.id != null and vo.id != ''">
                AND tb.id = #{vo.id}
            </if>
            <if test="vo.customerShortId != null and vo.customerShortId != ''">
                AND tb.customer_short_id = #{vo.customerShortId}
            </if>
            <if test="vo.deptId != null and vo.deptId != ''">
                AND tb.dept_id = #{vo.deptId}
            </if>
            <if test="vo.customerId != null and vo.customerId != ''">
                AND tb.customer_id = #{vo.customerId}
            </if>
            <if test="vo.createTime != null and vo.createTime != ''">
                AND tb.create_time >= #{vo.createTime}
            </if>
            <if test="vo.customerName != null and vo.customerName != ''">
                AND oc.name LIKE CONCAT('%', #{vo.customerName}, '%')
            </if>
            <if test="vo.customerShortName != null and vo.customerShortName != ''">
                AND cs.short_name LIKE CONCAT('%', #{vo.customerShortName}, '%')
            </if>
            <if test="vo.deptName != null and vo.deptName != ''">
                AND d.name LIKE CONCAT('%', #{vo.deptName}, '%')
            </if>
        </where>
    </select>

    <insert id="batchAdd">
        INSERT INTO receipt_ledger_info (
        id,
        parent_id,
        customer_short_id,
        quota,
        settle_term,
        dept_id,
        region,
        stock_up_company_id,
        customer_id,
        factory_type,
        shipment_date,
        start_account_receivable,
        arrival_date,
        processed_date,
        actual_returned_date,
        returned_amount,
        actual_returned_amount
        end_account_receivable,
        apply_status,
        coordinate_date,
        remark,
        second_coordinate_date,
        third_coordinate_date,
        fourth_coordinate_date,
        fifth_coordinate_date,
        description,
        spilt,
        create_by_id,
        update_by_id,
        create_time,
        update_time
        ) VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.id},
            #{item.parentId},
            #{item.customerShortId},
            #{item.quota},
            #{item.settleTerm},
            #{item.deptId},
            #{item.region},
            #{item.stockUpCompanyId},
            #{item.customerId},
            #{item.factoryType},
            #{item.shipmentDate},
            #{item.startAccountReceivable},
            #{item.arrivalDate},
            #{item.processedDate},
            #{item.actualReturnedDate},
            #{item.returnedAmount},
            #{item.actualReturnedAmount},
            #{item.endAccountReceivable},
            #{item.applyStatus},
            #{item.coordinateAate},
            #{item.remark},
            #{item.secondCoordinateDate},
            #{item.thirdCoordinateDate},
            #{item.fourthCoordinateDate},
            #{item.fifthCoordinateDate},
            #{item.description},
            #{item.spilt},
            #{item.createById},
            #{item.updateById},
            #{item.createTime},
            #{item.updateTime}
            )
        </foreach>
    </insert>
</mapper>