| 
					
				 | 
			
			
				@@ -167,6 +167,14 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </otherwise> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </choose> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <sql id="pageRoleIncludeReuqest"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        select distinct p1.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from core_edu_training_plan p1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 inner join core_edu_training_plan_to_role r1 on p1.id = r1.plan_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where p1.deleted = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          and p1.plan_status = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          and r1.role_id = #{request.planRoleId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <insert id="insertCoreEduTrainingPlan" parameterType="com.xunmei.common.core.domain.edu.domain.CoreEduTrainingPlan" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             useGeneratedKeys="true" keyProperty="id"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         insert into core_edu_training_plan 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -441,24 +449,23 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         p.standard, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         P.belong_org_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         P.belong_org_name from core_edu_training_plan p left join sys_user u on p.update_by=u.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <if test="request.planRoleId!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            left join (select id from core_edu_training_plan p1 inner join core_edu_training_plan_to_role r1 on p1.id = 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            r1.plan_id where r1.role_id = #{request.planRoleId} and p1.deleted=0) t on p.id = t.id and p.deleted=0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where p.deleted = 0 and p.parent_id is null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         and p.standard=1 and p.issue=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="request.planRoleId!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and p.id in ( <include refid="pageRoleIncludeReuqest"/>) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         and p.id in ( select sp.parent_id from core_edu_training_plan sp where sp.deleted = 0 and sp.parent_id is not 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         null<include refid="pageIncludeSP"/>) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <!-- 不是标准计划但是也没下发: 行社自建的计划 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         or ( p.standard=0 and p.issue=0 and p.deleted=0 and p.parent_id is null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <if test="request.planRoleId!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            and p.id in ( select distinct r.plan_id from core_edu_training_plan_to_role r where r.role_id =  #{request.planRoleId}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and p.id in ( <include refid="pageRoleIncludeReuqest"/>) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="pageIncludeP"/>) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <!-- 是标准计划但是未下发 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         or ( p.standard=1 and p.issue=0 and p.deleted=0 and p.parent_id is null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <if test="request.planRoleId!=null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            and p.id in ( select distinct r.plan_id from core_edu_training_plan_to_role r where r.role_id =  #{request.planRoleId}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and p.id in ( <include refid="pageRoleIncludeReuqest"/>) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="pageIncludeP"/>) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 |