Procházet zdrojové kódy

fix:租户新增、修改、查询、删除接口

xuezizhuo před 1 rokem
rodič
revize
ee34c982fa

+ 10 - 13
ruoyi-system/src/main/resources/mapper/system/SysTenantMapper.xml

@@ -19,24 +19,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectSysTenantVo">
-        select tenant_id, tenant_name, tenant_code, owner, contact_info, address, create_by, create_time, is_del,datasource_id from sys_tenant
+        select tenant_id, tenant_name, tenant_code, owner, contact_info, address, create_by, create_time, is_del,datasource_id from sys_tenant where is_del = '0'
     </sql>
 
     <select id="selectSysTenantList" parameterType="SysTenant" resultMap="SysTenantResult">
         <include refid="selectSysTenantVo"/>
-        <where>  
             <if test="tenantName != null  and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
             <if test="tenantCode != null  and tenantCode != ''"> and tenant_code = #{tenantCode}</if>
             <if test="owner != null  and owner != ''"> and owner = #{owner}</if>
             <if test="contactInfo != null  and contactInfo != ''"> and contact_info = #{contactInfo}</if>
             <if test="address != null  and address != ''"> and address = #{address}</if>
             <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
-        </where>
     </select>
     
     <select id="selectSysTenantByTenantId" parameterType="Long" resultMap="SysTenantResult">
         <include refid="selectSysTenantVo"/>
-        where tenant_id = #{tenantId}
+        and tenant_id = #{tenantId}
     </select>
         
     <insert id="insertSysTenant" parameterType="SysTenant" useGeneratedKeys="true" keyProperty="tenantId">
@@ -49,8 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="address != null">address,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             <if test="createTime != null">create_time,</if>
-            <if test="isDel != null and isDel != ''">is_del,</if>
             <if test="datasourceId != null">datasource_id,</if>
+            is_del
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="tenantName != null and tenantName != ''">#{tenantName},</if>
@@ -60,8 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="address != null">#{address},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
-            <if test="isDel != null and isDel != ''">#{isDel},</if>
             <if test="datasourceId != null">#{datasourceId},</if>
+            '0'
          </trim>
     </insert>
 
@@ -75,20 +73,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="address != null">address = #{address},</if>
             <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
             <if test="datasourceId != null">datasource_id = #{datasourceId},</if>
         </trim>
         where tenant_id = #{tenantId}
     </update>
 
-    <delete id="deleteSysTenantByTenantId" parameterType="Long">
-        delete from sys_tenant where tenant_id = #{tenantId}
-    </delete>
+    <update id="deleteSysTenantByTenantId" parameterType="Long">
+        update sys_tenant set is_del = '2' where tenant_id = #{tenantId}
+    </update>
 
-    <delete id="deleteSysTenantByTenantIds" parameterType="String">
-        delete from sys_tenant where tenant_id in 
+    <update id="deleteSysTenantByTenantIds" parameterType="String">
+        update sys_tenant set is_del = '2' where tenant_id in
         <foreach item="tenantId" collection="array" open="(" separator="," close=")">
             #{tenantId}
         </foreach>
-    </delete>
+    </update>
 </mapper>