Bläddra i källkod

联锁历史数据查询接口修改

sl 9 månader sedan
förälder
incheckning
af618d7e1c

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/mapper/xml/InterlockDetailMapper.xml

@@ -116,7 +116,7 @@
         left join interlock_base_hy h3 on h3.instrument_status = d.instrument_status and h3.interlock_system_id = s.interlock_system_id
         left join interlock_base_hy h4 on h4.control_system_status = d.control_system_status and h4.interlock_system_id = s.interlock_system_id
         left join interlock_base h on h.id = s.interlock_system_id
-        inner join (select l.* from interlock_system_limit l where l.interlock_user_id in
+        left join (select l.* from interlock_system_limit l where l.interlock_user_id in
         (select u.id from interlock_user u where u.username=#{wiseUser})) qxnr on qxnr.interlock_system_id = s.interlock_system_id
         <where>
             and (qxnr.limit_type='0' or qxnr.limit_type='1')

+ 21 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/controller/InterlockDetailHistoryController.java

@@ -281,4 +281,25 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
         return super.importExcel(request, response, InterlockDetailHistory.class);
     }
 
+
+	/**
+	 * 联锁历史数据——各种逻辑状态分页查询  添加权限
+	 */
+	@ApiOperation(".联锁历史数据——各种逻辑状态分页查询  添加权限")
+	@GetMapping("/listHistoryByUser")
+	public Result<IPage<InterlockSummaryHistoryVO>> listHistoryByUser(InterlockHistoryQueryDTO dto,
+														 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+														 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+														 HttpServletRequest request){
+		long startTime = System.currentTimeMillis();
+		Page<InterlockSummaryHistoryVO> page = new Page<>(pageNo,pageSize);
+		IPage<InterlockSummaryHistoryVO> pageList = interlockDetailHistoryService.getPageByUser(request, page, dto);
+		long endTime = System.currentTimeMillis();
+		long duration = endTime - startTime;
+		String log = "联锁历史数据各种逻辑状态程序运行时间(毫秒):" + duration;
+		System.out.println(log);
+//		interlockDetailMapper.insertIntoTimeTestLog("联锁历史数据逻辑状态",duration);
+		return Result.OK(pageList);
+	}
+
 }

+ 6 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/InterlockDetailHistoryMapper.java

@@ -46,4 +46,10 @@ public interface InterlockDetailHistoryMapper extends BaseMapper<InterlockDetail
      *   date: 2024/6/18
      */
     List<InterlockDetailHistory> getYbStatusListBySummaryIdAndTagTime(@Param("id") String id,@Param("yesterday") String yesterday);
+
+    /**
+     * 联锁历史数据——各种逻辑状态分页查询   添加权限
+     */
+    IPage<InterlockSummaryHistoryVO> getPageByUser(Page<InterlockSummaryHistoryVO> page, InterlockHistoryQueryDTO dto, String wiseUser);
+
 }

+ 35 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/xml/InterlockDetailHistoryMapper.xml

@@ -159,4 +159,39 @@
     </select>
 
 
+    <!-- 联锁总历史数据表-分页列表查询(各种逻辑状态)   添加权限-->
+    <select id="getPageByUser" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryVO">
+        select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.instrument_status, d.control_system_status,
+        s.interlock_status, s.loop_health_level, d.bypass, s.tag_time, d.summary_origin_id, s.interlock_apparatus_id, s.interlock_system_id,
+        h1.interlock_status_name, h2.bypass_name,
+        h3.instrument_status_name, h4.control_system_status_name,
+        h.instrument_status_normal, h.bypass_yes, h.interlock_status_ty, h.control_system_status_normal
+        from interlock_detail_history d
+        left join interlock_summary_history s on d.summaryid = s.id
+        left join interlock_base_hy h1 on h1.interlock_status = s.interlock_status and h1.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h2 on h2.bypass = d.bypass and h2.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h3 on h3.instrument_status = d.instrument_status and h3.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h4 on h4.control_system_status = d.control_system_status and h4.interlock_system_id = s.interlock_system_id
+        left join interlock_base h on h.id = s.interlock_system_id
+        left join (select l.* from interlock_system_limit l where l.interlock_user_id in
+        (select u.id from interlock_user u where u.username=#{wiseUser})) qxnr on qxnr.interlock_system_id = s.interlock_system_id
+        <where>
+            and (qxnr.limit_type='0' or qxnr.limit_type='1')
+            <if test="dto.interlockSystemId != null and dto.interlockSystemId != ''"> and s.interlock_system_id =  #{dto.interlockSystemId}</if>
+            <if test="dto.interlockApparatusId != null and dto.interlockApparatusId != ''"> and s.interlock_apparatus_id =  #{dto.interlockApparatusId}</if>
+
+            <if test="dto.interlockname != null and dto.interlockname != ''"> and d.interlockname like concat('%', #{dto.interlockname}, '%')</if>
+            <if test="dto.interlockCondition != null and dto.interlockCondition != ''"> and d.interlock_condition = #{dto.interlockCondition}</if>
+            <if test="dto.interlockConditionTag != null and dto.interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%',#{dto.interlockConditionTag},'%')</if>
+            <if test="dto.instrumentStatus != null and dto.instrumentStatus != ''"> and d.instrument_status = #{dto.instrumentStatus}</if>
+            <if test="dto.controlSystemStatus != null and dto.controlSystemStatus != ''"> and d.control_system_status = #{dto.controlSystemStatus}</if>
+            <if test="dto.interlockStatus != null and dto.interlockStatus != ''"> and s.interlock_status = #{dto.interlockStatus}</if>
+            <if test="dto.loopHealthLevel != null and dto.loopHealthLevel != ''"> and s.loop_health_level = #{dto.loopHealthLevel}</if>
+            <if test="dto.beginTime != null"> and s.tag_time &gt; #{dto.beginTime} </if>
+            <if test="dto.endTime != null"> and s.tag_time &lt; #{dto.endTime} </if>
+            <if test="dto.bypass != null and dto.bypass != ''"> and d.bypass = #{dto.bypass}</if>
+        </where>
+        order by s.tag_time desc
+    </select>
+
 </mapper>

+ 5 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/IInterlockDetailHistoryService.java

@@ -57,4 +57,9 @@ public interface IInterlockDetailHistoryService extends IService<InterlockDetail
     *   date: 2024/6/18
     */
     List<InterlockDetailHistory> getYbStatusListBySummaryIdAndTagTime(String id, String yesterday);
+
+    /**
+     * 联锁历史数据——各种逻辑状态分页查询  添加权限
+     */
+    IPage<InterlockSummaryHistoryVO> getPageByUser(HttpServletRequest request, Page<InterlockSummaryHistoryVO> page, InterlockHistoryQueryDTO dto);
 }

+ 19 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/impl/InterlockDetailHistoryServiceImpl.java

@@ -20,6 +20,8 @@ import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -422,5 +424,22 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
     }
 
 
+    /**
+     * 联锁历史数据——各种逻辑状态分页查询   添加权限
+     */
+    public IPage<InterlockSummaryHistoryVO> getPageByUser(HttpServletRequest request, Page<InterlockSummaryHistoryVO> page, InterlockHistoryQueryDTO dto){
+        String wiseUser = "";
+        //获取当前用户名
+        Cookie[] cookies = request.getCookies();
+        if (cookies != null) {
+            for (Cookie cookie : cookies) {
+                if (cookie.getName().equals("WISEUser")) {
+                    wiseUser = cookie.getValue();
+                }
+            }
+        }
+
+        return interlockDetailHistoryMapper.getPageByUser(page, dto, wiseUser);
+    }
 
 }