<?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.ruoyi.quartz.mapper.SapTjMapper">

    <select id="selRbVersionUid" resultType="java.lang.String" >
        select top 1 uid_0 from rb_productVersion where date_0=(select  MAX(date_0) from [dbo].[rb_productVersion] where sta_0=0 or sta_0=1) and (sta_0=0 or sta_0=1)  order by uid_0 desc
    </select>

    <select id="selLocVersionUid" resultType="java.lang.String" >
        select top 1 version_uid from c_rb_version
    </select>

    <select id="selRbProductPriceVersionUid" resultType="java.lang.String" >
        select count(1) from rb_product_price where version_uid_0 = #{rbVersionUid}
    </select>

    <select id="selRbProductBasePriceVersionUid" resultType="java.lang.String" >
        select count(1) from rb_productbase_price where version_uid_0 = #{rbVersionUid}
    </select>

    <select id="getProductPriceList" resultType="c_rb_product_price" >
        select distinct 型号 material_xingh,规格 material_guig,电压等级 material_diany,红本价格 material_rb_price from rb_product_price where version_uid_0 = #{rbVersionUid}
    </select>

    <select id="getProductBasePriceList" resultType="c_rb_productbase_price" >
        select distinct 型号 material_xingh,规格 material_guig,电压等级 material_diany,成本价格 material_cb_price from rb_productbase_price where version_uid_0 = #{rbVersionUid}
    </select>

    <delete id="deleteLocProductPrice">
        delete from c_rb_product_price
    </delete>

    <delete id="deleteLocProductBasePrice">
        delete from c_rb_productbase_price
    </delete>

    <update id="updateLocRbVersion">
        update c_rb_version set version_uid = #{rbVersionUid}
    </update>
</mapper>
