OperationLogMapper.xml 2.29 KB
<?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.yoho.order.dal.OperationLogMapper">
    <resultMap id="BaseResultMap" type="com.yoho.order.model.OperationLog">
        <result column="id" property="id" jdbcType="INTEGER" />
        <result column="uid" property="uId" jdbcType="INTEGER" />
        <result column="uname" property="uName" jdbcType="VARCHAR" />
        <result column="method_name" property="methodName" jdbcType="VARCHAR" />
        <result column="method_param" property="methodParam" jdbcType="VARCHAR" />
        <result column="create_time" property="createTime" jdbcType="INTEGER" />
        <result column="ip"  property="ip" jdbcType="VARCHAR" />
    </resultMap>

    <sql id="Base_Column_List">
        id, uid, method_name, method_param, create_time, uname, ip
    </sql>

    <select id="page" parameterType="com.yoho.order.model.OperationLogReq" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from operation_log
        where 1 = 1
        <if test="operationName != null and operationName != ''">
            and uname like concat('%', #{operationName,jdbcType=VARCHAR}, '%')
        </if>
        order by id desc
        limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
    </select>

    <select id="detail" parameterType="int" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from operation_log
        where id = #{id,jdbcType=INTEGER}
        limit 1
    </select>

    <select id="count" parameterType="com.yoho.order.model.OperationLogReq" resultType="int">
        select count(1)
        from operation_log
        where 1 = 1
        <if test="operationName != null and operationName != ''">
            and uname like concat(#{operationName,jdbcType=VARCHAR}, '%')
        </if>
    </select>

    <insert id="save" parameterType="com.yoho.order.model.OperationLog">
        insert into
            operation_log(`uid`,`method_name`,`method_param`,`create_time`,`uname`,`ip`)
        values(#{uId,jdbcType=INTEGER},#{methodName,jdbcType=VARCHAR},#{methodParam,jdbcType=VARCHAR},
                #{createTime,jdbcType=INTEGER},#{uName,jdbcType=VARCHAR},#{ip,jdbcType=VARCHAR})
    </insert>
</mapper>