JNBusinessTest/ruoyi-system/target/classes/mapper/quote/QuoteMapper.xml

119 lines
6.7 KiB
XML
Raw Normal View History

2024-06-24 16:57:12 +08:00
<?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.quote.mapper.QuoteMapper">
<resultMap type="MaterialDto" id="MaterialResult">
<result property="uid" column="uid" />
<result property="model" column="model" />
<result property="specification" column="specification" />
<result property="voltLevel" column="voltLevel" />
<result property="measureUnit" column="measureUnit" />
<result property="prodCategory" column="prodCategory" />
<result property="matCostPrice" column="matCostPrice" />
<result property="manuCost" column="manuCost" />
<result property="wdFSurcharge" column="wdFSurcharge" />
<result property="redBookPrice" column="redBookPrice" />
<result property="rbFacPrice" column="rbFacPrice" />
<result property="redBookCost" column="redBookCost" />
</resultMap>
<!--<select id="selectMaterialListByParam" resultType="com.ruoyi.quote.domain.MaterialDto">
select a.material_id AS uid,a.material_xingh AS model,a.material_guig AS specification,
a.material_diany AS voltLevel,a.material_dw AS measureUnit,c.type_name As prodCategory,
b.price matCostPrice, d.factory_total_ratio/100 manuCost,d.factory_pj_ratio/100 wdFSurcharge
from c_material a
left join
(select a.cost_material_id,sum((isnull(a.cost_cl_qty,0)+isnull(a.cost_cl_qty_2,0))*b.material_price) price
from c_material_cost a
left join c_yl_material b on a.cost_cl_id=b.material_no
where b.material_state='0'
group by a.cost_material_id
)b on a.material_id=b.cost_material_id
left join c_material_type_factory c on a.material_type_id = c.type_no
left join c_material_type e on e.type_no = c.type_no
left join c_factory d on d.factory_no = c.factory_id
<where>
and a.material_state='0' and e.type_state ='0'
<if test="precMaterialName != null and precMaterialName != ''"> and a.material_xingh like concat('', #{precMaterialName}, '%')</if>
<if test="vagueMaterialName != null and vagueMaterialName != ''"> and a.material_xingh like concat('%', #{vagueMaterialName}, '%')</if>
<if test="vagueModel != null and vagueModel != ''"> and a.material_guig like concat('%', #{vagueModel}, '%')</if>
</where>
</select>-->
<select id="selectMaterialListByParam" resultType="com.ruoyi.quote.domain.MaterialDto">
select a.material_id AS uid, a.material_xingh AS model,a.material_guig AS specification,a.material_diany AS voltLevel,
a.material_dw AS measureUnit,c.type_name AS prodCategory,
b.price matCostPrice, d.factory_total_ratio/100 manuCost,d.factory_pj_ratio/100 wdFSurcharge,
cc.material_rb_price AS redBookPrice,cc.material_rb_price*0.8 rbFacPrice, dd.material_cb_price AS redBookCost
from c_material a
left join
(select a.cost_material_id,sum((isnull(a.cost_cl_qty,0)+isnull(a.cost_cl_qty_2,0))*b.material_price) price from c_material_cost a
left join c_yl_material b on a.cost_cl_id=b.material_no
where b.material_state='0'
group by a.cost_material_id
)b on a.material_id=b.cost_material_id
left join c_material_type_factory c on a.material_type_id = c.type_no
left join c_material_type e on e.type_no = c.type_no
left join c_factory d on d.factory_no = c.factory_id
left join(select material_xingh,material_guig,material_diany,convert(decimal(18,2),material_rb_price ) material_rb_price from c_rb_product_price
)as cc on cc.material_xingh=a.material_xingh and cc.material_guig = a.material_guig
and cc.material_diany = a.material_diany
left join(select material_xingh,material_guig,material_diany,convert(decimal(18,2),material_cb_price) material_cb_price from c_rb_productbase_price
)as dd on dd.material_xingh=a.material_xingh and dd.material_guig = a.material_guig
and dd.material_diany= a.material_diany
<where>
a.material_state='0' and e.type_state ='0'
<if test="precMaterialName != null and precMaterialName != ''"> and a.material_xingh like concat('', #{precMaterialName}, '%')</if>
<if test="vagueMaterialName != null and vagueMaterialName != ''"> and a.material_xingh like concat('%', #{vagueMaterialName}, '%')</if>
<if test="vagueModel != null and vagueModel != ''"> and a.material_guig like concat('%', #{vagueModel}, '%')</if>
</where>
ORDER BY a.material_id
</select>
<select id="queryRedBCostByParams" resultType="com.ruoyi.quote.domain.CalculateRBParamDto">
SELECT a.成本价格 AS redBookCost, a.型号 AS model, a.规格 AS specification, a.电压等级 AS voltLevel
FROM [REDBOOK].[RedBook].[dbo].rb_productbase_price a
JOIN (VALUES
<foreach collection="params" item="param" open="(" separator="),(" close=")">
#{param.redBookVer}, #{param.model}, #{param.specification}, #{param.voltLevel}
</foreach>
) AS v(version_uid_0, 型号, 规格, 电压等级)
ON a.version_uid_0 = v.version_uid_0
AND a.型号 = v.型号
AND a.规格 = v.规格
AND a.电压等级 = v.电压等级;
</select>
<select id="queryRedBPriceByParams" resultType="com.ruoyi.quote.domain.CalculateRBParamDto">
select a.红本价格 AS redBookPrice, a.型号 AS model, a.规格 AS specification, a.电压等级 AS voltLevel
from [REDBOOK].[RedBook].[dbo].rb_product_price a
JOIN (VALUES
<foreach collection="params" item="param" open="(" separator="),(" close=")">
#{param.redBookVer}, #{param.model}, #{param.specification}, #{param.voltLevel}
</foreach>
) AS v(version_uid_0, 型号, 规格, 电压等级)
ON a.version_uid_0 = v.version_uid_0
AND a.型号 = v.型号
AND a.规格 = v.规格
AND a.电压等级 = v.电压等级;
</select>
<select id="queryRedBookInfo" resultType="Map">
SELECT t.uid_0 AS uid, t.date_0 AS currAdjDate, t.tong_price_0 AS currCopperPrice, t.lv_price_0 AS currAlumPrice
FROM [RedBook].[dbo].[rb_productVersion] t
WHERE [sta_0] IN ('0', '1')
AND t.uid_0 = (SELECT MAX(uid_0) FROM [RedBook].[dbo].[rb_productVersion] WHERE [sta_0] IN ('0', '1'))
</select>
<select id="queryRedBookLocalVer" resultType="String">
SELECT MAX([version_uid]) AS redBookLocalVer
FROM [jn_quot].[dbo].[c_rb_version]
</select>
</mapper>