|  | @@ -57,10 +57,10 @@
 | 
	
		
			
				|  |  |          <if test="deviceDto.condition != null and deviceDto.condition != ''">
 | 
	
		
			
				|  |  |              and (device_code like concat('%', #{deviceDto.condition},'%') or device_name like concat('%', #{deviceDto.condition},'%'))
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="deviceDto.companyOrgId != null ">
 | 
	
		
			
				|  |  | +        <if test="deviceDto.companyOrgId != null and deviceDto.companyOrgId != 0 ">
 | 
	
		
			
				|  |  |              and d.COMPANY_ORG_ID=#{deviceDto.companyOrgId}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="deviceDto.deptOrgId != null ">
 | 
	
		
			
				|  |  | +        <if test="deviceDto.deptOrgId != null and deviceDto.deptOrgId != 0 ">
 | 
	
		
			
				|  |  |              and d.DEPT_ORG_ID =#{deviceDto.deptOrgId}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="deviceDto.sceneIds != null and deviceDto.sceneIds.size() > 0">
 | 
	
	
		
			
				|  | @@ -105,8 +105,16 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 新增所有列 -->
 | 
	
		
			
				|  |  |      <insert id="insert" keyProperty="id" useGeneratedKeys="true">
 | 
	
		
			
				|  |  | -        INSERT INTO  sms_device ( TENANT_ID ,  DEVICE_CODE ,  DEVICE_NAME ,  DEVICE_TYPE_ID ,  COMPANY_ORG_ID ,  DEPT_ORG_ID ,  SCENE_ID ,  POINT_X ,  POINT_Y ,  ENABLE_STATE ,  LAST_UPDATE_TIME ,  ADDRESS ,  REMARK ,  STATUS ,  DATE_CREATE ,  CREATE_BY ,  DATE_UPDATE ,  UPDATE_BY )
 | 
	
		
			
				|  |  | -        VALUES ( #{tenantId} ,#{deviceCode} ,#{deviceName}  ,#{deviceTypeId} ,#{companyOrgId} ,#{deptOrgId} ,#{sceneId} ,#{pointX} ,#{pointY} ,#{enableState} ,#{lastUpdateTime} ,#{address} ,#{remark} ,#{status} ,#{dateCreate} ,#{createBy} ,#{dateUpdate} ,#{updateBy})
 | 
	
		
			
				|  |  | +        INSERT INTO  sms_device ( TENANT_ID ,  DEVICE_CODE ,  DEVICE_NAME ,  DEVICE_TYPE_ID ,
 | 
	
		
			
				|  |  | +        <if test="companyOrgId != null and companyOrgId != 0">COMPANY_ORG_ID , </if>
 | 
	
		
			
				|  |  | +        <if test="companyOrgId != null and companyOrgId != 0">DEPT_ORG_ID ,</if>
 | 
	
		
			
				|  |  | +        <if test="companyOrgId != null and companyOrgId != 0">SCENE_ID ,</if>
 | 
	
		
			
				|  |  | +        POINT_X ,  POINT_Y ,  ENABLE_STATE ,  LAST_UPDATE_TIME ,  ADDRESS ,  REMARK ,  STATUS ,  DATE_CREATE ,  CREATE_BY ,  DATE_UPDATE ,  UPDATE_BY )
 | 
	
		
			
				|  |  | +        VALUES ( #{tenantId} ,#{deviceCode} ,#{deviceName}  ,#{deviceTypeId} ,
 | 
	
		
			
				|  |  | +        <if test="companyOrgId != null and companyOrgId != 0">#{companyOrgId}  , </if>
 | 
	
		
			
				|  |  | +        <if test="deptOrgId != null and deptOrgId != 0"> #{deptOrgId} , </if>
 | 
	
		
			
				|  |  | +        <if test="sceneId != null and sceneId != 0">#{sceneId} , </if>
 | 
	
		
			
				|  |  | +        #{pointX} ,#{pointY} ,#{enableState} ,#{lastUpdateTime} ,#{address} ,#{remark} ,#{status} ,#{dateCreate} ,#{createBy} ,#{dateUpdate} ,#{updateBy})
 | 
	
		
			
				|  |  |     </insert>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 批量新增 -->
 | 
	
	
		
			
				|  | @@ -131,14 +139,14 @@
 | 
	
		
			
				|  |  |          <if test="deviceName != null and deviceName != '' ">
 | 
	
		
			
				|  |  |              DEVICE_NAME  = #{deviceName},
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="deviceTypeId != null ">
 | 
	
		
			
				|  |  | +        <if test="deviceTypeId != null and deviceTypeId != 0">
 | 
	
		
			
				|  |  |              DEVICE_TYPE_ID  = #{deviceTypeId},
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="companyOrgId != null ">
 | 
	
		
			
				|  |  | +        <if test="companyOrgId != null and companyOrgId != 0">
 | 
	
		
			
				|  |  |              COMPANY_ORG_ID  = #{companyOrgId},
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |              DEPT_ORG_ID  = #{deptOrgId},
 | 
	
		
			
				|  |  | -        <if test="sceneId != null ">
 | 
	
		
			
				|  |  | +        <if test="sceneId != null  and sceneId != 0">
 | 
	
		
			
				|  |  |              SCENE_ID  = #{sceneId},
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="pointX != null ">
 | 
	
	
		
			
				|  | @@ -196,10 +204,10 @@
 | 
	
		
			
				|  |  |          <if test="deviceDto.condition != null and deviceDto.condition != ''">
 | 
	
		
			
				|  |  |              and (device_code like concat('%', #{deviceDto.condition},'%') or device_name like concat('%', #{deviceDto.condition},'%'))
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="deviceDto.companyOrgId != null ">
 | 
	
		
			
				|  |  | +        <if test="deviceDto.companyOrgId != null and deviceDto.companyOrgId != 0">
 | 
	
		
			
				|  |  |              and d.COMPANY_ORG_ID=#{deviceDto.companyOrgId}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | -        <if test="deviceDto.deptOrgId != null ">
 | 
	
		
			
				|  |  | +        <if test="deviceDto.deptOrgId != null and deviceDto.deptOrgId != 0">
 | 
	
		
			
				|  |  |              and d.DEPT_ORG_ID =#{deviceDto.deptOrgId}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="deviceDto.sceneIds != null and deviceDto.sceneIds.size() > 0">
 |