123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?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.pdaaphm.biz.mapper.AlgorithmIoFieldMapper">
- <resultMap type="AlgorithmIoField" id="AlgorithmIoFieldResult">
- <result property="id" column="id" />
- <result property="algorithmSubId" column="algorithm_sub_id" />
- <result property="type" column="type" />
- <result property="name" column="name" />
- <result property="index" column="index" />
- <result property="matlabIoPath" column="matlab_io_path" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="remark" column="remark" />
- <result property="algoSubName" column="sub_name" />
- </resultMap>
- <sql id="selectAlgorithmIoFieldVo">
- select io.id, io.algorithm_sub_id, io.`type`, io.`name`, io.`index`,io.matlab_io_path ,io.create_by, io.create_time, io.update_by, io.update_time, io.remark, sub.name as sub_name from t_algorithm_io_field as io left join t_algorithm_sub_type as sub on io.algorithm_sub_id = sub.id
- </sql>
- <select id="selectAlgorithmIoFieldList" parameterType="AlgorithmIoField" resultMap="AlgorithmIoFieldResult">
- <include refid="selectAlgorithmIoFieldVo"/>
- <where>
- <if test="algorithmSubId != null "> and algorithm_sub_id = #{algorithmSubId}</if>
- <if test="type != null and type != ''"> and `type` = #{type}</if>
- <if test="name != null and name != ''"> and `name` like concat('%', #{name}, '%')</if>
- <if test="index != null "> and `index` = #{index}</if>
- <if test="matlabIoPath != null and matlabIoPath != ''"> and matlab_io_path = #{matlabIoPath}</if>
- </where>
- </select>
- <select id="selectAlgorithmIoFieldById" parameterType="Long" resultMap="AlgorithmIoFieldResult">
- <include refid="selectAlgorithmIoFieldVo"/>
- where io.id = #{id}
- </select>
- <insert id="insertAlgorithmIoField" parameterType="AlgorithmIoField" useGeneratedKeys="true" keyProperty="id">
- insert into t_algorithm_io_field
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="algorithmSubId != null">algorithm_sub_id,</if>
- <if test="type != null">`type`,</if>
- <if test="name != null">`name`,</if>
- <if test="index != null">`index`,</if>
- <if test="matlabIoPath != null">matlab_io_path,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="algorithmSubId != null">#{algorithmSubId},</if>
- <if test="type != null">#{type},</if>
- <if test="name != null">#{name},</if>
- <if test="index != null">#{index},</if>
- <if test="matlabIoPath != null">#{matlabIoPath},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateAlgorithmIoField" parameterType="AlgorithmIoField">
- update t_algorithm_io_field
- <trim prefix="SET" suffixOverrides=",">
- <if test="algorithmSubId != null">algorithm_sub_id = #{algorithmSubId},</if>
- <if test="type != null">`type` = #{type},</if>
- <if test="name != null">`name` = #{name},</if>
- <if test="index != null">`index` = #{index},</if>
- <if test="matlabIoPath != null">matlab_io_path = #{matlabIoPath},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteAlgorithmIoFieldById" parameterType="Long">
- delete from t_algorithm_io_field where id = #{id}
- </delete>
- <delete id="deleteAlgorithmIoFieldBySubTypeId" parameterType="Long">
- delete from t_algorithm_io_field where algorithm_sub_id = #{id}
- </delete>
- <delete id="deleteAlgorithmIoFieldByIds" parameterType="String">
- delete from t_algorithm_io_field where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="getIoSubList" resultType="com.pdaaphm.biz.dto.SubAlgorithmDTO">
- SELECT
- io.id as fieldId,
- io.`type`,
- io.`name`,
- (
- SELECT
- sa.id
- FROM
- t_sub_algorithm sa,
- t_algorithm a
- WHERE
- sa.algorithm_id = a.id
- AND sa.field_id = io.id
- AND a.id = #{algoId}
- ) AS id,
- (
- SELECT
- sa.upload_id
- FROM
- t_sub_algorithm sa,
- t_algorithm a
- WHERE
- sa.algorithm_id = a.id
- AND sa.field_id = io.id
- AND a.id = #{algoId}
- ) AS uploadId,
- (
- SELECT
- f.path
- FROM
- t_sub_algorithm sa,
- t_file f,
- t_algorithm a
- WHERE
- sa.upload_id = f.id
- AND sa.algorithm_id = a.id
- AND sa.field_id = io.id
- AND a.id = #{algoId}
- ) AS path
- FROM
- t_algorithm_io_field AS io
- WHERE
- io.algorithm_sub_id = #{subTypeId}
- </select>
- <select id="selectMatlabIoPathTypeIndexByAlgoId" resultType="map">
- SELECT
- io.matlab_io_path,
- io.type,
- io.`index`
- FROM
- t_algorithm_io_field io
- JOIN t_algorithm_sub_type ast ON ast.id = io.algorithm_sub_id
- JOIN t_algorithm a ON a.sub_type_id = ast.id
- WHERE
- a.id = #{id}
- ORDER BY
- io.`index`
- </select>
- </mapper>
|