ganzi-api/inventory-dao/src/main/resources/mapper/SysLogsMapper.xml
2022-09-16 15:07:17 +08:00

252 lines
8.8 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="com.rzyc.mapper.log.SysLogsMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.log.SysLogs">
<result column="log_id" jdbcType="VARCHAR" property="logId" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="nickname" jdbcType="VARCHAR" property="nickname" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="ip_address" jdbcType="VARCHAR" property="ipAddress" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.rzyc.model.log.SysLogsWithBLOBs">
<result column="params" jdbcType="LONGVARCHAR" property="params" />
<result column="response_str" jdbcType="LONGVARCHAR" property="responseStr" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
log_id, user_id, url, ip_address, create_time
</sql>
<sql id="Blob_Column_List">
params, response_str
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.rzyc.model.log.SysLogsExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from sys_logs
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.rzyc.model.log.SysLogsExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_logs
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="com.rzyc.model.log.SysLogsExample">
delete from sys_logs
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.log.SysLogsWithBLOBs">
insert into sys_logs (log_id, user_id, nickname,url,
ip_address, create_time, params,
response_str)
values (#{logId,jdbcType=VARCHAR},
#{userId,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR},
#{ipAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{params,jdbcType=LONGVARCHAR},
#{responseStr,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.log.SysLogsWithBLOBs">
insert into sys_logs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="logId != null">
log_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="url != null">
url,
</if>
<if test="ipAddress != null">
ip_address,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="params != null">
params,
</if>
<if test="responseStr != null">
response_str,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="logId != null">
#{logId,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="ipAddress != null">
#{ipAddress,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="params != null">
#{params,jdbcType=LONGVARCHAR},
</if>
<if test="responseStr != null">
#{responseStr,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.rzyc.model.log.SysLogsExample" resultType="java.lang.Long">
select count(*) from sys_logs
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_logs
<set>
<if test="record.logId != null">
log_id = #{record.logId,jdbcType=VARCHAR},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.url != null">
url = #{record.url,jdbcType=VARCHAR},
</if>
<if test="record.ipAddress != null">
ip_address = #{record.ipAddress,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.params != null">
params = #{record.params,jdbcType=LONGVARCHAR},
</if>
<if test="record.responseStr != null">
response_str = #{record.responseStr,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update sys_logs
set log_id = #{record.logId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
url = #{record.url,jdbcType=VARCHAR},
ip_address = #{record.ipAddress,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
params = #{record.params,jdbcType=LONGVARCHAR},
response_str = #{record.responseStr,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_logs
set log_id = #{record.logId,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
url = #{record.url,jdbcType=VARCHAR},
ip_address = #{record.ipAddress,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<!--日志列表-->
<select id="findAll" resultMap="BaseResultMap">
SELECT * FROM sys_logs sl
WHERE sl.`nickname` LIKE #{condition}
ORDER BY sl.`create_time` DESC
</select>
</mapper>