dcs 6 months ago
parent
commit
920ec34fb8
1 changed files with 8 additions and 7 deletions
  1. 8 7
      virgo.api/src/main/resources/mapper/TagMapper.xml

+ 8 - 7
virgo.api/src/main/resources/mapper/TagMapper.xml

@@ -17,19 +17,19 @@
     </select>
 
     <select id="fuzzyName" resultType="long">
-        SELECT id FROM tag where name LIKE CONCAT('%', #{name}, '%')
+        SELECT id FROM tag where deleteState = 0 and name LIKE CONCAT('%', #{name}, '%')
     </select>
 
     <select id="getType" resultMap="tagResult">
-        select * from tag where type = #{type} or type = 0
+        select * from tag where deleteState = 0 and type = #{type} or type = 0
     </select>
 
     <select id="getCode" resultMap="tagResult">
-        select * from tag where code = #{code} or type = 0
+        select * from tag where deleteState = 0 and code = #{code} or type = 0
     </select>
 
     <select id="getOrganizationId" resultMap="tagResult">
-        select * from tag where organizationId = #{organizationId} and type = #{type} or type = 0
+        select * from tag where deleteState = 0 and organizationId = #{organizationId} and type = #{type} or type = 0
     </select>
 
     <select id="getList" resultMap="tagResult">
@@ -50,6 +50,7 @@
             <if test="organizationId != 0">
                 and organizationId = #{organizationId}
             </if>
+            and deleteState = 0
         </where>
     </select>
 
@@ -57,9 +58,9 @@
         INSERT INTO tag (code, name, type, organizationId) VALUES (#{code}, #{name}, #{type}, #{organizationId})
     </insert>
 
-    <delete id="delete">
-        DELETE FROM tag WHERE id=#{id}
-    </delete>
+    <update id="delete">
+        UPDATE tag SET deleteState = 1 WHERE id=#{id}
+    </update>
 
     <update id="update" parameterType="com.bosshand.virgo.api.model.Tag">
         UPDATE tag