Przeglądaj źródła

场景增加联动接口

wangyangyang 4 lat temu
rodzic
commit
de07361a40

+ 15 - 0
sms_water/src/main/java/com/huaxu/controller/SceneController.java

@@ -61,6 +61,21 @@ public class SceneController {
         return new AjaxMessage<>(ResultStatus.OK, menuEntities);
     }
 
+    @ApiOperation(value = "查询场景树")
+    @RequestMapping(value = "/selectListForParm", method = RequestMethod.POST)
+    @ResponseBody
+    public AjaxMessage<List<SceneEntity>> selectListForParm(@RequestParam(required = false) Long comId,@RequestParam(required = false) Long deptId) {
+        if (comId != null) {
+            SceneEntity sceneEntity = new SceneEntity();
+            sceneEntity.setCompanyOrgId(comId);
+            sceneEntity.setDeptOrgId(deptId);
+            List<SceneEntity> menuEntities = sceneService.findAllList(sceneEntity);
+            return new AjaxMessage<>(ResultStatus.OK, menuEntities);
+        } else {
+            return new AjaxMessage<>(ResultStatus.OK);
+        }
+    }
+
     /**
      * 新增
      */

+ 10 - 2
sms_water/src/main/resources/mapper/SceneMapper.xml

@@ -68,6 +68,14 @@
         <include refid="deviceJoins"/>
         <where>
             a.status=1
+            <if test="scene.companyOrgId!=null and scene.deptOrgId!=null">
+               and a.DEPT_ORG_ID = #{scene.deptOrgId} and a.COMPANY_ORG_ID = #{scene.companyOrgId}
+            </if>
+
+            <if test="scene.companyOrgId!=null and scene.deptOrgId == null">
+                and a.DEPT_ORG_ID is null and a.COMPANY_ORG_ID = #{scene.companyOrgId}
+            </if>
+
             <if test="scene.tenantId != null  and scene.tenantId != ''">and a.tenant_id = #{scene.tenantId}</if>
             <if test="scene.parentSceneId != null ">and a.parent_scene_id = #{scene.parentSceneId}</if>
             <if test="scene.sceneName != null  and scene.sceneName != ''">
@@ -169,7 +177,7 @@
         FROM sms_scene a
         <include refid="deviceJoins"/>
         <where>
-            a.status=1 and a.parent_scene_id=0
+            a.status=1
             <if test="scene.tenantId != null  and scene.tenantId != ''">and a.tenant_id = #{scene.tenantId}</if>
             <if test="scene.parentSceneId != null ">and a.parent_scene_id = #{scene.parentSceneId}</if>
             <if test="scene.sceneName != null  and scene.sceneName != ''">
@@ -204,6 +212,6 @@
                 </if>
             </if>
         </where>
-        order by  a.date_create
+        order by  a.date_create  desc
     </select>
 </mapper>