|
|
@@ -311,80 +311,79 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="selectCognizanceOrgInfoBoByUid" resultType="com.goafanti.techservice.cognizance.bo.CognizanceOrgInfoBo">
|
|
|
+ <select id="selectCognizanceOrgInfoBoByUidAndCid" resultType="com.goafanti.techservice.cognizance.bo.CognizanceOrgInfoBo">
|
|
|
select u.id as uid, c.id as cid, o.unit_name as unitName, o.org_code as orgCode, o.postal_address as postalAddress,
|
|
|
c.contacts, c.technical_field1 as technicalField1, c.technical_field2 as technicalField2, c.technical_field3 as technicalField3,
|
|
|
c.basic_research_cost as basicResearchCost, c.accident
|
|
|
- from user u
|
|
|
- LEFT JOIN organization_identity o on u.id = o.uid and u.id = #{0}
|
|
|
- INNER JOIN org_cognizance c on c.uid = u.id and u.id = #{0} and c.deleted_sign = 0 and c.id = #{1}
|
|
|
+ from (select id from user where id = #{0}) u
|
|
|
+ LEFT JOIN organization_identity o on u.id = o.uid
|
|
|
+ INNER JOIN org_cognizance c on c.uid = u.id and c.deleted_sign = 0 and c.id = #{1}
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectCognizanceResearchCostBoByUid" parameterType="java.lang.String" resultType="com.goafanti.techservice.cognizance.bo.CognizanceResearchCostBo">
|
|
|
+ <select id="selectCognizanceResearchCostBoByUidAndYear" resultType="com.goafanti.techservice.cognizance.bo.CognizanceResearchCostBo">
|
|
|
select m.uid, sum(m.cost1) as researchCost, sum(m.territory) as territory from(
|
|
|
select uid, (internal_labor_cost + internal_direct_cost + internal_depreciation_cost + internal_amortization_cost
|
|
|
+ internal_design_cost + internal_equipment_cost + internal_other_cost +external_total_cost) as cost1,
|
|
|
external_abroad_cost as territory
|
|
|
from org_activity_cost
|
|
|
- where uid = #{uid,jdbcType=VARCHAR} and (start_date >= (select str_to_date(CONCAT(year,day), '%Y-%m-%d %H') from (
|
|
|
- SELECT (DATE_FORMAT(NOW(), '%Y')-3) as year ,'-01-01' as day FROM DUAL) x)
|
|
|
- and start_date <![CDATA[ < ]]> (select str_to_date(CONCAT(year,day), '%Y-%m-%d %H') from (
|
|
|
- SELECT DATE_FORMAT(NOW(), '%Y') as year ,'-01-01' as day FROM DUAL) z) )
|
|
|
- or (end_date <![CDATA[ < ]]> (select str_to_date(CONCAT(year,day), '%Y-%m-%d %H') from (
|
|
|
- SELECT DATE_FORMAT(NOW(), '%Y') as year ,'-01-01' as day FROM DUAL) y) and
|
|
|
- end_date >= (select str_to_date(CONCAT(year,day), '%Y-%m-%d %H') from (
|
|
|
- SELECT (DATE_FORMAT(NOW(), '%Y')-3) as year ,'-01-01' as day FROM DUAL) k))
|
|
|
+ where uid = #{1} and (start_date >= (select str_to_date(CONCAT(#{0}-3,'-01-01'), '%Y-%m-%d %H'))
|
|
|
+ and start_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H')))
|
|
|
+ or (end_date <![CDATA[ < ]]> (select str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H')) and
|
|
|
+ end_date >= (select str_to_date(CONCAT(#{0}-3,'-01-01'), '%Y-%m-%d %H')))
|
|
|
and deleted_sign = 0
|
|
|
) m
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectCognizanceManageCostBoByUid" parameterType="java.lang.String" resultType="com.goafanti.techservice.cognizance.bo.CognizanceManageCostBo">
|
|
|
- select a.uid, a.netAsset1, a.salesRevenue1, a.grossProfit1, b.netAsset2, b.salesRevenue2, b.grossProfit2,
|
|
|
+ <select id="selectCognizanceManageCostBoByUidAndYear" resultType="com.goafanti.techservice.cognizance.bo.CognizanceManageCostBo">
|
|
|
+ select u.id as uid, a.netAsset1, a.salesRevenue1, a.grossProfit1, b.netAsset2, b.salesRevenue2, b.grossProfit2,
|
|
|
c.netAsset3, c.salesRevenue3, c.grossProfit3 from
|
|
|
+ (select id from user where id = #{1}) u
|
|
|
+ LEFT JOIN
|
|
|
(
|
|
|
- select uid, net_asset as netAsset1, gross_profit as grossProfit1, sales_revenue as salesRevenue1 from org_finance where uid = #{uid,jdbcType=VARCHAR} and year =
|
|
|
- (SELECT (DATE_FORMAT(NOW(), '%Y')-1) FROM DUAL ) and deleted_sign = 0
|
|
|
- ) a INNER JOIN
|
|
|
+ select uid, net_asset as netAsset1, gross_profit as grossProfit1, sales_revenue as salesRevenue1 from org_finance where uid = #{1} and year =
|
|
|
+ #{0}-1 and deleted_sign = 0
|
|
|
+ ) a ON a.uid = u.id
|
|
|
+ LEFT JOIN
|
|
|
(
|
|
|
- select uid, net_asset as netAsset2, gross_profit as grossProfit2, sales_revenue as salesRevenue2 from org_finance where uid = #{uid,jdbcType=VARCHAR} and year =
|
|
|
- (SELECT (DATE_FORMAT(NOW(), '%Y')-2) FROM DUAL ) and deleted_sign = 0
|
|
|
- ) b on a.uid = b. uid
|
|
|
- INNER JOIN
|
|
|
+ select uid, net_asset as netAsset2, gross_profit as grossProfit2, sales_revenue as salesRevenue2 from org_finance where uid = #{1} and year =
|
|
|
+ #{0}-2 and deleted_sign = 0
|
|
|
+ ) b on b.uid = u. id
|
|
|
+ LEFT JOIN
|
|
|
(
|
|
|
- select uid, net_asset as netAsset3, gross_profit as grossProfit3, sales_revenue as salesRevenue3 from org_finance where uid = #{uid,jdbcType=VARCHAR} and year =
|
|
|
- (SELECT (DATE_FORMAT(NOW(), '%Y')-3) FROM DUAL ) and deleted_sign = 0
|
|
|
- ) c on a.uid = c.uid
|
|
|
+ select uid, net_asset as netAsset3, gross_profit as grossProfit3, sales_revenue as salesRevenue3 from org_finance where uid = #{1} and year =
|
|
|
+ #{0}-3 and deleted_sign = 0
|
|
|
+ ) c on c.uid = u.id
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectCognizanceCatagoryBoByUid" parameterType="java.lang.String" resultType="com.goafanti.techservice.cognizance.bo.CognizanceCatagoryBo">
|
|
|
- select x.uid, x.firstCatagory, x.secondCatagory, y.firmTotal, y.techTotal, z.totalRevenue
|
|
|
- from
|
|
|
- (
|
|
|
- select a.uid, a.firstCatagory, b.secondCatagory from
|
|
|
- (
|
|
|
- select uid, count(1) as firstCatagory from org_intellectual_property
|
|
|
- where uid = #{uid,jdbcType=VARCHAR} and evaluation_category= 0 and deleted_sign = 0 GROUP BY uid
|
|
|
- ) a INNER JOIN
|
|
|
- (
|
|
|
- select uid, count(1) as secondCatagory from org_intellectual_property
|
|
|
- where uid = #{uid,jdbcType=VARCHAR} and evaluation_category = 1 and deleted_sign = 0 GROUP BY uid
|
|
|
- ) b on a.uid = b.uid
|
|
|
- ) x INNER JOIN
|
|
|
- (
|
|
|
- select uid, firm_total as firmTotal, tech_total as techTotal from org_human_resource where uid = #{uid,jdbcType=VARCHAR} and year =
|
|
|
- (SELECT (DATE_FORMAT(NOW(), '%Y')-1) FROM DUAL ) and deleted_sign = 0
|
|
|
- ) y on y.uid = x.uid
|
|
|
- INNER JOIN
|
|
|
- (
|
|
|
- SELECT uid,(operating_income + non_operating_income - non_taxable_income) as totalRevenue
|
|
|
- from org_ratepay where uid = #{uid,jdbcType=VARCHAR}
|
|
|
- and year = (SELECT (DATE_FORMAT(NOW(), '%Y')-1) FROM DUAL) and deleted_sign = 0
|
|
|
- ) z on z.uid = x.uid
|
|
|
+ <select id="selectCognizanceCatagoryBoByUidAndYear" resultType="com.goafanti.techservice.cognizance.bo.CognizanceCatagoryBo">
|
|
|
+ select u.id as uid, a.firstCatagory, b.secondCatagory, c.firmTotal, c.techTotal, d.totalRevenue FROM
|
|
|
+ (select id from user where id = #{1}) u
|
|
|
+ LEFT JOIN
|
|
|
+ (select uid, count(1) as firstCatagory from org_intellectual_property
|
|
|
+ where uid = #{1} and evaluation_category= 0 and deleted_sign = 0 GROUP BY uid
|
|
|
+ ) a on a.uid = u.id
|
|
|
+ LEFT JOIN
|
|
|
+ (
|
|
|
+ select uid, count(1) as secondCatagory from org_intellectual_property
|
|
|
+ where uid = #{1} and evaluation_category = 1 and deleted_sign = 0 GROUP BY uid
|
|
|
+ ) b on b.uid = u.id
|
|
|
+ LEFT JOIN
|
|
|
+ (
|
|
|
+ select uid, firm_total as firmTotal, tech_total as techTotal from org_human_resource where uid = #{1} and year =
|
|
|
+ #{0}-1 and deleted_sign = 0
|
|
|
+ ) c on c.uid = u.id
|
|
|
+ LEFT JOIN
|
|
|
+ (
|
|
|
+ SELECT uid,(operating_income + non_operating_income - non_taxable_income) as totalRevenue
|
|
|
+ from org_ratepay where uid = #{1}
|
|
|
+ and year = #{0}-1 and deleted_sign = 0
|
|
|
+ ) d on d.uid = u.id
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectLastYearRevenueByUid" parameterType="java.lang.String" resultType="java.math.BigDecimal">
|
|
|
+ <select id="selectLastYearRevenueByUidAndYear" resultType="java.math.BigDecimal">
|
|
|
SELECT sum(last_year_revenue) as lastYearRevenue
|
|
|
- from org_tech_product where uid = #{uid,jdbcType=VARCHAR}
|
|
|
- and year = (SELECT (DATE_FORMAT(NOW(), '%Y')-1) FROM DUAL) and deleted_sign = 0
|
|
|
+ from org_tech_product where uid = #{1}
|
|
|
+ and year = #{0} and deleted_sign = 0
|
|
|
</select>
|
|
|
</mapper>
|