115 lines
4.3 KiB
XML
115 lines
4.3 KiB
XML
<?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="cn.fateverse.query.mapper.UniConMapper">
|
|
<sql id="selectSql">
|
|
select uc_id,
|
|
uq_id,
|
|
uc_name,
|
|
uc_key,
|
|
uc_con,
|
|
uc_mock,
|
|
uc_describe,
|
|
uc_type,
|
|
type,
|
|
sort
|
|
from uni_con
|
|
</sql>
|
|
|
|
<select id="selectByQueryId" resultType="cn.fateverse.query.entity.UniCon">
|
|
<include refid="selectSql"/>
|
|
where uq_id = #{queryId}
|
|
order by sort
|
|
</select>
|
|
|
|
<select id="selectByQueryIdAndUcIdList" resultType="cn.fateverse.query.entity.UniCon">
|
|
<include refid="selectSql"/>
|
|
where uq_id = #{queryId}
|
|
and uc_id in
|
|
<foreach collection="list" item="ucId" open="(" separator="," close=")">
|
|
#{ucId}
|
|
</foreach>
|
|
order by sort
|
|
</select>
|
|
|
|
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="ucId" keyColumn="uc_id">
|
|
insert into uni_con (uq_id, uc_name, uc_key, uc_con, uc_mock, uc_describe, uc_type, type) VALUES
|
|
<foreach collection="list" separator="," item="con">
|
|
(#{con.uqId}, #{con.ucName}, #{con.ucKey}, #{con.ucCon}, #{con.ucMock}, #{con.ucDescribe}, #{con.ucType}, #{con.type} )
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="batchUpdate">
|
|
update uni_con
|
|
<set>
|
|
<trim prefix="uc_name = case" suffix="end,">
|
|
<foreach collection="list" separator=" " item="item">
|
|
<if test="item.ucName != null">
|
|
when column_id = #{item.columnId} then #{item.ucName}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="uc_key = case" suffix="end,">
|
|
<foreach collection="list" separator=" " item="item">
|
|
<if test="item.ucKey != null">
|
|
when column_id = #{item.columnId} then #{item.ucKey}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="uc_con = case" suffix="end,">
|
|
<foreach collection="list" separator=" " item="item">
|
|
<if test="item.ucCon != null">
|
|
when column_id = #{item.columnId} then #{item.ucCon}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="uc_mock = case" suffix="end,">
|
|
<foreach collection="list" separator=" " item="item">
|
|
<if test="item.ucMock != null">
|
|
when column_id = #{item.columnId} then #{item.ucMock}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="uc_describe = case" suffix="end,">
|
|
<foreach collection="list" separator=" " item="item">
|
|
<if test="item.ucDescribe != null">
|
|
when column_id = #{item.columnId} then #{item.ucDescribe}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="uc_type = case" suffix="end,">
|
|
<foreach collection="list" separator=" " item="item">
|
|
<if test="item.ucType != null">
|
|
when column_id = #{item.columnId} then #{item.ucType}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="type = case" suffix="end,">
|
|
<foreach collection="list" separator=" " item="item">
|
|
<if test="item.type != null">
|
|
when column_id = #{item.columnId} then #{item.type}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
</set>
|
|
where uc_id in
|
|
<foreach collection="list" item="item" index="index"
|
|
separator="," open="(" close=")">
|
|
#{item.ucId}
|
|
</foreach>
|
|
</update>
|
|
|
|
|
|
<delete id="batchDelete">
|
|
delete from uni_con where uq_id = #{queryId}
|
|
</delete>
|
|
|
|
<delete id="batchRemove">
|
|
delete from uni_con where uq_id in
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
</mapper> |