【SSM sql.xml】日志查询mapper.xml
LogInfoMapper.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.kikyo.sys.mapper.LogInfoMapper">
<resultMap id="BaseResultMap" type="com.kikyo.sys.domain.LogInfo">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="loginname" jdbcType="VARCHAR" property="loginname"/>
<result column="loginip" jdbcType="VARCHAR" property="loginip"/>
<result column="logintime" jdbcType="TIMESTAMP" property="logintime"/>
</resultMap>
<sql id="Base_Column_List">
id, loginname, loginip, logintime
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sys_log_login
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys_log_login
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.kikyo.sys.domain.LogInfo">
insert into sys_log_login (id, loginname, loginip,
logintime)
values (#{id,jdbcType=INTEGER}, #{loginname,jdbcType=VARCHAR}, #{loginip,jdbcType=VARCHAR},
#{logintime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.kikyo.sys.domain.LogInfo">
insert into sys_log_login
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="loginname != null">
loginname,
</if>
<if test="loginip != null">
loginip,
</if>
<if test="logintime != null">
logintime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="loginname != null">
#{loginname,jdbcType=VARCHAR},
</if>
<if test="loginip != null">
#{loginip,jdbcType=VARCHAR},
</if>
<if test="logintime != null">
#{logintime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.kikyo.sys.domain.LogInfo">
update sys_log_login
<set>
<if test="loginname != null">
loginname = #{loginname,jdbcType=VARCHAR},
</if>
<if test="loginip != null">
loginip = #{loginip,jdbcType=VARCHAR},
</if>
<if test="logintime != null">
logintime = #{logintime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.kikyo.sys.domain.LogInfo">
update sys_log_login
set loginname = #{loginname,jdbcType=VARCHAR},
loginip = #{loginip,jdbcType=VARCHAR},
logintime = #{logintime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update> <!-- 查询日志 -->
<select id="queryAllLogInfo" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sys_log_login
<where>
<if test="loginname!=null and loginname!=''">
and loginname like concat("%",#{loginname},"%")
</if>
<if test="loginip!=null and loginip!=''">
and loginip like concat("%",#{loginip},"%")
</if>
<if test="startTime!=null">
and logintime >=#{startTime}
</if>
<if test="endTime!=null">
<!-- and logintime < = #{endTime} -->
and logintime <![CDATA[<=]]> #{endTime}
</if>
</where>
order by logintime desc
</select>
</mapper>
【SSM sql.xml】日志查询mapper.xml的更多相关文章
- (后端)mybatis 模糊查询 mapper.xml的写法(转)
原文地址:https://blog.csdn.net/sc6231565/article/details/46412765 1. sql中字符串拼接 SELECT * FROM tableName W ...
- mybatis 模糊查询 mapper.xml的写法
1. sql中字符串拼接 SELECT * FROM tableName WHERE name LIKE CONCAT(CONCAT('%', #{text}), '%'); 2. 使用 ${...} ...
- SpringBoot项目里,让TKmybatis支持可以手写sql的Mapper.xml文件
SpringBoot项目通常配合TKMybatis或MyBatis-Plus来做数据的持久化. 对于单表的增删改查,TKMybatis优雅简洁,无需像传统mybatis那样在mapper.xml文件里 ...
- SSM框架mapper.xml模糊查询语句
SSM框架mapper.xml模糊查询语句 在用SSM框架时,如果想要实现模糊查询,可以在mapper.xml文件中进行数据库语句的书写,方法有很多种,在这里我选择了两种介绍: 方法1: <se ...
- Mybatis中的Mapper.xml映射文件sql查询接收多个参数
我们都知道,在Mybatis中的Mapper.xml映射文件可以定制动态SQL,在dao层定义的接口中定义的参数传到xml文件中之后,在查询之前mybatis会对其进行动态解析,通常使用#{}接收 ...
- mybatis mapper xml文件的导入方式和查询方式
mybatis mapper xml文件的导入方式和查询方式 ssm框架 Mybatis mapper与SQLSession的关系 每个基于MyBatis的应用都是以一个SqlSessionFact ...
- mybatis mapper.xml 写关联查询 运用 resultmap 结果集中 用 association 关联其他表 并且 用 association 的 select 查询值 报错 java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for mybatis.map
用mybaits 写一个关联查询 查询商品表关联商品规格表,并查询规格表中的数量.价格等,为了sql重用性,利用 association 节点 查询 结果并赋值报错 商品表的mapper文件为Gooo ...
- IDEA 配置datasource,提升编码效率,让你在 Mapper.xml 中编写sql可以飞起来~
IDEA 2018 创建springboot工程后,如果你打开一个.sql文件,或者一个mybatis的mapper.xml文件,会提示: No data source are configured ...
- SSM框架 mapper.xml中 value的空值判断问题
先看解决方案,其他的都是问题的出处 解决方案:if中使用 _parameter,#{value}不变 <if test="_parameter!='' and _parameter!= ...
随机推荐
- kali 插上耳机没声音
这几天装kali装的真是心力憔悴,好不容易勉强可以使用了,插上耳机想要放松下,结果没有声音? excusu me? 在经历各种方法之后终于找到了解决方法,亲测可行. 1.先打开终端,输入systemc ...
- 【网易官方】极客战记(codecombat)攻略-地牢-恐惧之门
关卡连接: https://codecombat.163.com/play/level/dread-door 恐惧之门后藏满宝藏 简介: while-true 循环可以使用任何方法,如: while ...
- 【网易官方】极客战记(codecombat)攻略-地牢-祸之火焰
关卡连接: https://codecombat.163.com/play/level/banefire 绕着火焰跳舞,否则你的骨头下次就会被烧着 默认代码 # 食人魔看上去又大又慢,这是你的机会. ...
- xshell 链接虚拟机
1.在虚拟机上添加网络适配器,选择仅主机模式 2. 2.启用本机的网络连接 3.在虚拟机上开启ssh服务 首先看下22端口有没开放,如果没有的话需要开启 service start sshd 4.在虚 ...
- 【二叉搜索树】的详细实现(C++)
二叉搜索树的概念 从前面讨论折半搜索的性能中可知,如果每次从搜索序列的中间进行搜索,把区间缩小一半,通过有限次迭代,很快就能通近到所要寻找的元素.进一步,如果我们直接输入搜索序列,构造出类似于折半搜索 ...
- css全站字体,中文英文不同,粗细统一
@font-face { font-family: vwfont; src: url(/shop-m/public/fonts/VWText-Regular.otf); } @font-face { ...
- yii2自定义报错页面
在Yii2版本的advanced高级模板环境中:设置404自定义页面的方法 1.config/main.php文件 'errorHandler' => [ 'errorAction' => ...
- eclipse中怎么导入git库下载下来的web项目
总的看来是有两种方式: 方式一:可以对已经从版本库下载到本地的项目操作(Maven导入) 你可以通过公司提供的内部的版本库的网址登录版本库,之后在里面下载自己想要的那个版本的代码包,见下图 点击右侧的 ...
- Linux环境下mysql报错:bash: mysql: command not found 的解决方法
# mysql -u root-bash: mysql: command not found 原因:这是由于系统默认会查找/usr/bin下的命令. 如果这个命令不在这个目录下,当然会找不到命令. 我 ...
- zabbix监控服务部署脚本
搭建平台脚本: #!/bin/bash #zabbix监控服务部署 #脚本使用前提:yum搭建,nginx-1.12.2源码包,zabbix-3.4.4源码包,要求源码包尽量在单一目录下,最好在默认管 ...