Newer
Older
mcms / ms-basic / src / main / java / net / mingsoft / basic / dao / ISystemLogDao.xml
StephanieGitHub on 16 Dec 2020 9 KB first commit
<?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="net.mingsoft.basic.dao.ISystemLogDao">

	<resultMap id="resultMap" type="net.mingsoft.basic.entity.SystemLogEntity">
			<id column="id" property="id" /><!--编号 -->
				<result column="title" property="title" /><!--标题 -->
				<result column="ip" property="ip" /><!--IP -->
				<result column="business_type" property="businessType" /><!--业务类型 -->
				<result column="method" property="method" /><!--请求方法 -->
				<result column="request_method" property="requestMethod" /><!--请求方式 -->
				<result column="user_type" property="userType" /><!--用户类型 -->
				<result column="user" property="user" /><!--操作人员 -->
				<result column="url" property="url" /><!--请求地址 -->
				<result column="location" property="location" /><!--请求地址 -->
				<result column="param" property="param" /><!--请求参数 -->
				<result column="result" property="result" /><!--返回参数 -->
				<result column="status" property="status" /><!--请求状态 -->
				<result column="app_id" property="appId" /><!--请求状态 -->
				<result column="error_msg" property="errorMsg" /><!--错误消息 -->
				<result column="create_by" property="createBy" /><!--创建人 -->
				<result column="create_date" property="createDate" /><!--创建时间 -->
				<result column="update_by" property="updateBy" /><!--修改人 -->
				<result column="update_date" property="updateDate" /><!--修改时间 -->
				<result column="del" property="del" /><!--删除标记 -->
	</resultMap>

	<!--保存-->
	<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
			parameterType="net.mingsoft.basic.entity.SystemLogEntity" >
		insert into system_log
		<trim prefix="(" suffix=")" suffixOverrides=",">
				<if test="title != null and title != ''">title,</if>
				<if test="ip != null and ip != ''">ip,</if>
				<if test="businessType != null and businessType != ''">business_type,</if>
				<if test="method != null and method != ''">method,</if>
				<if test="requestMethod != null and requestMethod != ''">request_method,</if>
				<if test="userType != null and userType != ''">user_type,</if>
				<if test="user != null and user != ''">user,</if>
				<if test="url != null and url != ''">url,</if>
				<if test="location != null and location != ''">location,</if>
				<if test="param != null and param != ''">param,</if>
				<if test="result != null and result != ''">result,</if>
				<if test="status != null and status != ''">status,</if>
				<if test="appId != null and appId != ''">app_id,</if>
				<if test="errorMsg != null and errorMsg != ''">error_msg,</if>
				<if test="createBy &gt; 0">create_by,</if>
				<if test="createDate != null">create_date,</if>
				<if test="updateBy &gt; 0">update_by,</if>
				<if test="updateDate != null">update_date,</if>
				<if test="del != null">del,</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
				<if test="title != null and title != ''">#{title},</if>
				<if test="ip != null and ip != ''">#{ip},</if>
				<if test="businessType != null and businessType != ''">#{businessType},</if>
				<if test="method != null and method != ''">#{method},</if>
				<if test="requestMethod != null and requestMethod != ''">#{requestMethod},</if>
				<if test="userType != null and userType != ''">#{userType},</if>
				<if test="user != null and user != ''">#{user},</if>
				<if test="url != null and url != ''">#{url},</if>
				<if test="location != null and location != ''">#{location},</if>
				<if test="param != null and param != ''">#{param},</if>
				<if test="result != null and result != ''">#{result},</if>
				<if test="status != null and status != ''">#{status},</if>
				<if test="appId != null and appId != ''">#{appId},</if>
				<if test="errorMsg != null and errorMsg != ''">#{errorMsg},</if>
				<if test="createBy &gt; 0">#{createBy},</if>
				<if test="createDate != null">#{createDate},</if>
				<if test="updateBy &gt; 0">#{updateBy},</if>
				<if test="updateDate != null">#{updateDate},</if>
				<if test="del != null">#{del},</if>
		</trim>
	</insert>

		<!--更新-->
		<update id="updateEntity" parameterType="net.mingsoft.basic.entity.SystemLogEntity">
			update system_log
			<set>
				<if test="title != null and title != ''">title=#{title},</if>
				<if test="ip != null and ip != ''">ip=#{ip},</if>
				<if test="businessType != null and businessType != ''">business_type=#{businessType},</if>
				<if test="method != null and method != ''">method=#{method},</if>
				<if test="requestMethod != null and requestMethod != ''">request_method=#{requestMethod},</if>
				<if test="userType != null and userType != ''">user_type=#{userType},</if>
				<if test="user != null and user != ''">user=#{user},</if>
				<if test="url != null and url != ''">url=#{url},</if>
				<if test="location != null and location != ''">location=#{location},</if>
				<if test="param != null and param != ''">param=#{param},</if>
				<if test="result != null and result != ''">result=#{result},</if>
				<if test="status != null and status != ''">status=#{status},</if>
				<if test="appId != null and appId != ''">app_id=#{appId},</if>
				<if test="errorMsg != null and errorMsg != ''">error_msg=#{errorMsg},</if>
				<if test="createBy &gt; 0">create_by=#{createBy},</if>
				<if test="createDate != null">create_date=#{createDate},</if>
				<if test="updateBy &gt; 0">update_by=#{updateBy},</if>
				<if test="updateDate != null">update_date=#{updateDate},</if>
				<if test="del != null">del=#{del},</if>
			</set>
			where id = #{id}
		</update>

		<!--根据id获取-->
		<select id="getEntity" resultMap="resultMap" parameterType="int">
			select * from system_log where id=#{id}
		</select>

		<!--根据实体获取-->
		<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.basic.entity.SystemLogEntity">
			select * from system_log
			<where>
				<if test="title != null and title != ''">and title=#{title}</if>
				<if test="ip != null and ip != ''">and ip=#{ip}</if>
				<if test="businessType != null and businessType != ''">and business_type=#{businessType}</if>
				<if test="method != null and method != ''">and method=#{method}</if>
				<if test="requestMethod != null and requestMethod != ''">and request_method=#{requestMethod}</if>
				<if test="userType != null and userType != ''">and user_type=#{userType}</if>
				<if test="user != null and user != ''">and user=#{user}</if>
				<if test="url != null and url != ''">and url=#{url}</if>
				<if test="location != null and location != ''">and location=#{location}</if>
				<if test="param != null and param != ''">and param=#{param}</if>
				<if test="result != null and result != ''">and result=#{result}</if>
				<if test="status != null and status != ''">and status=#{status}</if>
				<if test="appId != null and appId != ''">and app_id=#{appId}</if>
				<if test="errorMsg != null and errorMsg != ''">and error_msg=#{errorMsg}</if>
				<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
				<if test="createDate != null"> and create_date=#{createDate} </if>
				<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
				<if test="updateDate != null"> and update_date=#{updateDate} </if>
				<if test="del != null"> and del=#{del} </if>
			</where>
			limit 0,1
		</select>


		<!--删除-->
		<delete id="deleteEntity" parameterType="int">
			delete from system_log  where id=#{id}
		</delete>

		<!--批量删除-->
		<delete id="delete" >
			delete from system_log
			<where>
				id  in <foreach collection="ids" item="item" index="index"
										 open="(" separator="," close=")">#{item}</foreach>
			</where>
		</delete>
		<!--查询全部-->
		<select id="queryAll" resultMap="resultMap">
			select * from system_log order by id desc
		</select>
	<!--条件查询-->
	<select id="query" resultMap="resultMap">
		select * from system_log
		<where>
			<if test="title != null and title != ''"> and title like CONCAT('%',#{title},'%')</if>
			<if test="ip != null and ip != ''"> and ip=#{ip}</if>
			<if test="businessType != null and businessType != ''"> and business_type=#{businessType}</if>
			<if test="method != null and method != ''"> and method=#{method}</if>
			<if test="requestMethod != null and requestMethod != ''"> and request_method=#{requestMethod}</if>
			<if test="userType != null and userType != ''"> and user_type=#{userType}</if>
			<if test="user != null and user != ''"> and user like CONCAT('%',#{user},'%')</if>
			<if test="url != null and url != ''"> and url like CONCAT('%',#{url},'%')</if>
			<if test="location != null and location != ''"> and location=#{location}</if>
			<if test="param != null and param != ''"> and param=#{param}</if>
			<if test="result != null and result != ''"> and result=#{result}</if>
			<if test="status != null and status != ''"> and status=#{status}</if>
			<if test="appId != null and appId != ''"> and app_id=#{appId}</if>
			<if test="errorMsg != null and errorMsg != ''"> and error_msg=#{errorMsg}</if>
			<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
			<if test="createDate != null"> and create_date=#{createDate} </if>
			<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
			<if test="updateDate != null"> and update_date=#{updateDate} </if>
			<if test="del != null"> and del=#{del} </if>
			<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
		</where>
		order by id desc
	</select>

</mapper>