Kaynağa Gözat

算法平台

LingxinMeng 2 yıl önce
ebeveyn
işleme
88798dc7b8

+ 0 - 42
simulation-resource-common/src/main/java/com/css/simulation/resource/common/infrastructure/mysql/mapper/AlgorithmExpandMapper.java

@@ -2,56 +2,14 @@ package com.css.simulation.resource.common.infrastructure.mysql.mapper;
 
 import com.css.simulation.resource.common.infrastructure.mysql.entity.AlgorithmExpandInfrastructureEntity;
 import com.css.simulation.resource.common.infrastructure.mysql.param.AlgorithmExpandInfrastructureParam;
-import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
 @Mapper
 public interface AlgorithmExpandMapper {
-
-    @Select(" <script>" +
-            " select id, algorithm_id, algorithm_name, description, algorithm_type, status\n" +
-            " from algorithm_expand\n" +
-            " where 1=1 " +
-            " <if test='algorithmIds != null and algorithmIds.size() > 0'>\n" +
-            " and algorithm_id in\n" +
-            "    <foreach item='item' collection='algorithmIds' separator=',' open='(' close=')'>\n" +
-            "      #{item}\n" +
-            "    </foreach>" +
-            " </if>" +
-            " <if test='algorithmId != null and algorithmId != '''>\n" +
-            "  and algorithm_id = #{algorithmId}" +
-            " </if>" +
-            " </script>")
     List<AlgorithmExpandInfrastructureEntity> select(AlgorithmExpandInfrastructureParam algorithmExpandInfrastructureParam);
-
-    @Select(" <script>" +
-            " select  algorithm_id\n" +
-            " from algorithm_expand\n" +
-            " where algorithm_id in\n" +
-            "    <foreach item='item' collection='algorithmIds' separator=',' open='(' close=')'>\n" +
-            "      #{item}\n" +
-            "    </foreach>" +
-            "</script>")
     List<String> selectAlgorithmIds(AlgorithmExpandInfrastructureParam algorithmExpandInfrastructureParam);
-
-    @Insert("insert into algorithm_expand(id, algorithm_id, algorithm_name, description, algorithm_type, algorithm_version, team, topic, status)\n\n" +
-            "    value (#{id}, #{algorithmId}, #{algorithmName}, #{description}, #{algorithmType},#{algorithmVersion},#{team},{topic}, #{status})\n")
     void insert(AlgorithmExpandInfrastructureEntity algorithmExpandInfrastructureEntity);
-
-    @Update("update algorithm_expand\n" +
-            "set id = #{id},\n" +
-            "            algorithm_id = #{algorithmId},\n" +
-            "            algorithm_name = #{algorithmName},\n" +
-            "            description = #{description},\n" +
-            "            algorithm_type = #{algorithmType},\n" +
-            "            algorithm_version = #{algorithmVersion},\n" +
-            "            team = #{team},\n" +
-            "            topic = #{topic},\n" +
-            "            status = #{status}\n" +
-            "where algorithm_id = #{algorithmId}\n")
     void update(AlgorithmExpandInfrastructureEntity algorithmExpandInfrastructureEntity);
 }

+ 46 - 0
simulation-resource-common/src/main/resources/mysql/mapper/AlgorithmExpandMapper.xml

@@ -0,0 +1,46 @@
+<?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.common.infrastructure.mysql.mapper.AlgorithmExpandMapper">
+    <insert id="insert">
+        insert into algorithm_expand(id, algorithm_id, algorithm_name, description, algorithm_type, algorithm_version,
+                                     team, topic, status)
+            value (#{id}, #{algorithmId}, #{algorithmName}, #{description}, #{algorithmType}, #{algorithmVersion},
+                   #{team}, #{topic}, #{status})
+    </insert>
+    <update id="update">
+        update algorithm_expand
+        set algorithm_name    = #{algorithmName},
+            description       = #{description},
+            algorithm_type    = #{algorithmType},
+            algorithm_version = #{algorithmVersion},
+            team              = #{team},
+            topic             = #{topic},
+            status            = #{status}
+        where algorithm_id = #{algorithmId}
+    </update>
+
+
+    <select id="select"
+            resultType="com.css.simulation.resource.common.infrastructure.mysql.entity.AlgorithmExpandInfrastructureEntity">
+        select id, algorithm_id, algorithm_name, description, algorithm_type, status
+        from algorithm_expand
+        where 1=1
+        <if test="algorithmIds != null">
+            and algorithm_id in
+            <foreach item='item' collection='algorithmIds' separator=',' open='(' close=')'>
+                #{item}
+            </foreach>
+        </if>
+        <if test="algorithmId != null and algorithmId != ''">
+            and algorithm_id = #{algorithmId}
+        </if>
+    </select>
+    <select id="selectAlgorithmIds" resultType="java.lang.String">
+        select algorithm_id
+        from algorithm_expand
+        where algorithm_id in
+        <foreach item='item' collection='algorithmIds' separator=',' open='(' close=')'>
+            #{item}
+        </foreach>
+    </select>
+</mapper>