<?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.server.infra.db.mysql.mapper.SimulationManualProjectMapper">


    <!--添加-->
    <insert id="add" parameterType="api.common.pojo.po.project.SimulationManualProjectPO">
        insert into simulation_manual_project
        (id,
         project_date,
         project_num,
         project_id,
         project_name,
         project_describe,
         algorithm,
         algorithm_type,
         vehicle,
         scene,
         operation_cycle,
         parallelism,
         rule_view,
         is_choice_gpu,
         automatic_run_times,
         last_run_time,
         automatic_run_state,
         now_run_state,
         evaluation_level,
         start_time,
         finish_time,
         max_simulation_time,
         create_time,
         create_user_id,
         modify_time,
         modify_user_id,
         is_deleted,
         algorithm_array,
         vehicle_array,
         scene_array,
         details)
        values (#{id},
                #{projectDate,jdbcType=INTEGER},
                #{projectNum,jdbcType=INTEGER},
                #{projectId},
                #{projectName},
                #{projectDescribe},
                #{algorithm},
                #{algorithmType},
                #{vehicle},
                #{scene},
                #{operationCycle},
                #{parallelism},
                #{ruleView},
                #{isChoiceGpu},
                #{automaticRunTimes,jdbcType=BIGINT},
                #{lastRunTime},
                #{automaticRunState},
                #{nowRunState},
                #{evaluationLevel},
                #{startTime},
                #{finishTime},
                #{maxSimulationTime,jdbcType=BIGINT},
                #{createTime},
                #{createUserId},
                #{modifyTime},
                #{modifyUserId},
                #{isDeleted},
                #{algorithmArray},
                #{vehicleArray},
                #{sceneArray},
                #{details})
    </insert>

    <!--修改-->
    <update id="update" parameterType="api.common.pojo.po.project.SimulationManualProjectPO">
        update simulation_manual_project
        set project_name        = #{projectName},
            project_describe    = #{projectDescribe},
            algorithm           = #{algorithm},
            algorithm_type      = #{algorithmType},
            vehicle             = #{vehicle},
            scene               = #{scene},
            max_simulation_time = #{maxSimulationTime,jdbcType=BIGINT},
            parallelism         = #{parallelism},
            is_choice_gpu       = #{isChoiceGpu},
            algorithm_array     = #{algorithmArray},
            vehicle_array       = #{vehicleArray},
            scene_array         = #{sceneArray}
        where id = #{id}
          and is_deleted = '0'
    </update>


    <!--查询项目最新id-->
    <select id="selectLastProjectId" resultType="api.common.pojo.po.project.SimulationManualProjectPO">
        select project_date, project_num, project_id
        from simulation_manual_project
        where project_date = #{nowRq}
          and is_deleted = '0'
        order by project_date desc, project_num desc
        limit 1
    </select>

    <!--查询项目列表-->
    <select id="selectProject" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.po.project.SimulationManualProjectPO">
        select * from simulation_manual_project
        <where>
            is_deleted = '0'
            <if test="projectId != null and projectId != ''">
                and project_id like CONCAT('%',#{project_id},'%')
            </if>
            <if test="projectName != null and projectName != ''">
                and project_name like CONCAT('%',#{project_name},'%')
            </if>
            <if test="nowRunState != null and nowRunState != ''">
                and now_run_state = #{nowRunState}
            </if>
            <if test="evaluationLevel != null and evaluationLevel != ''">
                and evaluation_level = #{evaluationLevel}
            </if>
            <if test="createTimeStart != null">
                and create_time &gt;= #{createTimeStart}
            </if>
            <if test="createTimeEnd != null">
                and create_time &lt;= #{createTimeEnd}
            </if>
            <if test="finishTimeStart != null">
                and finish_time &gt;= #{finishTimeStart}
            </if>
            <if test="finishTimeEnd != null">
                and finish_time &lt;= #{finishTimeEnd}
            </if>
            <if test="isDeleted != null and isDeleted != ''">
                and is_deleted = #{isDeleted}
            </if>
        </where>
        order by project_date desc, project_num desc, modify_time desc
    </select>

    <!--查询项目列表-->
    <select id="selectProjectList" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.vo.project.SimulationManualProjectVO">
        select id,
        project_date,
        project_num,
        project_id,
        project_name,
        project_describe,
        algorithm,
        algorithm_type,
        vehicle,
        scene,
        operation_cycle,
        parallelism,
        rule_view,
        is_choice_gpu,
        automatic_run_times,
        last_run_time,
        automatic_run_state,
        now_run_state,
        error_message,
        evaluation_level,
        start_time,
        finish_time,
        max_simulation_time,
        algorithm_score,
        task_number,
        task_completed,
        create_time,
        create_user_id,
        modify_time,
        modify_user_id,
        is_deleted,
        algorithm_array,
        vehicle_array,
        scene_array
        from simulation_manual_project
        <where>
            is_deleted = '0'
            <if test="projectId != null and projectId != ''">
                and project_id like CONCAT('%',#{projectId},'%')
            </if>
            <if test="projectName != null and projectName != ''">
                and project_name like CONCAT('%',#{projectName},'%')
            </if>
            <if test="nowRunState != null and nowRunState != ''">
                and now_run_state = #{nowRunState}
            </if>
            <if test="evaluationLevel != null and evaluationLevel != ''">
                and evaluation_level = #{evaluationLevel}
            </if>
            <if test="createTimeStart != null">
                and create_time &gt;= #{createTimeStart}
            </if>
            <if test="createTimeEnd != null">
                and create_time &lt;= #{createTimeEnd}
            </if>
            <if test="finishTimeStart != null">
                and finish_time &gt;= #{finishTimeStart}
            </if>
            <if test="finishTimeEnd != null">
                and finish_time &lt;= #{finishTimeEnd}
            </if>
            <if test="isDeleted != null and isDeleted != ''">
                and is_deleted = #{isDeleted}
            </if>
            <if test="createUserId != null and createUserId != ''">
                and create_user_id = #{createUserId}
            </if>
        </where>
        order by project_date desc, project_num desc, modify_time desc
    </select>

    <!--根据id查询-->
    <select id="selectProjectById" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.po.project.SimulationManualProjectPO">
        select id,
               project_date,
               project_num,
               project_id,
               project_name,
               project_describe,
               algorithm,
               algorithm_type,
               vehicle,
               scene,
               operation_cycle,
               parallelism,
               rule_view,
               is_choice_gpu,
               automatic_run_times,
               last_run_time,
               automatic_run_state,
               now_run_state,
               evaluation_level,
               start_time,
               finish_time,
               max_simulation_time,
               algorithm_score,
               task_number,
               task_completed,
               create_time,
               create_user_id,
               modify_time,
               modify_user_id,
               is_deleted,
               details,
               algorithm_array,
               vehicle_array,
               scene_array
        from simulation_manual_project
        where id = #{id}
          and is_deleted = '0'
    </select>

    <!--根据项目名查询工作信息-->
    <select id="selectProjectByName" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.po.project.SimulationManualProjectPO">
        select *
        from simulation_manual_project
        where project_name = #{projectName}
          and is_deleted = '0'
    </select>

    <!--根据id查询基本信息-->
    <select id="selectProjectBaseById" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.po.project.SimulationManualProjectPO">
        select id,
               algorithm,
               scene,
               algorithm_score,
               project_name,
               project_id,
               algorithm_type,
               evaluation_level,
               start_time
        from simulation_manual_project
        where is_deleted = '0'
          and id = #{id}
    </select>

    <!--删除-->
    <update id="deleteProject">
        update simulation_manual_project
        set is_deleted='1'
        where id in
        <foreach collection="array" open="(" separator="," close=")" item="id">
            #{id}
        </foreach>

    </update>

    <!--查询项目状态-->
    <select id="selectProjectNowRunState" resultType="api.common.pojo.po.project.SimulationManualProjectPO">
        select now_run_state
        from simulation_manual_project
        where
        is_deleted='0' and
        id in
        <foreach collection="array" open="(" separator="," close=")" item="id">
            #{id}
        </foreach>
    </select>

    <!--修改运行状态-->
    <update id="updateProjectNowRunState" parameterType="api.common.pojo.param.project.SimulationManualProjectParam">
        update simulation_manual_project
        <set>
            <if test="nowRunState != null and nowRunState != ''">
                now_run_state = #{nowRunState},
            </if>
            <if test="startTime != null">
                start_time=#{startTime},
            </if>
            <if test="finishTime != null">
                finish_time=#{finishTime},
            </if>
        </set>
        where id = #{id} and is_deleted = '0'
    </update>

    <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
    <select id="selectAlgorithmBaseInfoById" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
        select id, algorithm_name, description,share from(
        select a.id, a.algorithm_name, a.description,a.share,a.modify_time
        from algorithm a
        where a.is_deleted = '0' and share='0'
        <if test="id != null and id != ''">
            and a.id = #{id}
        </if>
        <if test="createUserId != null and createUserId !=''">
            and create_user_id=#{createUserId}
        </if>
        <if test="uploadMode != null and uploadMode != ''">
            and upload_mode = #{uploadMode}
        </if>
        union select b.id, b.algorithm_name,b.description,b.share,b.modify_time
        from algorithm b
        where b.is_deleted = '0' and b.share='1'
        <if test="uploadMode != null and uploadMode != ''">
            and upload_mode = #{uploadMode}
        </if>
        )c order by c.share ,c.modify_time desc
    </select>

    <!--获取车辆基本信息-->
    <select id="selectVehicleBaseInfoById" parameterType="string" resultType="api.common.pojo.po.model.VehiclePO">
        select a.id, a.vehicle_name, a.description, a.vehicle_top_view,a.vehicle_front_view
        from model_vehicle a
        where is_deleted = '0'
        <if test="id != null and id != ''">
            and a.id = #{id}
        </if>
    </select>

    <!--获取车辆配置信息-->
    <select id="selectConfigVehicle" resultType="api.common.pojo.po.model.ConfigPO">
        select id, config_name, vehicle_id, description,share
        from model_config
        where is_deleted = '0'
        <if test="id != null and id != ''">
            and id = #{id}
        </if>
        <if test="createUserId != null and createUserId !=''">
            and create_user_id=#{createUserId}
        </if>
    </select>

    <!--获取车辆配置信息-->
    <select id="selectConfigVehicle2" resultType="api.common.pojo.po.model.ConfigPO">
        select id, config_name, vehicle_id, description,share from(
        select id, config_name, vehicle_id, description,share,modify_time
        from model_config
        where is_deleted = '0' and share='0'
        <if test="id != null and id != ''">
            and id = #{id}
        </if>
        <if test="createUserId != null and createUserId !=''">
            and create_user_id=#{createUserId}
        </if>
        union select id, config_name, vehicle_id, description,share,modify_time
        from model_config
        where is_deleted = '0' and share='1')c order by c.share ,c.modify_time desc
    </select>

    <!--查询车辆配置传感器信息-->
    <select id="selectConfigSensor" parameterType="string" resultType="api.common.pojo.po.model.ConfigSensorPO">
        select sensor_type
        from relation_config_sensor
        where is_deleted = '0'
        <if test="id != null and id != ''">
            and config_id = #{id}
        </if>
        group by sensor_type
    </select>

    <!--获取场景包基本信息-->
    <select id="selectScenePackageBaseById" resultType="api.common.pojo.po.scene.ScenePackagePO">
        select package_id,package_name, scene_num,share from(
        select a.package_id,a.package_name, a.scene_num,a.share,a.modify_time
        from scene_package a
        where a.share = '0' and a.is_deleted = '0' and is_unavailable = '0'
        <if test="packageId != null and packageId != ''">
            and a.package_id = #{packageId}
        </if>
        <if test="createUserId != null and createUserId !=''">
            and create_user_id=#{createUserId}
        </if>
        union select b.package_id,b.package_name, b.scene_num,b.share,b.modify_time
        from scene_package b where b.share = '1' and b.is_deleted = '0'
        ) c order by c.share ,c.modify_time desc
    </select>

    <!--根据id查询场景包信息-->
    <select id="selectScenePackageInfoById" parameterType="string" resultType="api.common.pojo.po.scene.ScenePackagePO">
        select a.package_id, a.package_name, a.scene_num
        from scene_package a
        where a.package_id = #{id}
    </select>

    <!--查询车辆与传感器关联信息-->
    <select id="selectVehicleSensor" parameterType="string" resultType="api.common.pojo.po.model.ConfigSensorPO">
        select sensor_id,
               sensor_type,
               config_id,
               sensor_x,
               sensor_y,
               sensor_z,
               sensor_h,
               sensor_p,
               sensor_r,
               sensor_port
        from relation_config_sensor
        where config_id = #{id}
          and is_deleted = '0'
    </select>

    <!--摄像头基本信息-->
    <select id="selectSensorCamera" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
        select a.sensor_name, description as sensorDescription, share
        from model_sensor_camera a
        where a.id = #{id}
    </select>

    <!--完美传感器基本信息-->
    <select id="selectSensorOgt" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
        select a.sensor_name, description as sensorDescription, share
        from model_sensor_ogt a
        where a.id = #{id}
    </select>

    <!--激光雷达基本信息-->
    <select id="selectSensorLidar" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
        select a.sensor_name, description as sensorDescription, share
        from model_sensor_lidar a
        where a.id = #{id}
    </select>
    <!--毫米波雷达基本信息-->
    <select id="selectSensorRadar" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
        select a.name as sensor_name, description as sensorDescription, share
        from model_sensor_radar a
        where a.id = #{id}
    </select>
    <!--gps基本信息-->
    <select id="selectSensorGps" parameterType="string" resultType="api.common.pojo.vo.project.SensorBaseInfoVo">
        select a.sensor_name, description as sensorDescription
        from model_sensor_gps a
        where a.id = #{id}
    </select>

    <!--查询交通事故场景信息-->
    <select id="selectSceneAccidentById" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
        select scene_name
        from scene_accident
        where accident_id = #{id}
    </select>
    <!--查询自然场景信息-->
    <select id="selectSceneNatural" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
        select natural_name
        from scene_natural
        where natural_id = #{id}
    </select>
    <!--查询泛化场景信息-->
    <select id="selectSceneGeneralDataById" parameterType="string"
            resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
        select scene_id scene_name
        from scene_general_data
        where id = #{id}
    </select>
    <!--查询标准法规场景信息-->
    <select id="selectSceneStandardsRegulations" parameterType="string"
            resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
        select scene_name
        from scene_standards_regulations
        where regulations_id = #{id}
    </select>

    <!--根据场景包id获取场景子集-->
    <select id="selectSubSceneByPid" parameterType="string"
            resultType="api.common.pojo.vo.project.ScenePackageSubListVO">
        select sublist_id,
               sublist_name,
               scene_num,
               weight,
               parent_id,
               scene_natural_ids,
               scene_traffic_ids,
               scene_statue_ids,
               scene_generalization_ids
        from scene_package_sublist
        where parent_id = #{id}
        order by seq
    </select>

    <!--获取指标信息-->
    <select id="selectsublistBySublistId" parameterType="string"
            resultType="api.common.pojo.vo.project.ScenePackageSubListVO">
        select sublist_id,
               sublist_name,
               scene_num,
               weight,
               parent_id,
               scene_natural_ids,
               scene_traffic_ids,
               scene_statue_ids,
               scene_generalization_ids
        from scene_package_sublist
        where sublist_id = #{id}
    </select>

    <!--获取场景包下指标信息-->
    <select id="selectSublistByRootId" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.vo.project.SublistScoreVo">
        select sub.sublist_id as id, sub.parent_id, sub.sublist_name, sub.scene_num, sub.package_and_rules
        from scene_package_sublist sub
        where sub.root_id = #{packageId}
        order by sub.seq
    </select>

    <!--查询场景包id下最后一级所有指标和场景-->
    <select id="selectSubListByPid" parameterType="string"
            resultType="api.common.pojo.vo.project.ScenePackageSubListVO">
        select sublist_id,
               parent_id,
               sublist_name,
               scene_num,
               scene_natural_ids,
               scene_traffic_ids,
               scene_statue_ids,
               scene_generalization_ids
        from scene_package_sublist
        where package_and_rules is not null
          and package_and_rules != ''
          and root_id = #{id}
          and is_deleted = '0'
    </select>

    <!--保存项目最后一级指标信息-->
    <insert id="insertSimulationMptLastTargetScorePo"
            parameterType="api.common.pojo.po.project.SimulationMptLastTargetScorePO">
        insert into simulation_mpt_last_target_score
        (id,
         p_id,
         target,
         create_time,
         create_user_id,
         modify_time,
         modify_user_id,
         is_deleted)
        values (#{id},
                #{pId},
                #{target},
                #{createTime},
                #{createUserId},
                #{modifyTime},
                #{modifyUserId},
                #{isDeleted})
    </insert>

    <!--保存第一级指标信息-->
    <insert id="insertSimulationMptFirstTargetScorePo"
            parameterType="api.common.pojo.po.project.SimulationMptFirstTargetScorePO">
        insert into simulation_mpt_first_target_score
        (id,
         p_id,
         target,
         create_time,
         create_user_id,
         modify_time,
         modify_user_id,
         is_deleted)
        values (#{id},
                #{pId},
                #{target},
                #{createTime},
                #{createUserId},
                #{modifyTime},
                #{modifyUserId},
                #{isDeleted})
    </insert>


    <!--获取人员信息-->
    <select id="selectUserById" resultType="api.common.pojo.vo.project.SystemUserVo">
        select *
        from system_user
        where id = #{id}
    </select>

    <!--查询所有指标得分-->
    <select id="selectSubScore" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.vo.project.SublistScoreVo">
        select sub.sublist_id as id,
               sub.parent_id,
               sub.sublist_name,
               sub.scene_num,
               fir.score      as firScore,
               las.score      as lasScore,
               sub.package_and_rules,
               las.not_standard_scene_num,
               las.score_explain
        from scene_package_sublist sub
                 left JOIN simulation_mpt_first_target_score fir
                           on fir.target = sub.sublist_id and fir.p_id = #{id}
                 left JOIN simulation_mpt_last_target_score las
                           on las.target = sub.sublist_id and las.p_id = #{id}
        where sub.root_id = #{packageId}
          and (fir.target is not null or las.target is not null)
        order by sub.seq
    </select>

    <!--查询所有指标得分-->
    <select id="selectSubScore2" parameterType="api.common.pojo.param.project.SimulationManualProjectParam"
            resultType="api.common.pojo.vo.project.SublistScoreVo">
        select sub.sublist_id as id,
               sub.parent_id,
               sub.sublist_name,
               sub.scene_num,
               fir.score      as firScore,
               las.score      as lasScore,
               sub.package_and_rules,
               las.error_scene_num,
               las.not_scored_scene_num,
               las.not_standard_scene_num,
               las.standard_scene_num,
               las.score_explain,
               fir.target     as firTarget,
               las.target     as lasTarget
        from scene_package_sublist sub
                 left join simulation_mpt_first_target_score fir
                           on fir.target = sub.sublist_id and fir.p_id = #{id}
                 left join simulation_mpt_last_target_score las
                           on las.target = sub.sublist_id and las.p_id = #{id}
        where sub.root_id = #{packageId}
        order by sub.seq
    </select>

    <!--运行项目状态-->
    <select id="selectRunProjectByState" parameterType="java.lang.String" resultType="java.util.Map">
        select count(1) num, temp.now_run_state nowRunState
        from (select now_run_state, create_user_id
              from simulation_manual_project t1
              where is_deleted = 0
                and t1.create_user_id = #{createUserId}
              union all
              select now_run_state, create_user_id
              from simulation_automatic_subproject t2
              where is_deleted = 0
                and t2.create_user_id = #{createUserId}) temp
        group by temp.now_run_state
    </select>
    <!--评测等级分布-->
    <select id="selectEvaluationLevel" parameterType="java.util.Map" resultType="java.util.Map">
        select count(evaluation_level) num,evaluation_level evaluationLevel from simulation_manual_project
        where
        is_deleted = '0' and evaluation_level is not null
        <if test="createUserId != null and createUserId != ''">
            and create_user_id = #{createUserId}
        </if>
        group by evaluation_level
    </select>

    <!--添加第三方算法信息到算发表-->
    <insert id="insertOtherAlgorithm" parameterType="api.common.pojo.po.algorithm.AlgorithmPO">
        insert into algorithm
        (id,
         algorithm_name,
         upload_mode,
         is_deleted)
        values (id = #{id},
                algorithm_name = #{algorithmName},
                upload_mode = #{uploadMode},
                is_deleted = #{isDeleted})
    </insert>

    <!--更新第三方算法信息到算法表-->
    <update id="updateOtherAlgorithm" parameterType="api.common.pojo.po.algorithm.AlgorithmPO">
        update algorithm
        set algorithm_name=#{algorithmName}
        where id = #{id}
          and is_deleted = '0'
    </update>

    <!--查询第三方算法信息是否已经存在-->
    <select id="selectAlgorithmByQuery" parameterType="api.common.pojo.po.algorithm.AlgorithmPO"
            resultType="api.common.pojo.po.algorithm.AlgorithmPO">
        select id, algorithm_name
        from algorithm
        where id = #{id}
          and is_deleted = '0'
    </select>

    <!--根据算法id获取最新的一条报告id-->
    <select id="selectLastProjectIdByAlgorithmId" resultType="java.lang.String">
        select id
        from (select id, finish_time
              from simulation_manual_project
              where algorithm = #{algorithmId}
                and is_deleted = '0'
                and now_run_state = '30'
              union all
              select sas.id, sas.finish_time
              from simulation_automatic_subproject sas
                       left join simulation_automatic_project sap on sas.parent_id = sap.id
              where algorithm = #{algorithmId}
                and sas.is_deleted = '0'
                and sap.is_deleted = '0'
                and now_run_state = '30') temp
        order by finish_time desc limit 1
    </select>

    <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
    <select id="selectAlgorithmBaseInfoByIdSy" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
        select id, algorithm_name, description,share,modify_time
        from algorithm
        where is_deleted = '0' and share='0'
        <if test="id != null and id != ''">
            and id = #{id}
        </if>
        <if test="createUserId != null and createUserId !=''">
            and create_user_id=#{createUserId}
        </if>
        <if test="uploadMode != null and uploadMode != ''">
            and upload_mode = #{uploadMode}
        </if>
        order by modify_time desc
    </select>
    <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
    <select id="selectAlgorithmBaseInfoByIdGy" resultType="api.common.pojo.po.algorithm.AlgorithmPO">

        select id, algorithm_name,description,share,modify_time
        from algorithm
        where is_deleted = '0' and share='1'
        <if test="uploadMode != null and uploadMode != ''">
            and upload_mode = #{uploadMode}
        </if>
        order by modify_time desc
    </select>

    <!--获取车辆配置信息-->
    <select id="selectConfigVehicleGy" resultType="api.common.pojo.po.model.ConfigPO">
        select a.id, a.config_name, a.vehicle_id, a.description, a.share, a.modify_time
        from model_config a
                 left join model_vehicle b on a.vehicle_id = b.id
        where a.is_deleted = '0'
          and a.is_unavailable = '0'
          and a.share = '1'
          and b.is_deleted = '0'
        order by a.modify_time desc
    </select>
    <select id="selectConfigVehicleSy" resultType="api.common.pojo.po.model.ConfigPO">

        select a.id, a.config_name, a.vehicle_id, a.description,a.share,a.modify_time
        from model_config a left join model_vehicle b on a.vehicle_id=b.id
        where a.is_deleted = '0' and a.is_unavailable = '0' and a.share='0' and b.is_deleted='0'
        <if test="id != null and id != ''">
            and a.id = #{id}
        </if>
        <if test="createUserId != null and createUserId !=''">
            and a.create_user_id=#{createUserId}
        </if>
        order by a.modify_time desc
    </select>
    <!--获取场景包基本信息-->
    <select id="selectScenePackageBaseByIdGy" resultType="api.common.pojo.po.scene.ScenePackagePO">

        select package_id, package_name, scene_num, share, modify_time
        from scene_package
        where share = '1'
          and is_deleted = '0'
          and is_unavailable = '0'
        order by modify_time desc
    </select>
    <!--获取场景包基本信息-->
    <select id="selectScenePackageBaseByIdSy" resultType="api.common.pojo.po.scene.ScenePackagePO">
        select package_id,package_name, scene_num,share,modify_time
        from scene_package
        where share = '0' and is_deleted = '0' and is_unavailable = '0'
        <if test="packageId != null and packageId != ''">
            and package_id = #{packageId}
        </if>
        <if test="createUserId != null and createUserId !=''">
            and create_user_id=#{createUserId}
        </if>
        order by modify_time desc
    </select>
    <select id="selectAlgorithmTypeById" resultType="java.lang.String">
        select algorithm_type from simulation.simulation_manual_project where id = #{id}
    </select>
    <select id="selectAlgorithmById" resultType="java.lang.String">
        select algorithm from simulation.simulation_manual_project where id = #{id}
    </select>

</mapper>
