Antiloveg 8 years ago
parent
commit
56a86f894e

+ 1 - 4
src/main/java/com/goafanti/cognizance/service/impl/OrgIntellectualPropertyServiceImpl.java

@@ -14,7 +14,6 @@ import com.goafanti.cognizance.bo.AnnualReportPropertyRightBo;
 import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
 import com.goafanti.cognizance.service.OrgIntellectualPropertyService;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.OrgAnnualReportMapper;
 import com.goafanti.common.dao.OrgIntellectualPropertyMapper;
 import com.goafanti.common.model.OrgIntellectualProperty;
 import com.goafanti.common.utils.DateUtils;
@@ -26,8 +25,6 @@ public class OrgIntellectualPropertyServiceImpl extends BaseMybatisDao<OrgIntell
 		implements OrgIntellectualPropertyService {
 	@Autowired
 	private OrgIntellectualPropertyMapper orgIntellectualPropertyMapper;
-	@Autowired
-	private OrgAnnualReportMapper orgAnnualReportMapper;
 
 	@Override
 	public OrgIntellectualProperty insert(OrgIntellectualProperty orgIntellectualProperty) {
@@ -116,7 +113,7 @@ public class OrgIntellectualPropertyServiceImpl extends BaseMybatisDao<OrgIntell
 
 	@Override
 	public AnnualReportPropertyRightBo selectIntellectualPropertyCount(Integer year, String uid) {
-		AnnualReportPropertyRightBo p = orgAnnualReportMapper.selectAnnualReportPropertyRightBoByYearAndUid(year, uid);
+		AnnualReportPropertyRightBo p = orgIntellectualPropertyMapper.selectIntellectualPropertyCount(year, uid);
 		if (null != p) {
 			p.setInventionPatent(null == p.getInventionPatent() ? 0 : p.getInventionPatent());
 			p.setDefensePatent(null == p.getDefensePatent() ? 0 : p.getDefensePatent());

+ 3 - 0
src/main/java/com/goafanti/common/dao/OrgIntellectualPropertyMapper.java

@@ -2,6 +2,7 @@ package com.goafanti.common.dao;
 
 import java.util.List;
 
+import com.goafanti.cognizance.bo.AnnualReportPropertyRightBo;
 import com.goafanti.cognizance.bo.OrgIntellectualPropertyDetailBo;
 import com.goafanti.common.model.OrgIntellectualProperty;
 
@@ -27,4 +28,6 @@ public interface OrgIntellectualPropertyMapper {
 	OrgIntellectualPropertyDetailBo selectCopyrightTypeDetail(String id);
 
 	List<OrgIntellectualProperty> selectIntellectualPropertyList(Integer year, String uid);
+
+	AnnualReportPropertyRightBo selectIntellectualPropertyCount(Integer year, String uid);
 }

+ 94 - 94
src/main/java/com/goafanti/common/mapper/OrgAnnualReportMapper.xml

@@ -209,100 +209,100 @@
   
   <select id="selectAnnualReportPropertyRightBoByYearAndUid" resultType="com.goafanti.cognizance.bo.AnnualReportPropertyRightBo">
   	select u.id as uid, a.utilityPatent, b.exteriorPatent, c.softwareWorks, d.defensePatent, e.newPlantCariety, f.nationalCrop,
-g.nationalDrug, h.chineseMedicine, i.circuitDesign, j.inventionPatent from 
-(
-select id from user where id = #{1}
-) u LEFT JOIN
-
-(
-	select uid, count(1) as utilityPatent 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 2 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) a on a.uid = u.id  
-LEFT JOIN
-(
-select uid, count(1) as exteriorPatent 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 3 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) b on u.id = b.uid 
-LEFT JOIN
-(
-	select uid, count(1) as softwareWorks 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 4 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) c on u.id = c.uid  
-LEFT JOIN
-(
-select uid, count(1) as defensePatent 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 5 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) d on u.id = d.uid 
-LEFT JOIN
-(
-	select uid, count(1) as newPlantCariety 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 6 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) e on u.id = e.uid  
-LEFT JOIN
-(
-select uid, count(1) as nationalCrop 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 7 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) f on u.id = f.uid 
-LEFT JOIN
-(
-	select uid, count(1) as nationalDrug 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 8 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) g on u.id = g.uid  
-LEFT JOIN
-(
-select uid, count(1) as chineseMedicine 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 9 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) h on u.id = h.uid 
-LEFT JOIN
-(
-	select uid, count(1) as circuitDesign 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 10 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) i on u.id = i.uid  
-LEFT JOIN
-(
-select uid, count(1) as inventionPatent 
-	from org_intellectual_property 
-	where uid = #{1} and catagory = 11 and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
-				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
-	and deleted_sign = 0
-) j on u.id = j.uid 
+		g.nationalDrug, h.chineseMedicine, i.circuitDesign, j.inventionPatent from 
+		(
+		select id from user where id = #{1}
+		) u LEFT JOIN
+		
+		(
+			select uid, count(1) as utilityPatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 2 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) a on a.uid = u.id  
+		LEFT JOIN
+		(
+		select uid, count(1) as exteriorPatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 3 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) b on u.id = b.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as softwareWorks 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 4 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) c on u.id = c.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as defensePatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 5 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) d on u.id = d.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as newPlantCariety 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 6 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) e on u.id = e.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as nationalCrop 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 7 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) f on u.id = f.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as nationalDrug 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 8 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) g on u.id = g.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as chineseMedicine 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 9 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) h on u.id = h.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as circuitDesign 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 10 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) i on u.id = i.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as inventionPatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 11 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) j on u.id = j.uid 
   </select>
   
   <select id="selectAnnualReportTerritoryByYearAndUid" resultType="java.math.BigDecimal">

+ 99 - 1
src/main/java/com/goafanti/common/mapper/OrgIntellectualPropertyMapper.xml

@@ -276,8 +276,106 @@
     <include refid="Base_Column_List" />
     from org_intellectual_property
     where uid = #{1} and authorization_date 
-		 >= (select  str_to_date(CONCAT(#{0},'-01-01'), '%Y-%m-%d %H'))
+		 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H'))
 				and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
 	and deleted_sign = 0 order by authorization_date
   </select>
+  
+   <select id="selectIntellectualPropertyCount" resultType="com.goafanti.cognizance.bo.AnnualReportPropertyRightBo">
+  	select u.id as uid, a.utilityPatent, b.exteriorPatent, c.softwareWorks, d.defensePatent, e.newPlantCariety, f.nationalCrop,
+		g.nationalDrug, h.chineseMedicine, i.circuitDesign, j.inventionPatent from 
+		(
+		select id from user where id = #{1}
+		) u LEFT JOIN
+		
+		(
+			select uid, count(1) as utilityPatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 2 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) a on a.uid = u.id  
+		LEFT JOIN
+		(
+		select uid, count(1) as exteriorPatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 3 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) b on u.id = b.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as softwareWorks 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 4 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) c on u.id = c.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as defensePatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 5 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) d on u.id = d.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as newPlantCariety 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 6 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) e on u.id = e.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as nationalCrop 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 7 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) f on u.id = f.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as nationalDrug 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 8 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) g on u.id = g.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as chineseMedicine 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 9 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) h on u.id = h.uid 
+		LEFT JOIN
+		(
+			select uid, count(1) as circuitDesign 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 10 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) i on u.id = i.uid  
+		LEFT JOIN
+		(
+		select uid, count(1) as inventionPatent 
+			from org_intellectual_property 
+			where uid = #{1} and catagory = 11 and authorization_date 
+				 >= (select  str_to_date(CONCAT(#{0}-2,'-01-01'), '%Y-%m-%d %H') )
+						and authorization_date  <![CDATA[ < ]]> (select  str_to_date(CONCAT(#{0}+1,'-01-01'), '%Y-%m-%d %H'))
+			and deleted_sign = 0
+		) j on u.id = j.uid 
+  </select>
 </mapper>