You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

209 lines
7.2 KiB
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.manage.dao.Power_LogMapper" >
<resultMap id="BaseResultMap" type="com.manage.vo.Power_LogVo" >
<id column="log_id" property="logId" jdbcType="INTEGER" />
<result column="log_title" property="logTitle" jdbcType="VARCHAR" />
<result column="ip" property="ip" jdbcType="CHAR" />
<result column="log_content" property="logContent" jdbcType="VARCHAR" />
<result column="sys_flag" property="sysFlag" jdbcType="VARCHAR" />
<result column="sys_id" property="sysId" jdbcType="INTEGER" />
<result column="create_date" property="createDate" jdbcType="CHAR" />
<result column="creater" property="creater" jdbcType="VARCHAR" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
log_id, log_title, ip, log_content, sys_flag, sys_id, create_date, creater, remark
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from power_log
where log_id = #{logId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from power_log
where log_id = #{logId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.manage.entity.Power_Log" >
insert into power_log (log_id, log_title, ip,
log_content, sys_flag, sys_id,
create_date, creater, remark,unlock_date
)
values (#{logId,jdbcType=INTEGER}, #{logTitle,jdbcType=VARCHAR}, #{ip,jdbcType=CHAR},
#{logContent,jdbcType=VARCHAR}, #{sysFlag,jdbcType=VARCHAR}, #{sysId,jdbcType=INTEGER},
#{createDate,jdbcType=CHAR}, #{creater,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},#{unlockDate,jdbcType=CHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.manage.entity.Power_Log" >
insert into power_log
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="logId != null" >
log_id,
</if>
<if test="logTitle != null" >
log_title,
</if>
<if test="ip != null" >
ip,
</if>
<if test="logContent != null" >
log_content,
</if>
<if test="sysFlag != null" >
sys_flag,
</if>
<if test="sysId != null" >
sys_id,
</if>
<if test="createDate != null" >
create_date,
</if>
<if test="creater != null" >
creater,
</if>
<if test="remark != null" >
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="logId != null" >
#{logId,jdbcType=INTEGER},
</if>
<if test="logTitle != null" >
#{logTitle,jdbcType=VARCHAR},
</if>
<if test="ip != null" >
#{ip,jdbcType=CHAR},
</if>
<if test="logContent != null" >
#{logContent,jdbcType=VARCHAR},
</if>
<if test="sysFlag != null" >
#{sysFlag,jdbcType=VARCHAR},
</if>
<if test="sysId != null" >
#{sysId,jdbcType=INTEGER},
</if>
<if test="createDate != null" >
#{createDate,jdbcType=CHAR},
</if>
<if test="creater != null" >
#{creater,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.manage.entity.Power_Log" >
update power_log
<set >
<if test="logTitle != null" >
log_title = #{logTitle,jdbcType=VARCHAR},
</if>
<if test="ip != null" >
ip = #{ip,jdbcType=CHAR},
</if>
<if test="logContent != null" >
log_content = #{logContent,jdbcType=VARCHAR},
</if>
<if test="sysFlag != null" >
sys_flag = #{sysFlag,jdbcType=VARCHAR},
</if>
<if test="sysId != null" >
sys_id = #{sysId,jdbcType=INTEGER},
</if>
<if test="createDate != null" >
create_date = #{createDate,jdbcType=CHAR},
</if>
<if test="creater != null" >
creater = #{creater,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where log_id = #{logId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.manage.entity.Power_Log" >
update power_log
set log_title = #{logTitle,jdbcType=VARCHAR},
ip = #{ip,jdbcType=CHAR},
log_content = #{logContent,jdbcType=VARCHAR},
sys_flag = #{sysFlag,jdbcType=VARCHAR},
sys_id = #{sysId,jdbcType=INTEGER},
create_date = #{createDate,jdbcType=CHAR},
creater = #{creater,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where log_id = #{logId,jdbcType=INTEGER}
</update>
<select id="selectAll" resultMap="BaseResultMap">
SELECT
*
FROM
power_log
<where>
<if test="record.logTitle != '' and record.logTitle != null">
log_title LIKE '%${record.logTitle}%'
</if>
<if test="record.logContent != '' and record.logContent != null">
AND log_content LIKE '%${record.logContent}%'
</if>
<if test="record.creater != '' and record.creater != null">
AND creater LIKE '%${record.creater}%'
</if>
<if test="startTime != '' and startTime != null">
AND create_date >= #{startTime}
</if>
<if test="endTime != '' and endTime != null">
AND create_date &lt;= #{endTime}
</if>
AND sys_flag = 'power'
</where>
ORDER BY create_date DESC,log_id DESC
<if test="record.offset != null and record.limit != null">
LIMIT #{record.offset},#{record.limit}
</if>
</select>
<select id="getTotal" resultType="java.lang.Integer">
SELECT
count(1)
FROM
power_log
<where>
<if test="record.logTitle != '' and record.logTitle != null">
log_title LIKE '%${record.logTitle}%'
</if>
<if test="record.logContent != '' and record.logContent != null">
AND log_content LIKE '%${record.logContent}%'
</if>
<if test="record.creater != '' and record.creater != null">
AND creater LIKE '%${record.creater}%'
</if>
<if test="startTime != '' and startTime != null">
AND create_date >= #{startTime}
</if>
<if test="endTime != '' and endTime != null">
AND create_date &lt;= #{endTime}
</if>
AND sys_flag = 'power'
</where>
</select>
<select id="selectObjectByKey" resultType="java.util.Map">
select * from ${tableName} where ${whereSql}
</select>
<delete id="delLogsByDate">
delete from power_log where create_date &lt; #{date} AND sys_flag = 'power'
</delete>
<select id="selectAllByIds" resultMap="BaseResultMap">
select * from power_log where log_id in (${checks}) AND sys_flag = 'power'
</select>
<select id="getUnlockDate" resultType="com.manage.entity.Power_Log">
SELECT * FROM power_log where log_title='登录' and unlock_date>=sysdate() and creater=#{userName}
</select>
<delete id="deleteLogByIds">
delete from power_log where log_id in (${str})
</delete>
</mapper>