Files
fateverse/custom-query/custom-query-biz/src/main/resources/mapper/PortalMapper.xml
2024-04-24 11:49:10 +08:00

112 lines
4.7 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.PortalMapper">
<sql id="selectVo">
select portal_id,
query_id,
adapter_id,
portal_name,
permission_type,
type,
request_method,
create_data_adapter,
page,
path,
url,
state,
create_by,
create_time,
update_by,
update_time,
remark
from portal
</sql>
<select id="selectById" resultType="cn.fateverse.query.entity.Portal">
<include refid="selectVo"/>
where portal_id = #{portalId}
</select>
<select id="selectList" resultType="cn.fateverse.query.entity.Portal">
<include refid="selectVo"/>
<where>
<if test="portalName != null and portalName != ''">and portal_name like concat('%', #{portalName}, '%')</if>
<if test="permissionType != null ">and permission_type = #{permissionType}</if>
<if test="type != null">and type = #{type}</if>
<if test="state != null">and state = #{state}</if>
<if test="path != null and path != ''">and path like concat('%', #{path}, '%')</if>
</where>
</select>
<select id="selectByPath" resultType="cn.fateverse.query.entity.Portal">
<include refid="selectVo"/>
where path = #{path} and request_method = #{requestMethod} limit 1
</select>
<insert id="insert" useGeneratedKeys="true" keyColumn="portal_id" keyProperty="portalId">
insert into portal
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="queryId != null">query_id,</if>
<if test="adapterId != null">adapter_id,</if>
<if test="portalName != null">portal_name,</if>
<if test="permissionType != null">permission_type,</if>
<if test="type != null">type,</if>
<if test="page != null">page,</if>
<if test="requestMethod != null">request_method,</if>
<if test="createDataAdapter != null">create_data_adapter,</if>
<if test="path != null">path,</if>
<if test="url != null">url,</if>
<if test="state != null">state,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="queryId != null">#{queryId},</if>
<if test="adapterId != null">#{adapterId},</if>
<if test="portalName != null">#{portalName},</if>
<if test="permissionType != null">#{permissionType},</if>
<if test="type != null">#{type},</if>
<if test="page != null">#{page},</if>
<if test="requestMethod != null">#{requestMethod},</if>
<if test="createDataAdapter != null">#{createDataAdapter},</if>
<if test="path != null">#{path},</if>
<if test="url != null">#{url},</if>
<if test="state != null">#{state},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
</trim>
</insert>
<update id="update">
update portal
<set>
<if test="queryId != null">query_id = #{queryId},</if>
<if test="adapterId != null">adapter_id = #{adapterId},</if>
<if test="portalName != null">portal_name = #{portalName},</if>
<if test="permissionType != null">permission_type = #{permissionType},</if>
<if test="type != null">type = #{type},</if>
<if test="page != null">type = #{page},</if>
<if test="requestMethod != null">request_method = #{requestMethod},</if>
<if test="createDataAdapter != null">create_data_adapter = #{createDataAdapter},</if>
<if test="path != null">path = #{path},</if>
<if test="url != null">url = #{url},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</set>
where portal_id = #{portalId}
</update>
<update id="updateState">
update portal
set state = #{state}
where portal_id = #{portalId}
</update>
<delete id="deleteById">
delete
from portal
where portal_id = #{portalId}
</delete>
</mapper>