PriceSubTableMapper.xml 1.84 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.basedata.mappers.PriceSubTableMapper">

    <resultMap id="PriceSubTable" type="com.lframework.xingyun.basedata.entity.PriceSubTable">
        <id column="id" property="id"/>
        <result column="price_id" property="priceId"/>
        <result column="product_id" property="productId"/>
        <result column="product_name" property="productName"/>
        <result column="code" property="code"/>
        <result column="type" property="type"/>
        <result column="price" property="price"/>
        <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="PriceSubTable_sql">
        SELECT
            tb.id,
            tb.price_id,
            tb.product_id,
            br.product_name as product_name,
            br.code as code,
            br.type as type,
            tb.price,
            tb.create_by_id,
            tb.create_by,
            tb.update_by_id,
            tb.update_by,
            tb.create_time,
            tb.update_time
        FROM base_data_price_sub_table AS tb
        LEFT JOIN base_data_breed_relationship br on br.id=tb.product_id
    </sql>

    <select id="query" resultMap="PriceSubTable">
        <include refid="PriceSubTable_sql"/>
        <where>
            <if test="vo.priceId != null and vo.priceId != ''">
                AND tb.price_id = #{vo.priceId}
            </if>
        </where>
    </select>
</mapper>