登录日志列表以及参数查询,分页配置

master
shijie 5 years ago
parent 0b7f45d9b3
commit 1b90ae962a
  1. 13
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/config/IPageConfig.java
  2. 3
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/LoginLogMapper.java
  3. 5
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/LoginLogServiceImpl.java
  4. 12
      dq-financial-hrms-auth/src/main/resources/mapper/hrmsauth/LoginLogMapper.xml
  5. 4
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/LoginLogEntity.java
  6. 12
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginLogRequest.java

@ -0,0 +1,13 @@
package com.daqing.financial.hrauth.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class IPageConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.daqing.framework.domain.hrms.LoginLog;
import com.daqing.framework.domain.hrms.LoginLogEntity;
import com.daqing.framework.domain.hrms.request.UserLoginLogRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import org.apache.ibatis.annotations.Mapper;
@ -11,5 +12,5 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface LoginLogMapper extends BaseMapper<LoginLog> {
IPage<LoginLog> pageByCondition(Page page,@Param("loginLog") UserLoginLogRequest userLoginLogRequest);
IPage<LoginLogEntity> pageByCondition(Page page, @Param("loginLog") UserLoginLogRequest userLoginLogRequest);
}

@ -6,9 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.financial.hrauth.dao.LoginLogMapper;
import com.daqing.financial.hrauth.service.LoginLogService;
import com.daqing.framework.domain.hrms.LoginLog;
import com.daqing.framework.domain.hrms.SystemLog;
import com.daqing.framework.domain.hrms.LoginLogEntity;
import com.daqing.framework.domain.hrms.request.UserLoginLogRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.utils.PageUtils;
import org.springframework.stereotype.Service;
@ -23,7 +22,7 @@ public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> i
if (size <= 0) {
size = 10;
}
IPage<LoginLog> loginLogVo = this.getBaseMapper().pageByCondition(new Page(page, size),userLoginLogRequest);
IPage<LoginLogEntity> loginLogVo = this.getBaseMapper().pageByCondition(new Page(page, size),userLoginLogRequest);
return new PageUtils(loginLogVo);
}

@ -12,8 +12,8 @@
<select id="pageByCondition" parameterType="com.daqing.framework.domain.hrms.request.UserLoginLogRequest" resultMap="userLoginLogMap">
SELECT
hll.user_id,hll.login_num,hll.create_time,hll.newest_time,he.name as empName,he.job_number,
he.phone,hp.name as posName,hd.name as deptName
hll.user_id,hll.login_num,hll.create_time,hll.newest_time,he.`name` as empName,he.job_number,
he.phone,hp.`name` as posName,GROUP_CONCAT(hd.`name`) as deptName
FROM hrms_login_log hll
left join hrms_employee he on he.user_id=hll.user_id
left join hrms_employee_position hep on hep.emp_id=he.id
@ -21,11 +21,8 @@
left join hrms_employee_dept hed on hed.employee_id=he.id
left join hrms_dept hd on hd.id=hed.dept_id
<where>
<if test="loginLog.name != null and loginLog.name != ''">
AND he.`name` LIKE CONCAT('%',#{loginLog.name},'%')
</if>
<if test="loginLog.jobNumber != null and loginLog.jobNumber != ''">
AND he.job_number = #{loginLog.jobNumber}
<if test="loginLog.jobNumberOrName != null and loginLog.jobNumberOrName != ''">
AND (he.`name` LIKE CONCAT('%',#{loginLog.jobNumberOrName},'%') OR he.job_number LIKE CONCAT('%',#{loginLog.jobNumberOrName},'%'))
</if>
<if test="loginLog.startTime != null and loginLog.startTime != '' ">
AND hll.create_time &gt;= #{loginLog.startTime}
@ -34,6 +31,7 @@
AND hll.create_time &lt;= #{loginLog.endTime}
</if>
</where>
GROUP BY hll.user_id
</select>
</mapper>

@ -3,7 +3,9 @@ package com.daqing.framework.domain.hrms;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@ -21,9 +23,11 @@ public class LoginLogEntity {
private int loginNum;
//创建时间
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;
//最新登录时间
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date newestTime;
//员工姓名

@ -13,14 +13,6 @@ import java.io.Serializable;
*/
@Data
public class UserLoginLogRequest implements Serializable {
/**
* 姓名
*/
private String name;
/**
* 工号
*/
private String jobNumber;
/**
* 开始时间
*/
@ -29,4 +21,8 @@ public class UserLoginLogRequest implements Serializable {
* 结束时间
*/
private String endTime;
/**
* 查询条件为姓名或工号
*/
private String jobNumberOrName;
}

Loading…
Cancel
Save