| 
					
				 | 
			
			
				@@ -18,7 +18,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="createBy" column="create_by" jdbcType="VARCHAR"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="updateBy" column="update_by" jdbcType="VARCHAR"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <result property="status" column="status" jdbcType="VARCHAR"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result property="status" column="status" jdbcType="INTEGER"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="taskId" column="task_id" jdbcType="INTEGER"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </resultMap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -46,59 +46,61 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectList" resultType="com.zcxk.rmcp.api.dto.measurementSettlement.MeasurementSettlementDto"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="Base_Column_List"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        from rmcp_measurement_settlement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from rmcp_measurement_settlement ms 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="id != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and id = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            status=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.id != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and id = #{measurement.id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="planName != null and planName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and plan_name = #{planName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.planName != null and measurement.planName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and plan_name  like concat('%',#{measurement.planName} ,'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="settlementTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and settlement_time = #{settlementTime} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.settlementTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and settlement_time = #{measurement.settlementTime} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="companyOrgId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and company_org_id = #{companyOrgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.companyOrgId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and company_org_id = #{measurement.companyOrgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="deptOrgId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and dept_org_id = #{deptOrgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.deptOrgId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and dept_org_id = #{measurement.deptOrgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="communityId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and community_id = #{communityId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.communityId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and community_id = #{measurement.communityId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="totalWaterMeters != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and total_water_meters = #{totalWaterMeters} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.totalWaterMeters != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and total_water_meters = #{measurement.totalWaterMeters} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="numberOfWaterMetersReviewed != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and number_of_water_meters_reviewed = #{numberOfWaterMetersReviewed} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.numberOfWaterMetersReviewed != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and number_of_water_meters_reviewed = #{measurement.numberOfWaterMetersReviewed} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="billingPeriod != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and billing_period = #{billingPeriod} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.billingPeriod != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and billing_period = #{measurement.billingPeriod} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="billingCycle != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and billing_cycle = #{billingCycle} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.billingCycle != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and billing_cycle = #{measurement.billingCycle} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="planStatus != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and plan_status = #{planStatus} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.planStatus != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and plan_status = #{measurement.planStatus} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="createDate != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and create_date = #{createDate} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.createDate != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and create_date = #{measurement.createDate} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="updateDate != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and update_date = #{updateDate} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.updateDate != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and update_date = #{measurement.updateDate} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="createBy != null and createBy != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and create_by = #{createBy} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.createBy != null and measurement.createBy != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and create_by = #{measurement.createBy} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="updateBy != null and updateBy != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and update_by = #{updateBy} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.updateBy != null and measurement.updateBy != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and update_by = #{measurement.updateBy} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="status != null and status != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and status = #{status} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.status != null and measurement.status != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and status = #{measurement.status} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="taskId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                and task_id = #{taskId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.taskId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and task_id = #{measurement.taskId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <include refid="permissionCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -107,10 +109,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         insert into rmcp_measurement_settlement(id, plan_name, settlement_time, company_org_id, dept_org_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 community_id, total_water_meters, number_of_water_meters_reviewed, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                 billing_period, billing_cycle, plan_status, create_date, update_date, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                create_by, update_by, status, task_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                create_by, update_by, status, task_id,tenant_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         values (#{id}, #{planName}, #{settlementTime}, #{companyOrgId}, #{deptOrgId}, #{communityId}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 #{totalWaterMeters}, #{numberOfWaterMetersReviewed}, #{billingPeriod}, #{billingCycle}, #{planStatus}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                #{createDate}, #{updateDate}, #{createBy}, #{updateBy}, #{status}, #{taskId}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #{createDate}, #{updateDate}, #{createBy}, #{updateBy}, #{status}, #{taskId},#{tenantId}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 批量新增 --> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -174,7 +176,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="updateBy != null and updateBy != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 update_by = #{updateBy}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="status != null and status != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="status != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 status = #{status}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="taskId != null"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -183,7 +185,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </set> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where id = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <update id="setBillingPeriod"></update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <update id="setBillingPeriod"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        update rmcp_measurement_settlement set billing_period=#{billingPeriod} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where id=#{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!--通过主键删除--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <delete id="deleteById"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -191,8 +196,19 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         from rmcp_measurement_settlement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where id = #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <delete id="deletePlan"></delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <delete id="deleteAll"></delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <update id="deletePlan"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        update rmcp_measurement_settlement set status=0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where id  in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <foreach collection="list" item="item" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <update id="deleteAll"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        update rmcp_measurement_settlement ms set status=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <include refid="permissionCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </update> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 总数 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="count" resultType="int"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -201,5 +217,95 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectRecordList" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            resultType="com.zcxk.rmcp.api.dto.measurementSettlement.MeasurementSettlementDto"></select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resultType="com.zcxk.rmcp.api.dto.measurementSettlement.MeasurementSettlementDto"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <include refid="Base_Column_List"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from rmcp_measurement_settlement ms 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        status=1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.id != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and id = #{measurement.id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.planName != null and measurement.planName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and plan_name  like concat('%',#{measurement.planName} ,'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.settlementTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and settlement_time = #{measurement.settlementTime} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.companyOrgId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and company_org_id = #{measurement.companyOrgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.deptOrgId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and dept_org_id = #{measurement.deptOrgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.communityId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and community_id = #{measurement.communityId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.totalWaterMeters != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and total_water_meters = #{measurement.totalWaterMeters} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.numberOfWaterMetersReviewed != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and number_of_water_meters_reviewed = #{measurement.numberOfWaterMetersReviewed} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.billingPeriod != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and billing_period = #{measurement.billingPeriod} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.billingCycle != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and billing_cycle = #{measurement.billingCycle} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.planStatus ==1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and plan_status in(1,2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.createDate != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and create_date = #{measurement.createDate} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.updateDate != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and update_date = #{measurement.updateDate} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.createBy != null and measurement.createBy != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and create_by = #{measurement.createBy} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.updateBy != null and measurement.updateBy != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and update_by = #{measurement.updateBy} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.status != null and measurement.status != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and status = #{measurement.status} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="measurement.taskId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and task_id = #{measurement.taskId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <include refid="permissionCondition"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <sql id="permissionCondition"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="userCondition.tenantId != null">and ms.tenant_id = #{userCondition.tenantId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="userCondition.userType!=null and userCondition.userType!=-999 and userCondition.userType!=-9999 and  userCondition.programItems != null and userCondition.programItems.size() > 0"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="userCondition.permissionType == 5 or userCondition.permissionType == 2"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and ( ms.dept_org_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #{item.orgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                or 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ms.company_org_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #{item.orgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="userCondition.permissionType == 4 or userCondition.permissionType == 3"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and ms.dept_org_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #{item.orgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="userCondition.permissionType == 1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and ms.company_org_id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <foreach collection="userCondition.programItems" item="item" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #{item.orgId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                and (ms.dept_org_id is null or ms.dept_org_id =0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </sql> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </mapper> 
			 |