| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?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.welampiot.dao.OperationLogDao">
- <select id="getListByVO" resultType="com.welampiot.dto.OperationLogDTO" parameterType="com.welampiot.vo.OperationLogVO">
- select time,acount,remark,operaType,operation,sectionid as sectionId,areaid as areaId from operation_log a
- where 1=1
- <if test="userIdList != null and !userIdList.isEmpty()">
- and a.userid in
- <foreach item="vo" collection="userIdList" open="(" separator="," close=")">
- #{vo}
- </foreach>
- </if>
- <if test="devType != null">
- and a.devtype = #{devType}
- </if>
- <choose>
- <when test="version == 1">
- and a.type = 1
- </when>
- <when test="version == 2">
- and a.type = 2
- </when>
- <otherwise>
- and a.type = 0
- </otherwise>
- </choose>
- <if test="operaType != null">
- and a.operaType = #{operaType}
- </if>
- order by a.time desc
- <if test="offset != null and limit != null">
- limit #{offset},#{limit}
- </if>
- </select>
- <select id="getLogListByVO" resultType="com.welampiot.dto.OperationLogDTO" parameterType="com.welampiot.vo.OperationLogVO">
- select u.name,o.operaType,o.deviceName,o.sn,o.remark,u.company,o.devtype,o.time as updateTime,o.section,o.area,s.timezone
- from operation_log o left join user u on o.userid = u.id
- left join section s on o.sectionid = s.id
- where 1=1
- <if test="role != 1">
- and o.userid = #{userId}
- </if>
- <if test="keyword != null and keyword != ''">
- and (u.name like '%${keyword}%' or o.sn like '%${keyword}%' or o.deviceName like '%${keyword}%')
- </if>
- <if test="operaType != null">
- and o.operaType = #{operaType}
- </if>
- <if test="devType != null">
- and o.devtype = #{devType}
- </if>
- order by o.time desc
- <if test="offset >= 0 and limit > 0">
- limit #{offset},#{limit}
- </if>
- </select>
- <select id="getRoleByUsername" resultType="Integer">
- select u.role
- from user u
- where u.username = #{username}
- </select>
-
- <select id="getUserIdByUsername" resultType="Integer">
- select u.id
- from user u
- where u.username = #{username}
- </select>
- <select id="getLogTotalByUserId" resultType="Integer">
- select count(o.id) as total from operation_log o
- <if test="role != 1">
- where o.userid = #{userId}
- </if>
- </select>
- <delete id="deleteLogListById">
- delete from operation_log where id = #{id}
- </delete>
- </mapper>
|