• 【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 &lt; = #{endTime} -->
                    and logintime  <![CDATA[<=]]> #{endTime}
                </if>
            </where>
            order by logintime desc
        </select>
    </mapper>
  • 相关阅读:
    易普优高级计划排程Light版助力中小企业实现精益化计划
    06易普优APS行业方案:包装印刷行业高级计划排程
    APS高级计划排程系统应该支持的企业应用场景
    易普优APS应用案例:线束行业生产计划排产
    某PCBA企业应用易普优APS实现高级计划排程案例
    APS高级计划排程系统应该支持的企业应用场景
    oracle 字符串分割
    速度极快的导出excel
    dev winform导出功能
    sql with as union all
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/12234558.html
Copyright © 2020-2023  润新知