ept_user_logMapper.xml 6.8 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.eport.rest.dao.EptUserLogDao">
    
	<sql id="EptUserLogEntityColumns">
		a1.ID AS "id"
		,a1.ACTION_NAME AS "actionName"
		,a1.MENU_NAME AS "menuName"
		,a1.BOOK_ID AS "bookId"
		,a1.CONTENT_ID AS "contentId"
		,a1.BOOK_NAME AS "bookName"
		,a1.CONTENT_NAME AS "contentName"
		,a1.USER_ID AS "userId"
		,a1.USER_NAME AS "userName"
		,a1.CREATE_DATE AS "createDate"
	</sql>
	
	<sql id="EptUserLogEntityListColumns">
		a1.ID AS "id"
		,a1.ACTION_NAME AS "actionName"
		,a1.MENU_NAME AS "menuName"
		,a1.BOOK_ID AS "bookId"
		,a1.BOOK_NAME AS "bookName"
		,a1.CONTENT_NAME AS "contentName"
		,a1.USER_NAME AS "userName"
		,a1.CREATE_DATE AS "createDate"
	</sql>
	
	
	
		<!--查询表中所有资料(所有字段) -->
		<select id="listAll"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserLogEntity"
		>
		select  
			<include refid="EptUserLogEntityColumns"/>
		FROM ept_user_log  a1
		WHERE 1=1
		<if test="actionName != null">
		and ACTION_NAME = #{actionName}
		</if>
		<if test="contentName != null">
		and CONTENT_NAME like CONCAT(CONCAT('%',#{contentName}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="createDate_start != null and createDate_start!=''">
		and CREATE_DATE &gt;=#{createDate_start}
		</if>
		<if test="createDate_end != null and createDate_end!=''">
		and CREATE_DATE &lt;=#{createDate_end}
		</if>
		<if test="menuName != null">
		and MENU_NAME like CONCAT(CONCAT('%',#{menuName}),'%')
		</if>
		<if test="bookName != null">
		and BOOK_NAME like CONCAT(CONCAT('%',#{bookName}),'%')
		</if>
		order by 
		CREATE_DATE desc
		</select>
		
	
		<!--分页查询资料(所有字段) -->
		<select id="pageAll"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserLogEntity"
		>
		select  
			<include refid="EptUserLogEntityColumns"/>
		FROM ept_user_log  a1
		WHERE 1=1
		<if test="actionName != null">
		and ACTION_NAME = #{actionName}
		</if>
		<if test="contentName != null">
		and CONTENT_NAME like CONCAT(CONCAT('%',#{contentName}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="createDate_start != null and createDate_start!=''">
		and CREATE_DATE &gt;=#{createDate_start}
		</if>
		<if test="createDate_end != null and createDate_end!=''">
		and CREATE_DATE &lt;=#{createDate_end}
		</if>
		<if test="menuName != null">
		and MENU_NAME like CONCAT(CONCAT('%',#{menuName}),'%')
		</if>
		<if test="bookName != null">
		and BOOK_NAME like CONCAT(CONCAT('%',#{bookName}),'%')
		</if>
		order by 
		CREATE_DATE desc
		</select>
		
	
		<!--查询表中所有资料(仅列表显示字段) -->
		<select id="list"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserLogEntity"
		>
		select  
			<include refid="EptUserLogEntityListColumns"/>
		FROM ept_user_log  a1
		WHERE 1=1
		<if test="actionName != null">
		and ACTION_NAME = #{actionName}
		</if>
		<if test="contentName != null">
		and CONTENT_NAME like CONCAT(CONCAT('%',#{contentName}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="createDate_start != null and createDate_start!=''">
		and CREATE_DATE &gt;=#{createDate_start}
		</if>
		<if test="createDate_end != null and createDate_end!=''">
		and CREATE_DATE &lt;=#{createDate_end}
		</if>
		<if test="menuName != null">
		and MENU_NAME like CONCAT(CONCAT('%',#{menuName}),'%')
		</if>
		<if test="bookName != null">
		and BOOK_NAME like CONCAT(CONCAT('%',#{bookName}),'%')
		</if>
		order by 
		CREATE_DATE desc
		</select>
		
	
		<!--分页查询资料(仅列表显示字段) -->
		<select id="page"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptUserLogEntity"
		>
		select  
			<include refid="EptUserLogEntityListColumns"/>
		FROM ept_user_log  a1
		WHERE 1=1
		<if test="actionName != null">
		and ACTION_NAME = #{actionName}
		</if>
		<if test="contentName != null">
		and CONTENT_NAME like CONCAT(CONCAT('%',#{contentName}),'%')
		</if>
		<if test="userName != null">
		and USER_NAME like CONCAT(CONCAT('%',#{userName}),'%')
		</if>
		<if test="createDate_start != null and createDate_start!=''">
		and CREATE_DATE &gt;=#{createDate_start}
		</if>
		<if test="createDate_end != null and createDate_end!=''">
		and CREATE_DATE &lt;=#{createDate_end}
		</if>
		<if test="menuName != null">
		and MENU_NAME like CONCAT(CONCAT('%',#{menuName}),'%')
		</if>
		<if test="bookName != null">
		and BOOK_NAME like CONCAT(CONCAT('%',#{bookName}),'%')
		</if>
		order by 
		CREATE_DATE desc
		</select>
		
	
		<!--根据主键查询数据 -->
		<select id="findByPK"  
		parameterType="Integer" 
		resultType="com.eport.rest.entity.EptUserLogEntity"
		>
		select  
		<include refid="EptUserLogEntityColumns"/>
		FROM ept_user_log  a1
		WHERE a1.ID=#{par}
		</select>
		
	
		<!--新增数据 -->
		<insert id="insert"  
		parameterType="com.eport.rest.entity.EptUserLogEntity" 
		>
		<selectKey resultType="Integer" order="AFTER" keyProperty="id">
		<if test="id != null ">
		select #{id} from dual
		</if>
		<if test="id == null ">
		SELECT LAST_INSERT_ID() AS id
		</if>
		 </selectKey>
		insert  
		  INTO ept_user_log (
		ACTION_NAME
		,MENU_NAME
		,BOOK_ID
		,CONTENT_ID
		,BOOK_NAME
		,CONTENT_NAME
		,USER_ID
		,USER_NAME
		,CREATE_DATE
		<if test="id != null ">
		,ID
		</if>
		  ) VALUES (
		#{actionName,jdbcType=VARCHAR}
		,#{menuName,jdbcType=VARCHAR}
		,#{bookId,jdbcType=INTEGER}
		,#{contentId,jdbcType=VARCHAR}
		,#{bookName,jdbcType=VARCHAR}
		,#{contentName,jdbcType=VARCHAR}
		,#{userId,jdbcType=INTEGER}
		,#{userName,jdbcType=VARCHAR}
		,#{createDate,jdbcType=DATE}
		<if test="id != null ">
		,#{id,jdbcType=INTEGER}
		</if>
		  )
		</insert>
		
	
		<!--更新数据 -->
		<update id="update"  
		parameterType="com.eport.rest.entity.EptUserLogEntity" 
		>
		update  
		ept_user_log
		<set>
		<if test="actionName != null ">
		ACTION_NAME = #{actionName},
		</if>
		<if test="menuName != null ">
		MENU_NAME = #{menuName},
		</if>
		<if test="bookId != null ">
		BOOK_ID = #{bookId},
		</if>
		<if test="contentId != null ">
		CONTENT_ID = #{contentId},
		</if>
		<if test="bookName != null ">
		BOOK_NAME = #{bookName},
		</if>
		<if test="contentName != null ">
		CONTENT_NAME = #{contentName},
		</if>
		<if test="userId != null ">
		USER_ID = #{userId},
		</if>
		<if test="userName != null ">
		USER_NAME = #{userName},
		</if>
		<if test="createDate != null ">
		CREATE_DATE = #{createDate},
		</if>
		</set>
		WHERE ID = #{id}
		</update>
		
	
		<!--根据主键删除数据 -->
		<delete id="delete"  
		parameterType="HashMap" 
		>
		delete  
		from ept_user_log 
		 WHERE ID in (${par})
		</delete>
		
	
</mapper>