浏览代码

Merge remote-tracking branch 'origin/20210716' into 20210716

hym 3 年之前
父节点
当前提交
904a285139

+ 10 - 0
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/DeviceMapper.java

@@ -8,6 +8,7 @@ import com.zcxk.rmcp.api.dto.install.InstallDeviceDto;
 import com.zcxk.rmcp.api.dto.measurementsettlement.MeasurementSettlementDto;
 import com.zcxk.rmcp.api.vo.*;
 import com.zcxk.rmcp.core.entity.Device;
+import com.zcxk.rmcp.core.entity.InstallList;
 import org.apache.ibatis.annotations.Param;
 import org.mapstruct.Mapper;
 
@@ -35,6 +36,15 @@ public interface DeviceMapper {
      **/
     int updateByPrimaryKeySelective(Device record);
 
+
+    /*
+     * @description 批量插入
+     * @param list
+     * @return
+     * @author linqingwei
+     **/
+    int batchInsert(@Param("list") List<Device> list);
+
     /*
      * @description 通过ID获取设备
      * @param id

+ 46 - 5
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/DeviceMapper.xml

@@ -237,9 +237,6 @@
       <if test="lastReceiveTime != null">
         #{lastReceiveTime},
       </if>
-      <if test="offlineDate != null">
-        #{offlineDate},
-      </if>
       <if test="userName != null">
         #{userName},
       </if>
@@ -258,6 +255,9 @@
       <if test="lastAlarmDate != null">
         #{lastAlarmDate},
       </if>
+      <if test="offlineDate != null">
+        #{offlineDate},
+      </if>
       <if test="acceptDate != null">
         #{acceptDate},
       </if>
@@ -394,6 +394,27 @@
     where id = #{id}
   </update>
 
+  <insert id="batchInsert" parameterType="map">
+    <!--@mbg.generated-->
+    insert into rmcp_device
+    (id, tenant_id, category_id, company_org_id, dept_org_id, product_id, device_no,
+    meter_no, file_no, seal_no, device_status, address, lng, lat, community_id, read_data,
+    valve_status, last_receive_time, user_name, user_phone, id_card, old_end_degree,
+    old_image_url, last_alarm_date, offline_date, accept_date, install_date, is_install,
+    is_accept, `status`, create_by, create_date, update_by, update_date)
+    values
+    <foreach collection="list" item="item" separator=",">
+      (#{item.id}, #{item.tenantId}, #{item.categoryId}, #{item.companyOrgId}, #{item.deptOrgId},
+      #{item.productId}, #{item.deviceNo}, #{item.meterNo}, #{item.fileNo}, #{item.sealNo},
+      #{item.deviceStatus}, #{item.address}, #{item.lng}, #{item.lat}, #{item.communityId},
+      #{item.readData}, #{item.valveStatus}, #{item.lastReceiveTime}, #{item.userName},
+      #{item.userPhone}, #{item.idCard}, #{item.oldEndDegree}, #{item.oldImageUrl}, #{item.lastAlarmDate},
+      #{item.offlineDate}, #{item.acceptDate}, #{item.installDate}, #{item.isInstall},
+      #{item.isAccept}, #{item.status}, #{item.createBy}, #{item.createDate}, #{item.updateBy},
+      #{item.updateDate})
+    </foreach>
+  </insert>
+
   <select id="findById" resultType="com.zcxk.rmcp.core.entity.Device">
   select <include refid="Base_Column_List"/> from rmcp_device where status = 1 and id = #{id}
   </select>
@@ -531,6 +552,26 @@
     order by rd.create_date desc
   </select>
 
+  <select id="findList_COUNT" resultType="Long">
+    select count(1)
+    from rmcp_device rd
+    <where>
+      rd.status = 1
+      <if test="dto.categoryId != null">and rd.category_id = #{dto.categoryId}</if>
+      <if test="dto.productId != null">and rd.product_id = #{dto.productId}</if>
+      <if test="dto.companyOrgId != null">and rd.company_org_id = #{dto.companyOrgId}</if>
+      <if test="dto.deptOrgId != null">and rd.dept_org_id = #{dto.deptOrgId}</if>
+      <if test="dto.communityId != null">and rd.community_id = #{dto.communityId}</if>
+      <if test="dto.deviceNo != null and dto.deviceNo != ''">and (rd.device_no LIKE concat('%',#{dto.deviceNo},'%') or rd.meter_no LIKE concat('%',#{dto.deviceNo},'%') )</if>
+      <if test="dto.address != null and dto.address != ''">and rd.address LIKE concat('%',#{dto.address},'%') </if>
+      <if test="dto.deviceStatus != null">and rd.device_status = #{dto.deviceStatus}</if>
+      <if test="dto.valveStatus != null">and rd.valve_status = #{dto.deviceStatus}</if>
+      <if test="dto.startDate != null"> and rd.last_receive_time <![CDATA[ >= ]]> #{dto.startDate}</if>
+      <if test="dto.endDate != null"> and rd.last_receive_time <![CDATA[ <= ]]> #{dto.endDate}</if>
+      <include refid="permissionCondition"/>
+    </where>
+  </select>
+
   <update id="delByIds">
     update rmcp_device set status = 0,update_date = NOW() where status = 1
     and id in <foreach collection="ids" item="item" open="(" separator="," close=")">#{item}</foreach>
@@ -759,8 +800,8 @@
                  left join rmcp_community rc on (rc.id = rd.community_id)
     <where>
     rd.status = 1
-      <if test="deviceNo != null and deviceNo != ''"> AND rd.device_no = #{deviceNo}</if>
-      <if test="meterNo != null and meterNo != ''"> AND rd.meter_no = #{meterNo}</if>
+    <if test="deviceNo != null and deviceNo != ''"> AND rd.device_no = #{deviceNo}</if>
+    <if test="meterNo != null and meterNo != ''"> AND rd.meter_no = #{meterNo}</if>
     <include refid="permissionCondition"/>
     </where>
   </select>

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/DeviceService.java

@@ -115,7 +115,7 @@ public interface DeviceService{
     void batchValve(List<Long> ids, Integer valveStatus);
 
     /**
-     * @description
+     * @description  查询设备信息列表
      * @param deviceNo
      * @param meterNo
      * @return