Browse Source

场景xml

wangyangyang 4 years ago
parent
commit
bbfc40e92a
1 changed files with 39 additions and 0 deletions
  1. 39 0
      sms_water/src/main/resources/mapper/SceneMapper.xml

+ 39 - 0
sms_water/src/main/resources/mapper/SceneMapper.xml

@@ -7,6 +7,7 @@
         <result property="id" column="id"/>
         <result property="tenantId" column="tenant_id"/>
         <result property="parentSceneId" column="parent_scene_id"/>
+        <result property="parentSceneIds" column="parent_scene_ids"/>
         <result property="sceneName" column="scene_name"/>
         <result property="companyOrgId" column="company_org_id"/>
         <result property="deptOrgId" column="dept_org_id"/>
@@ -29,6 +30,7 @@
          a.id as "id" ,
          a.tenant_id as "tenantId" ,
          a.parent_scene_id as "parentSceneId" ,
+         a.parent_scene_ids as "parentSceneIds" ,
          a.scene_name as "sceneName" ,
          a.company_org_id as "companyOrgId" ,
          a.dept_org_id as "deptOrgId" ,
@@ -115,6 +117,43 @@
             #{dramaId}
         </foreach>
     </select>
+    <select id="findByParentIdsLike" resultType="com.huaxu.entity.SceneEntity">
+        SELECT
+        <include refid="sceneColumns"/>
+        FROM sms_scene a
+        <where>
+            a.status=1
+            <if test="scene.tenantId != null  and scene.tenantId != ''">and a.tenant_id = #{scene.tenantId}</if>
+            <if test="scene.parentSceneIds != null ">and a.parent_scene_ids LIKE #{scene.parentSceneIds}</if>
+            <if test="scene.userType!=null and scene.userType!=-999 and scene.userType!=-9999 and  scene.programItems != null and scene.programItems.size() > 0">
+                <if test="scene.permissonType == 5 or scene.permissonType == 2">
+                    and ( a.DEPT_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    or
+                    a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    )
+                </if>
+                <if test="scene.permissonType == 4 or scene.permissonType == 3">
+                    and a.DEPT_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+                <if test="scene.permissonType == 1">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                    and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+                </if>
+            </if>
+        </where>
+    </select>
     <!--  根据获取实体 page   -->
     <select id="findPage" resultType="com.huaxu.entity.SceneEntity">
         SELECT