Jelajahi Sumber

自动子项目最近运行时间

martin 2 tahun lalu
induk
melakukan
7a2d37609c

+ 3 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -3796,6 +3796,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         //1 获取当前用户id
         param.setCreateUserId(AuthUtil.getCurrentUserId());
 
+        //2 获取创建时间和开始时间
         if (!isEmpty(param.getCreateStartDate())) {
             String createStartDate = param.getCreateStartDate();
             Date startDate = getDate(createStartDate + " 00:00:00", 1);
@@ -3814,8 +3815,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         }
 
         setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
-        List<SimulationManualProjectVo> vos = simulationAutomaticProjectMapper.selectAutomaticProjectList(param);
-        PageInfo<SimulationManualProjectVo> pageInfo = new PageInfo<>(vos);
+        List<SimulationManualProjectVo> simulationManualProjectVoList = simulationAutomaticProjectMapper.selectAutomaticProjectList(param);
+        PageInfo<SimulationManualProjectVo> pageInfo = new PageInfo<>(simulationManualProjectVoList);
 
         for (SimulationManualProjectVo p : pageInfo.getList()) {
             convertPoToVo(p, true);

+ 110 - 100
simulation-resource-server/src/main/resources/mapper/project/SimulationAutomaticProjectMapper.xml

@@ -1,17 +1,20 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.css.simulation.resource.project.mapper.SimulationAutomaticProjectMapper" >
-
+<mapper namespace="com.css.simulation.resource.project.mapper.SimulationAutomaticProjectMapper">
 
 
     <!--根据id查询工作信息-->
     <select id="selectById" parameterType="string" resultType="api.common.pojo.po.project.SimulationAutomaticProjectPo">
-        select * from simulation_automatic_project where id=#{id,jdbcType=VARCHAR}
+        select *
+        from simulation_automatic_project
+        where id = #{id,jdbcType=VARCHAR}
 
     </select>
 
     <!--根据条件查询工作信息-->
-    <select id="selectAutomaticProjectByQuery" parameterType="api.common.pojo.param.project.SimulationManualProjectParam" resultType="api.common.pojo.po.project.SimulationAutomaticProjectPo">
+    <select id="selectAutomaticProjectByQuery"
+            parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
+            resultType="api.common.pojo.po.project.SimulationAutomaticProjectPo">
         select * from simulation_automatic_project
         where is_deleted = '0'
         <if test="projectName != null and projectName != ''">
@@ -23,13 +26,14 @@
     <select id="selectLastProjectId" resultType="api.common.pojo.po.project.SimulationAutomaticProjectPo">
         select project_date, project_num, project_id
         from simulation_automatic_project
-        where project_date=#{nowRq,jdbcType=INTEGER} and is_deleted = '0'
-        order by project_date desc, project_num desc
-        limit 1
+        where project_date = #{nowRq,jdbcType=INTEGER}
+          and is_deleted = '0'
+        order by project_date desc, project_num desc limit 1
     </select>
 
     <!--查询自动项目列表-->
-    <select id="selectAutomaticProjectList" parameterType="api.common.pojo.param.project.SimulationManualProjectParam" resultType="api.common.pojo.vo.project.SimulationManualProjectVo">
+    <select id="selectAutomaticProjectList" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
+            resultType="api.common.pojo.vo.project.SimulationManualProjectVo">
         select id,
         project_date,
         project_num,
@@ -49,7 +53,8 @@
         from simulation_automatic_subproject sas
         where sas.is_deleted = '0'
         and sas.parent_id = sap.id) automatic_run_times,
-        last_run_time,
+        (select max(sas.create_time) from simulation_automatic_subproject sas where sas.parent_id = sap.id) last_run_time,
+        (select max(sas.create_time) from simulation_automatic_subproject sas where sas.parent_id = sap.id) last_run_time_fmt,
         automatic_run_state,
         create_time,
         create_user_id,
@@ -57,101 +62,94 @@
         modify_user_id,
         is_deleted
         from simulation_automatic_project sap
-        <where>
-            is_deleted = '0'
-            <if test="projectId != null and projectId != ''">
-                and project_id like CONCAT('%',#{projectId,jdbcType=VARCHAR},'%')
-            </if>
-            <if test="projectName != null and projectName != ''">
-                and project_name like CONCAT('%',#{projectName,jdbcType=VARCHAR},'%')
-            </if>
-            <if test="createTimeStart != null">
-                and create_time &gt;= #{createTimeStart,jdbcType=TIMESTAMP}
-            </if>
-            <if test="createTimeEnd != null">
-                and create_time &lt;= #{createTimeEnd,jdbcType=TIMESTAMP}
-            </if>
-            <if test="createUserId != null and createUserId != ''">
-                and create_user_id = #{createUserId,jdbcType=VARCHAR}
-            </if>
-        </where>
+        where is_deleted = '0'
+        <if test="projectId != null and projectId != ''">
+            and project_id like CONCAT('%',#{projectId,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="projectName != null and projectName != ''">
+            and project_name like CONCAT('%',#{projectName,jdbcType=VARCHAR},'%')
+        </if>
+        <if test="createTimeStart != null">
+            and create_time &gt;= #{createTimeStart,jdbcType=TIMESTAMP}
+        </if>
+        <if test="createTimeEnd != null">
+            and create_time &lt;= #{createTimeEnd,jdbcType=TIMESTAMP}
+        </if>
+        <if test="createUserId != null and createUserId != ''">
+            and create_user_id = #{createUserId,jdbcType=VARCHAR}
+        </if>
         order by project_date desc, project_num desc, modify_time desc
     </select>
 
     <!--创建项目信息-->
     <insert id="add" parameterType="api.common.pojo.po.project.SimulationAutomaticProjectPo">
         insert into simulation_automatic_project
-        (
-        id,
-        project_date,
-        project_num,
-        project_id,
-        project_name,
-        project_describe,
-        algorithm,
-        algorithm_type,
-        vehicle,
-        scene,
-        operation_cycle,
-        parallelism,
-        rule_view,
-        max_simulation_time,
-        is_choice_gpu,
-        automatic_run_times,
-        last_run_time,
-        automatic_run_state,
-        create_time,
-        create_user_id,
-        modify_time,
-        modify_user_id,
-        is_deleted
-        )
-        values
-        (
-        #{id,jdbcType=VARCHAR},
-        #{projectDate,jdbcType=INTEGER},
-        #{projectNum,jdbcType=INTEGER},
-        #{projectId,jdbcType=VARCHAR},
-        #{projectName,jdbcType=VARCHAR},
-        #{projectDescribe,jdbcType=VARCHAR},
-        #{algorithm,jdbcType=VARCHAR},
-        #{algorithmType,jdbcType=VARCHAR},
-        #{vehicle,jdbcType=VARCHAR},
-        #{scene,jdbcType=VARCHAR},
-        #{operationCycle,jdbcType=VARCHAR},
-        #{parallelism,jdbcType=VARCHAR},
-        #{ruleView,jdbcType=VARCHAR},
-        #{maxSimulationTime},
-        #{isChoiceGpu,jdbcType=VARCHAR},
-        #{automaticRunTimes,jdbcType=BIGINT},
-        #{lastRunTime,jdbcType=TIMESTAMP},
-        #{automaticRunState,jdbcType=VARCHAR},
-        #{createTime,jdbcType=TIMESTAMP},
-        #{createUserId,jdbcType=VARCHAR},
-        #{modifyTime,jdbcType=TIMESTAMP},
-        #{modifyUserId,jdbcType=VARCHAR},
-        #{isDeleted,jdbcType=VARCHAR}
-        )
+        (id,
+         project_date,
+         project_num,
+         project_id,
+         project_name,
+         project_describe,
+         algorithm,
+         algorithm_type,
+         vehicle,
+         scene,
+         operation_cycle,
+         parallelism,
+         rule_view,
+         max_simulation_time,
+         is_choice_gpu,
+         automatic_run_times,
+         last_run_time,
+         automatic_run_state,
+         create_time,
+         create_user_id,
+         modify_time,
+         modify_user_id,
+         is_deleted)
+        values (#{id,jdbcType=VARCHAR},
+                #{projectDate,jdbcType=INTEGER},
+                #{projectNum,jdbcType=INTEGER},
+                #{projectId,jdbcType=VARCHAR},
+                #{projectName,jdbcType=VARCHAR},
+                #{projectDescribe,jdbcType=VARCHAR},
+                #{algorithm,jdbcType=VARCHAR},
+                #{algorithmType,jdbcType=VARCHAR},
+                #{vehicle,jdbcType=VARCHAR},
+                #{scene,jdbcType=VARCHAR},
+                #{operationCycle,jdbcType=VARCHAR},
+                #{parallelism,jdbcType=VARCHAR},
+                #{ruleView,jdbcType=VARCHAR},
+                #{maxSimulationTime},
+                #{isChoiceGpu,jdbcType=VARCHAR},
+                #{automaticRunTimes,jdbcType=BIGINT},
+                #{lastRunTime,jdbcType=TIMESTAMP},
+                #{automaticRunState,jdbcType=VARCHAR},
+                #{createTime,jdbcType=TIMESTAMP},
+                #{createUserId,jdbcType=VARCHAR},
+                #{modifyTime,jdbcType=TIMESTAMP},
+                #{modifyUserId,jdbcType=VARCHAR},
+                #{isDeleted,jdbcType=VARCHAR})
     </insert>
 
     <!--修改项目信息-->
     <update id="updateById" parameterType="api.common.pojo.po.project.SimulationAutomaticProjectPo">
         update simulation_automatic_project
-        set
-        project_name = #{projectName,jdbcType=VARCHAR},
-        project_describe = #{projectDescribe,jdbcType=VARCHAR},
-        algorithm = #{algorithm,jdbcType=VARCHAR},
-        algorithm_type = #{algorithmType,jdbcType=VARCHAR},
-        vehicle = #{vehicle,jdbcType=VARCHAR},
-        scene = #{scene,jdbcType=VARCHAR},
-        operation_cycle = #{operationCycle,jdbcType=VARCHAR},
-        parallelism = #{parallelism,jdbcType=VARCHAR},
-        rule_view = #{ruleView,jdbcType=VARCHAR},
-        max_simulation_time = #{maxSimulationTime},
-        is_choice_gpu = #{isChoiceGpu,jdbcType=VARCHAR},
-        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
-        modify_user_id = #{modifyUserId,jdbcType=VARCHAR}
-        where id = #{id,jdbcType=VARCHAR} and is_deleted = '0'
+        set project_name        = #{projectName,jdbcType=VARCHAR},
+            project_describe    = #{projectDescribe,jdbcType=VARCHAR},
+            algorithm           = #{algorithm,jdbcType=VARCHAR},
+            algorithm_type      = #{algorithmType,jdbcType=VARCHAR},
+            vehicle             = #{vehicle,jdbcType=VARCHAR},
+            scene               = #{scene,jdbcType=VARCHAR},
+            operation_cycle     = #{operationCycle,jdbcType=VARCHAR},
+            parallelism         = #{parallelism,jdbcType=VARCHAR},
+            rule_view           = #{ruleView,jdbcType=VARCHAR},
+            max_simulation_time = #{maxSimulationTime},
+            is_choice_gpu       = #{isChoiceGpu,jdbcType=VARCHAR},
+            modify_time         = #{modifyTime,jdbcType=TIMESTAMP},
+            modify_user_id      = #{modifyUserId,jdbcType=VARCHAR}
+        where id = #{id,jdbcType=VARCHAR}
+          and is_deleted = '0'
     </update>
 
 
@@ -193,19 +191,31 @@
     </update>
 
     <!--自动运行项目详细页面信息-->
-    <select id="selectAutomaticProjectInfoById" parameterType="string" resultType="api.common.pojo.vo.project.AutomaticProjectVo">
-        select p.id, p.project_name, p.project_describe, p.operation_cycle, p.parallelism, p.is_choice_gpu, p.vehicle, a.algorithm_name, s.package_name as sceneName, p.max_simulation_time
+    <select id="selectAutomaticProjectInfoById" parameterType="string"
+            resultType="api.common.pojo.vo.project.AutomaticProjectVo">
+        select p.id,
+               p.project_name,
+               p.project_describe,
+               p.operation_cycle,
+               p.parallelism,
+               p.is_choice_gpu,
+               p.vehicle,
+               a.algorithm_name,
+               s.package_name as sceneName,
+               p.max_simulation_time
         from simulation_automatic_project p
-        left join algorithm a on p.algorithm = a.id
-        left join scene_package s on p.scene = s.package_id
-        where p.id = #{id,jdbcType=VARCHAR} and p.is_deleted = '0'
+                 left join algorithm a on p.algorithm = a.id
+                 left join scene_package s on p.scene = s.package_id
+        where p.id = #{id,jdbcType=VARCHAR}
+          and p.is_deleted = '0'
     </select>
 
     <!--更新算法版本号-->
     <update id="updateAlgorithmGitVersion" parameterType="api.common.pojo.param.algorithm.AlgorithmParameter">
-        update algorithm set git_version=#{gitVersion} where id=#{id}
+        update algorithm
+        set git_version=#{gitVersion}
+        where id = #{id}
     </update>
 
 
-
 </mapper>