You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
5.2 KiB
116 lines
5.2 KiB
<?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.main.woka.Web.Mapper.KcInfoRelationMapper">
|
|
|
|
<resultMap type="com.main.woka.Common.util.KcInfoRelation" id="KcInfoRelationResult">
|
|
<result property="id" column="id"/>
|
|
<result property="sourceId" column="source_id"/>
|
|
<result property="targetId" column="target_id"/>
|
|
<result property="relation" column="relation"/>
|
|
<result property="sourceName" column="source_name"/>
|
|
<result property="targetName" column="target_name"/>
|
|
<result property="isGraph" column="is_graph"/>
|
|
</resultMap>
|
|
|
|
|
|
<insert id="insertDocRelation" parameterType="com.main.woka.Common.util.KcInfoRelation" useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
insert into kc_relation
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="relation != null">relation,</if>
|
|
<if test="sourceId != null">source_id,</if>
|
|
<if test="targetId != null">target_id,</if>
|
|
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="relation != null and relation != ''">#{relation},</if>
|
|
<if test="sourceId != null">#{sourceId},</if>
|
|
<if test="targetId != null">#{targetId},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<select id="getAllRelation" resultMap="KcInfoRelationResult"> select *
|
|
from kc_relation where is_graph = 0</select>
|
|
|
|
|
|
<insert id="insertFile" parameterType="com.main.woka.Common.util.KcTlFile" useGeneratedKeys="true" keyProperty="id">
|
|
INSERT INTO kc_tl_file (file_url, create_time,update_time, create_by, update_by,file_name)
|
|
VALUES (
|
|
|
|
#{fileUrl,jdbcType=VARCHAR},
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
#{createBy,jdbcType=BIGINT},
|
|
#{updateBy,jdbcType=BIGINT},
|
|
#{fileName,jdbcType=VARCHAR}
|
|
)
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<sql id="selectKcRelationshipVo">
|
|
select id, source_id, target_id, relation, source_name, target_name,is_graph
|
|
from kc_relation </sql>
|
|
|
|
<select id="selectKcRelationshipList" parameterType="com.main.woka.Common.util.KcInfoRelation" resultMap="KcInfoRelationResult">
|
|
<include refid="selectKcRelationshipVo"/>
|
|
<where>
|
|
<if test="relation != null and relation != ''"> and relation = #{relation}</if>
|
|
<if test="sourceId != null "> and sourceId = #{sourceId}</if>
|
|
<if test="targetId != null "> and targetId = #{targetId}</if>
|
|
<if test="sourceName != null and sourceName != ''"> and sourceName = #{sourceName}</if>
|
|
<if test="targetName != null and targetName != ''"> and targetName = #{targetName}</if>
|
|
<if test="isGraph != null "> and isGraph = #{isGraph}</if>
|
|
</where>
|
|
</select>
|
|
<select id="selectKcRelationshipById" parameterType="Long" resultMap="KcInfoRelationResult">
|
|
<include refid="selectKcRelationshipVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
<insert id="insertKcRelationship" parameterType="com.main.woka.Common.util.KcInfoRelation" useGeneratedKeys="true" keyProperty="id">
|
|
insert into kc_relation
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="relation != null and relation != ''">relation,</if>
|
|
<if test="sourceId != null">source_id,</if>
|
|
<if test="targetId != null">target_id,</if>
|
|
<if test="sourceName != null and sourceName != ''">source_name,</if>
|
|
<if test="targetName != null and targetName != ''">target_name,</if>
|
|
<if test="isGraph != null">is_graph,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="relation != null and relation != ''">#{relation},</if>
|
|
<if test="sourceId != null">#{sourceId},</if>
|
|
<if test="targetId != null">#{targetId},</if>
|
|
<if test="sourceName != null and sourceName != ''">#{sourceName},</if>
|
|
<if test="targetName != null and targetName != ''">#{targetName},</if>
|
|
<if test="isGraph != null">#{isGraph},</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateKcRelationship" parameterType="com.main.woka.Common.util.KcInfoRelation">
|
|
update kc_relation
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="relation != null and relation != ''">relation = #{relation},</if>
|
|
<if test="sourceId != null">source_id = #{sourceId},</if>
|
|
<if test="targetId != null">targe_id = #{targetId},</if>
|
|
<if test="isGraph != null">is_graph = #{isGraph},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
<delete id="deleteKcRelationshipById" parameterType="Long"> delete from kc_relation where id = #{id} </delete>
|
|
<delete id="deleteKcRelationshipByIds" parameterType="String">
|
|
delete from kc_relation where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach>
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|