ProcurementWeighingTicketPlanMapper.xml 2.41 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.weighing.ProcurementWeighingTicketPlanMapper">

    <resultMap id="ProcurementWeighingTicketPlanResult" type="com.lframework.xingyun.sc.procurement.entity.weighing.ProcurementWeighingTicketPlan">
        <id column="id" property="id"/>
        <result column="weighing_ticket_id" property="weighingTicketId"/>
        <result column="procurement_plan_id" property="procurementPlanId"/>
        <result column="procurement_plan_line_id" property="procurementPlanLineId"/>
        <result column="plan_code" property="planCode"/>
        <result column="product_id" property="productId"/>
        <result column="product_name" property="productName"/>
        <result column="quantity" property="quantity"/>
        <result column="order_no" property="orderNo"/>
        <result column="item_id" property="itemId"/>
        <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="PWTP_sql">
        SELECT
            pwtp.id,
            pwtp.weighing_ticket_id,
            pwtp.procurement_plan_id,
            pwtp.procurement_plan_line_id,
            pwtp.plan_code,
            pwtp.product_id,
            br.product_name,
            pwtp.quantity,
            pwtp.order_no,
            pwtp.item_id,
            pwtp.create_by_id,
            pwtp.create_by,
            pwtp.update_by_id,
            pwtp.update_by,
            pwtp.create_time,
            pwtp.update_time
        FROM procurement_weighing_ticket_plan AS pwtp
        LEFT JOIN base_data_breed_relationship br ON br.id = pwtp.product_id
    </sql>

    <select id="getByWeighingTicketId" resultMap="ProcurementWeighingTicketPlanResult">
        <include refid="PWTP_sql"/>
        WHERE pwtp.weighing_ticket_id = #{weighingTicketId}
        ORDER BY pwtp.order_no ASC
    </select>

    <delete id="deleteByWeighingTicketId">
        DELETE FROM procurement_weighing_ticket_plan WHERE weighing_ticket_id = #{weighingTicketId}
    </delete>
</mapper>