Browse Source

Merge branch 'master' of https://git.coding.net/aft/AFT.git

Antiloveg 8 years ago
parent
commit
00772d8fa2

+ 10 - 2
src/main/java/com/goafanti/common/mapper/CopyrightInfoMapper.xml

@@ -272,9 +272,12 @@
 	from copyright_info ci 
 	left join organization_identity oi on ci.uid = oi.uid
 	left join admin a on ci.principal = a.id
+	<if test="principal != null">
+	left join copyright_log cl on ci.id=cl.cid
+	</if>
 	where ci.delete_sign = 0
 	<if test="principal != null">
-			and ci.id in (SELECT l.pid FROM copyright_log l where l.principal = #{principal,jdbcType=VARCHAR})
+		and cl.principal = #{principal,jdbcType=VARCHAR})
 	</if>
 	<if test="province != null">
 	    and oi.location_province =  #{province,jdbcType=VARCHAR}
@@ -309,6 +312,7 @@
 	<if test="authEndTime != null">
 	    and ci.authorized_date <![CDATA[ < ]]> #{authEndTime,jdbcType=TIMESTAMP}
 	</if>
+	group by ci.id
 	order by ci.serial_number desc
   	<if test="page_sql!=null">
 		${page_sql}
@@ -319,9 +323,12 @@
   	select count(*)
 	from copyright_info ci 
 	left join organization_identity oi on ci.uid = oi.uid
+	<if test="principal != null">
+	left join copyright_log cl on ci.id=cl.cid
+	</if>
 	where ci.delete_sign = 0
 	<if test="principal != null">
-		and ci.id in (SELECT l.pid FROM copyright_log l where l.principal = #{principal,jdbcType=VARCHAR})
+		and cl.principal = #{principal,jdbcType=VARCHAR})
 	</if>
 	<if test="province != null">
 	    and oi.location_province =  #{province,jdbcType=VARCHAR}
@@ -356,6 +363,7 @@
 	<if test="authEndTime != null">
 	    and ci.authorized_date <![CDATA[ < ]]> #{authEndTime,jdbcType=TIMESTAMP}
 	</if>
+	group by ci.id
   </select>
   
   <update id="deleteByPrimaryKeys" parameterType="java.util.List">

+ 7 - 7
src/main/java/com/goafanti/copyright/service/impl/CopyrightInfoServiceImpl.java

@@ -39,7 +39,7 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
 	@Autowired
 	private OrgIntellectualPropertyMapper	orgIntellectualPropertyMapper;
 	@Autowired
-	private NoticeMapper noticeMapper;
+	private NoticeMapper					noticeMapper;
 
 	@Override
 	public CopyrightInfo insert(CopyrightInfo copyrightInfo) {
@@ -64,9 +64,9 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
 		if (copyrightLog.getRecordTime() != null && copyrightLog.getStatus() != null
 				&& copyrightLog.getPrincipal() != null) {
 			copyrightLogMapper.insertSelective(copyrightLog);
-			
+
 			createNotice(copyrightInfo, copyrightLog);
-			
+
 			if (CopyrightStatus.getStatus(copyrightLog.getStatus()) == CopyrightStatus.ACCEPT) {
 				copyrightInfo.setAcceptTime(copyrightLog.getRecordTime());
 			} else if (CopyrightStatus.getStatus(copyrightLog.getStatus()) == CopyrightStatus.DELIVERD) {
@@ -120,8 +120,8 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
 			CopyrightStatus status, String[] createTime, String[] acceptTime, String[] authTime, Integer pageNo,
 			Integer pageSize, String uid) {
 		Map<String, Object> params = new HashMap<>();
-		
-		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+
+		if (TokenManager.getAdminToken() != null && !TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
 			params.put("principal", TokenManager.getAdminId());
 		}
 		if (StringUtils.isNotBlank(province)) {
@@ -197,8 +197,8 @@ public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper
 	public void updateByPrimaryKey(CopyrightInfo copyrightInfo) {
 		copyrightInfoMapper.updateByPrimaryKey(copyrightInfo);
 	}
-	
-	private void createNotice(CopyrightInfo c, CopyrightLog l){
+
+	private void createNotice(CopyrightInfo c, CopyrightLog l) {
 		CopyrightInfo info = copyrightInfoMapper.selectByPrimaryKey(c.getId());
 		Notice n = new Notice();
 		Calendar now = Calendar.getInstance();