OperationLogMapper.xml 2.7 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.sibu.orderHelper.integral.web.dao.IMOperationLogDao">

	<resultMap type="com.sibu.orderHelper.integral.model.OperationLog" id="listOperationLog">
		<id column="id" property="id"/>
		<result column="operation_user" property="operationUser" />
		<result column="operation_type" property="operationType" />
		<result column="operation_object" property="operationObject" />
		<result column="operation_date" property="operationDate" />
		<result column="operation_content" property="operationContent" />
	</resultMap>

	<!-- 保存日志 -->
	<insert id="save"   parameterType="com.sibu.orderHelper.integral.model.OperationLog">
		INSERT INTO `operation_log` (
		  `operation_user`,
		  `operation_type`,
		  `operation_object`,
		  `operation_date`,
		  `operation_content`
		) 
		VALUES
		  (
		    #{operationUser},
		    #{operationType},
		    #{operationObject},
		    #{operationDate},
		    #{operationContent}
		  ) ;
	</insert>

	<select id="operationPager" parameterType="map" resultMap="listOperationLog">
		select * from operation_log
		where operation_type=#{operationType}
		<if test="operationUser != null and operationUser != ''">
			AND operation_user LIKE concat('%',#{operationUser},'%')
		</if>
		<if test="operationObject != null and operationObject != ''">
			AND operation_object LIKE concat('%',#{operationObject},'%')
		</if>
		<if test="operationContent != null and operationContent != ''">
			AND operation_content LIKE concat('%',#{operationContent},'%')
		</if>
		<if test="startDate != null and startDate != ''">
            AND operation_date >= #{startDate}
		</if>
		<if test="endDate != null and endDate != ''">
            <![CDATA[
		      AND operation_date <= #{endDate}
		    ]]>
		</if>
		ORDER BY operation_date DESC
		LIMIT ${pageNow}, ${pageSize}
	</select>

	<select id="totalOperation" parameterType="map" resultType="int">
		select count(id) from operation_log
		where operation_type=#{operationType}
		<if test="operationUser != null and operationUser != ''">
			AND operation_user LIKE concat('%',#{operationUser},'%')
		</if>
		<if test="operationObject != null and operationObject != ''">
			AND operation_object LIKE concat('%',#{operationObject},'%')
		</if>
		<if test="operationContent != null and operationContent != ''">
			AND operation_content LIKE concat('%',#{operationContent},'%')
		</if>
		<if test="startDate != null and startDate != ''">
			AND operation_date >= #{startDate}
		</if>
		<if test="endDate != null and endDate != ''">
			<![CDATA[
		      AND operation_date <= #{endDate}
		    ]]>
		</if>
	</select>


	
</mapper>