|
@@ -92,6 +92,59 @@
|
|
|
</where>
|
|
|
order by a.date_create
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="findListByTypeName" resultType="com.bz.zoneiot.water.core.entity.SceneEntity">
|
|
|
+ SELECT
|
|
|
+ <include refid="sceneColumns"/>
|
|
|
+ FROM sms_scene a
|
|
|
+ <include refid="deviceJoins"/>
|
|
|
+ <where>
|
|
|
+ a.status=1
|
|
|
+ <if test="user.companyOrgId!=null and user.deptOrgId!=null">
|
|
|
+ and a.DEPT_ORG_ID = #{user.deptOrgId} and a.COMPANY_ORG_ID = #{user.companyOrgId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="user.companyOrgId!=null and user.deptOrgId == null">
|
|
|
+ and a.DEPT_ORG_ID is null and a.COMPANY_ORG_ID = #{user.companyOrgId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="user.tenantId != null and user.tenantId != ''">and a.tenant_id = #{user.tenantId}</if>
|
|
|
+ <if test="typeNames != null ">
|
|
|
+ and s.scene_type_name in
|
|
|
+ <foreach collection="typeNames" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="user.userType!=null and user.userType!=-999 and user.userType!=-9999 and user.programItems != null and user.programItems.size() > 0">
|
|
|
+ <if test="user.permissionType == 5 or user.permissionType == 2">
|
|
|
+ and ( a.DEPT_ORG_ID in
|
|
|
+ <foreach collection="user.programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ or
|
|
|
+ a.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="user.programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="user.permissionType == 4 or user.permissionType == 3">
|
|
|
+ and a.DEPT_ORG_ID in
|
|
|
+ <foreach collection="user.programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="user.permissionType == 1">
|
|
|
+ and a.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="user.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>
|
|
|
+ order by a.date_create
|
|
|
+ </select>
|
|
|
<!-- 根据主键获取租户菜单 -->
|
|
|
<select id="findBySceneTypeIds" resultType="com.bz.zoneiot.water.core.entity.SceneEntity">
|
|
|
select a.id
|