Browse Source

优化养护运营-智慧养护-统计分析-设备查询相关接口

develop
zhaoxianglong 6 months ago
parent
commit
4701f4030e
  1. 3
      zc-business/src/main/java/com/zc/business/controller/StatusController.java
  2. 9
      zc-business/src/main/java/com/zc/business/domain/Status.java
  3. 1
      zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java
  4. 4
      zc-business/src/main/java/com/zc/business/service/impl/StatusService.java
  5. 35
      zc-business/src/main/resources/mapper/business/StatusMapper.xml

3
zc-business/src/main/java/com/zc/business/controller/StatusController.java

@ -57,7 +57,8 @@ public class StatusController extends BaseController {
LocalDateTime currentTime = status.getTime().truncatedTo(ChronoUnit.DAYS).plusDays(1);
status.setStartTime(todayStart);
status.setTime(currentTime);
List<Status> listStatus = statusService.list(status);
status.setTypes(status.getType().split(","));
List<Status> listStatus = statusService.listStatusByTypes(status);
return getDataTable(listStatus);
}

9
zc-business/src/main/java/com/zc/business/domain/Status.java

@ -232,6 +232,7 @@ public class Status {
//@Excel(name = "类型")
private String type;
private String[] types;
private String orderByField;
private String orderDirection;
@ -267,4 +268,12 @@ public class Status {
public void setOrderByField(String orderByField) {
this.orderByField = orderByField;
}
public String[] getTypes() {
return types;
}
public void setTypes(String[] types) {
this.types = types;
}
}

1
zc-business/src/main/java/com/zc/business/mapper/StatusMapper.java

@ -20,5 +20,6 @@ public interface StatusMapper {
List<Status> listStatusBySection(@Param("status")Status status);
List<Status> export(@Param("status")Status status);
List<Status> deviceStatusListById(@Param("status")Status status);
List<Status> listStatusByTypes(@Param("status")Status status);
}

4
zc-business/src/main/java/com/zc/business/service/impl/StatusService.java

@ -41,4 +41,8 @@ public class StatusService {
public List<Status> deviceStatusListById(Status status) {
return statusMapper.deviceStatusListById(status);
}
public List<Status> listStatusByTypes(Status status) {
List<Status> list = statusMapper.listStatusByTypes(status);
return list;
}
}

35
zc-business/src/main/resources/mapper/business/StatusMapper.xml

@ -152,6 +152,41 @@
</select>
<select id="listStatusByTypes" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
select s.id, s.device_no, s.device_name, s.device_status,s.time,
d.device_ip,s.success_rate,s.lost_rate,d.direction,e.manufacturer,e.model,d.facilities_type,d.remark,COALESCE(d.child_type,
d.device_type) AS type
from dc_device d
LEFT JOIN status s on (s.device_id=d.id)
LEFT JOIN dc_product e on e.id=d.product_id
<where>
<if test="status.time != null">
AND s.time BETWEEN #{status.startTime,jdbcType=DATE} AND #{status.time,jdbcType=DATE}
</if>
<if test="status.deviceNo != null">
AND s.device_no = #{status.deviceNo}
</if>
<if test="status.type != null">
AND (d.device_type in
<foreach item="typeItem" collection="status.types" open="(" separator="," close=")">
#{typeItem}
</foreach>
or d.child_type in
<foreach item="typeItem" collection="status.types" open="(" separator="," close=")">
#{typeItem}
</foreach>
)
</if>
<if test="status.deviceId != null">
AND s.device_id = #{status.deviceId}
</if>
<if test="status.useState != null and status.useState != 0">
AND d.use_state = #{status.useState}
</if>
</where>
</select>
<select id="listStatusBySection" parameterType="com.zc.business.domain.Status" resultMap="BaseResultMap">
select s.id, s.device_no, s.device_name, s.device_status,s.time,
d.device_ip,s.success_rate,s.lost_rate,d.direction,e.manufacturer,e.model,d.facilities_type,m.section_id,d.remark,COALESCE(d.child_type,

Loading…
Cancel
Save