|
@@ -2,40 +2,69 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.fjhx.supplier.mapper.SupplierMapper">
|
|
|
|
|
|
- <select id="getList" resultType="com.fjhx.entity.supplier.Supplier">
|
|
|
+ <select id="getSumList" resultType="com.fjhx.entity.supplier.Supplier">
|
|
|
SELECT
|
|
|
t1.*,
|
|
|
- t3.CategoryCode,
|
|
|
t3.TechnologyType AS TechnologyType,
|
|
|
- t3.Purpose AS Purpose,
|
|
|
- t4.`Name` AS materialCategoryName,
|
|
|
- t4.ID,
|
|
|
(<include refid="warningCount_filed"/> ) AS warningCount,
|
|
|
(<include refid="warningTypeCount_filed"/> ) AS warningTypeCount,
|
|
|
(select `Name` from material_category where `Code` = t1.CategoryCode) AS categoryName
|
|
|
FROM
|
|
|
supplier t1
|
|
|
- LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
|
|
|
- LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
|
|
|
- LEFT JOIN material_category t4 ON t3.CategoryCode = t4.`Code`
|
|
|
+ LEFT JOIN supplier_price sp ON t1.ID = sp.FactoryId
|
|
|
+ LEFT JOIN material t3 ON t3.`Code` = sp.MaterialCode
|
|
|
<include refid="list_condition"/>
|
|
|
+ AND t3.IsDelete = 0
|
|
|
GROUP BY t1.ID
|
|
|
ORDER BY t1.CreatedTime DESC
|
|
|
<include refid="sql_limit"/>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getSumListCount" resultType="java.lang.Integer">
|
|
|
+ SELECT
|
|
|
+ Count( 1 )
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1)
|
|
|
+ FROM
|
|
|
+ supplier t1
|
|
|
+ LEFT JOIN supplier_price sp ON t1.ID = sp.FactoryId
|
|
|
+ LEFT JOIN material t3 ON t3.`Code` = sp.MaterialCode
|
|
|
+ <include refid="list_condition"/>
|
|
|
+ GROUP BY t1.ID
|
|
|
+ )AS a
|
|
|
+ </select>
|
|
|
+ <select id="getList" resultType="com.fjhx.entity.supplier.Supplier">
|
|
|
+ SELECT
|
|
|
+ t1.*,
|
|
|
+ t3.TechnologyType AS TechnologyType,
|
|
|
+ (<include refid="warningCount_filed"/> ) AS warningCount,
|
|
|
+ (<include refid="warningTypeCount_filed"/> ) AS warningTypeCount,
|
|
|
+ (select `Name` from material_category where `Code` = t1.CategoryCode) AS categoryName
|
|
|
+ FROM
|
|
|
+ material t3
|
|
|
+ LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
|
|
|
+ LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
|
|
|
+ <include refid="list_condition"/>
|
|
|
+ AND t3.IsDelete = 0
|
|
|
+ GROUP BY t1.ID
|
|
|
+ ORDER BY t3.TechnologyType
|
|
|
+ <include refid="sql_limit"/>
|
|
|
+ </select>
|
|
|
<select id="getListCount" resultType="java.lang.Integer">
|
|
|
SELECT
|
|
|
Count( 1 )
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- count( 1 )
|
|
|
+ count(1)
|
|
|
FROM
|
|
|
- supplier t1
|
|
|
- LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
|
|
|
- LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
|
|
|
- LEFT JOIN material_category t4 ON t3.CategoryCode = t4.`Code`
|
|
|
+ material t3
|
|
|
+ LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
|
|
|
+ LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
|
|
|
<include refid="list_condition"/>
|
|
|
+ AND t3.IsDelete = 0
|
|
|
GROUP BY t1.ID
|
|
|
)AS a
|
|
|
</select>
|
|
@@ -53,12 +82,12 @@
|
|
|
FORMAT(IFNULL((<include refid="lastMonthMoney_filed"/>),0),2)AS lastMonthMoney,
|
|
|
FORMAT(IFNULL((<include refid="monthMoney_filed"/>),0),2)AS monthMoney
|
|
|
FROM
|
|
|
- supplier t1
|
|
|
- LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
|
|
|
- LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
|
|
|
+ material t3
|
|
|
+ LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
|
|
|
+ LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
|
|
|
<include refid="list_condition"/>
|
|
|
GROUP BY t1.ID
|
|
|
- ORDER BY t1.CreatedTime DESC
|
|
|
+ ORDER BY t3.TechnologyType
|
|
|
<include refid="sql_limit"/>
|
|
|
</select>
|
|
|
<select id="getPurListCount" resultType="java.lang.Integer">
|
|
@@ -69,27 +98,35 @@
|
|
|
SELECT
|
|
|
count(1)
|
|
|
FROM
|
|
|
- supplier t1
|
|
|
- LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
|
|
|
- LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
|
|
|
+ material t3
|
|
|
+ LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
|
|
|
+ LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
|
|
|
<include refid="list_condition"/>
|
|
|
GROUP BY t1.ID
|
|
|
) AS a
|
|
|
</select>
|
|
|
<select id="getGroupByCategory" resultType="com.fjhx.entity.supplier.Supplier">
|
|
|
SELECT
|
|
|
- count( 1 ) AS CategoryCount,
|
|
|
- t3.TechnologyType AS TechnologyType
|
|
|
+ TechnologyType AS TechnologyType,
|
|
|
+ Count( 1 ) AS CategoryCount
|
|
|
FROM
|
|
|
- supplier t1
|
|
|
- LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
|
|
|
- LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
|
|
|
- WHERE
|
|
|
- t3.TechnologyType IS NOT NULL
|
|
|
- AND t1.IsDelete = 0
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.ID,
|
|
|
+ t1.`Name`,
|
|
|
+ t3.TechnologyType AS TechnologyType
|
|
|
+ FROM
|
|
|
+ material t3
|
|
|
+ LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
|
|
|
+ LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
|
|
|
+ <include refid="list_condition"/>
|
|
|
+ AND t3.IsDelete = 0
|
|
|
+ GROUP BY t1.ID
|
|
|
+ ) detail
|
|
|
GROUP BY
|
|
|
- t3.TechnologyType
|
|
|
- ORDER BY t3.TechnologyType ASC
|
|
|
+ TechnologyType
|
|
|
+ ORDER BY
|
|
|
+ TechnologyType
|
|
|
</select>
|
|
|
<select id="getSuById" resultType="com.fjhx.entity.supplier.Supplier">
|
|
|
SELECT
|
|
@@ -266,11 +303,10 @@
|
|
|
<sql id="list_condition">
|
|
|
<where>
|
|
|
t1.IsDelete = 0
|
|
|
- AND t1.CategoryCode NOT IN ("02.","02.003.")
|
|
|
<if test="search neq null and search neq '' ">
|
|
|
AND ((INSTR(t1.`Name`, #{search}) > 0) OR (INSTR(t1.`Code`, #{search}) > 0) )
|
|
|
</if>
|
|
|
- <if test="TechnologyType neq null and TechnologyType neq '' ">
|
|
|
+ <if test="TechnologyType neq null and TechnologyType neq ''">
|
|
|
AND t3.TechnologyType = #{TechnologyType}
|
|
|
</if>
|
|
|
<if test="Purpose neq null and Purpose neq '' ">
|