From 9969bea2a8c1eab64c12a51a2d24d65e5b6c0dd0 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期一, 24 十月 2022 18:12:41 +0800
Subject: [PATCH] 日志导出乱码 日志查询导出 代码重构

---
 ycl-common/src/main/resources/mapper/user/UmsAdminLoginLogMapper.xml |   40 +++++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/ycl-common/src/main/resources/mapper/user/UmsAdminLoginLogMapper.xml b/ycl-common/src/main/resources/mapper/user/UmsAdminLoginLogMapper.xml
index 48e945f..c26d0af 100644
--- a/ycl-common/src/main/resources/mapper/user/UmsAdminLoginLogMapper.xml
+++ b/ycl-common/src/main/resources/mapper/user/UmsAdminLoginLogMapper.xml
@@ -4,12 +4,38 @@
 
     <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
     <resultMap id="BaseResultMap" type="com.ycl.entity.user.UmsAdminLoginLog">
-        <id column="id" property="id" />
-        <result column="admin_id" property="adminId" />
-        <result column="create_time" property="createTime" />
-        <result column="ip" property="ip" />
-        <result column="address" property="address" />
-        <result column="user_agent" property="userAgent" />
+        <id column="id" property="id"/>
+        <result column="admin_id" property="adminId"/>
+        <result column="create_time" property="createTime"/>
+        <result column="ip" property="ip"/>
+        <result column="address" property="address"/>
+        <result column="user_agent" property="userAgent"/>
     </resultMap>
-
+    <select id="selectByCondition" parameterType="com.ycl.dto.log.LogQueryParams"
+            resultType="com.ycl.entity.user.vo.UmsAdminLogVO">
+        SELECT t1.*,t2.username as adminId FROM ums_admin_login_log t1 left join ums_admin t2 on t1.admin_id=t2.id
+        <where>
+            <if test="logQueryParams.content!='' and logQueryParams.content!=null">
+                contain LIKE CONCAT('%',#{logQueryParams.content},'%')
+            </if>
+            <if test="logQueryParams.operationType!='' and logQueryParams.operationType!=null">
+                and operation_type=#{logQueryParams.operationType}
+            </if>
+            <if test="logQueryParams.portEquipment!='' and logQueryParams.portEquipment!=null">
+                and user_agent=#{logQueryParams.portEquipment}
+            </if>
+            <if test="logQueryParams.id!=null">
+                and admin_id=#{logQueryParams.id}
+            </if>
+            <if test="logQueryParams.startTime!='' and logQueryParams.endTime!=''">
+                and create_time BETWEEN #{logQueryParams.startTime} AND #{logQueryParams.endTime}
+            </if>
+        </where>
+        <if test="logQueryParams.sort != null and logQueryParams.sort == 1">
+            ORDER BY create_time desc
+        </if>
+        <if test="logQueryParams.sort != null and logQueryParams.sort == 0">
+            ORDER BY create_time asc
+        </if>
+    </select>
 </mapper>

--
Gitblit v1.8.0