平台日志列表以及参数查询

master
shijie 4 years ago
parent 1f26d2950d
commit e27794b092
  1. 3
      dq-financial-api/src/main/java/com/daqing/financial/hrauth/SystemLogControllerApi.java
  2. 5
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/SystemLogController.java
  3. 5
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/LoginLogMapper.java
  4. 4
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/LoginLogService.java
  5. 6
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/LoginLogServiceImpl.java
  6. 29
      dq-financial-hrms-auth/src/main/resources/mapper/hrmsauth/LoginLogMapper.xml
  7. 44
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/LoginLogEntity.java
  8. 32
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginLogRequest.java

@ -2,6 +2,7 @@ package com.daqing.financial.hrauth;
import com.daqing.framework.domain.crms.request.CustomerRequest; import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.domain.hrms.request.LoginRequest; import com.daqing.framework.domain.hrms.request.LoginRequest;
import com.daqing.framework.domain.hrms.request.UserLoginLogRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest; import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -20,5 +21,5 @@ public interface SystemLogControllerApi {
ResponseResult list(Integer page, Integer size); ResponseResult list(Integer page, Integer size);
@ApiOperation(value = "登录日志列表") @ApiOperation(value = "登录日志列表")
ResponseResult loginLogList(Integer page, Integer size); ResponseResult loginLogList(Integer page, Integer size, UserLoginLogRequest userLoginLogRequest);
} }

@ -11,6 +11,7 @@ import com.daqing.financial.hrauth.service.UserLoginService;
import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.SystemLog; import com.daqing.framework.domain.hrms.SystemLog;
import com.daqing.framework.domain.hrms.request.LoginRequest; import com.daqing.framework.domain.hrms.request.LoginRequest;
import com.daqing.framework.domain.hrms.request.UserLoginLogRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest; import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
@ -47,8 +48,8 @@ public class SystemLogController implements SystemLogControllerApi {
@GetMapping("/loginLogList") @GetMapping("/loginLogList")
@Log(detail = "登录日志列表",level = 3,operationUnit = OperationUnit.ROLE,operationType = OperationType.SELECT) @Log(detail = "登录日志列表",level = 3,operationUnit = OperationUnit.ROLE,operationType = OperationType.SELECT)
public ResponseResult loginLogList(@RequestParam("page") Integer page, public ResponseResult loginLogList(@RequestParam("page") Integer page,
@RequestParam("size") Integer size) { @RequestParam("size") Integer size, UserLoginLogRequest userLoginLogRequest) {
PageUtils data = loginLogService.queryPage(page, size); PageUtils data = loginLogService.queryPage(page, size,userLoginLogRequest);
return new ResponseResult<PageUtils>().SUCCESS(data); return new ResponseResult<PageUtils>().SUCCESS(data);
} }

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

@ -2,8 +2,10 @@ package com.daqing.financial.hrauth.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.domain.hrms.LoginLog; import com.daqing.framework.domain.hrms.LoginLog;
import com.daqing.framework.domain.hrms.request.UserLoginLogRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
public interface LoginLogService extends IService<LoginLog> { public interface LoginLogService extends IService<LoginLog> {
PageUtils queryPage(Integer page, Integer size); PageUtils queryPage(Integer page, Integer size, UserLoginLogRequest userLoginLogRequest);
} }

@ -7,13 +7,15 @@ import com.daqing.financial.hrauth.dao.LoginLogMapper;
import com.daqing.financial.hrauth.service.LoginLogService; import com.daqing.financial.hrauth.service.LoginLogService;
import com.daqing.framework.domain.hrms.LoginLog; import com.daqing.framework.domain.hrms.LoginLog;
import com.daqing.framework.domain.hrms.SystemLog; import com.daqing.framework.domain.hrms.SystemLog;
import com.daqing.framework.domain.hrms.request.UserLoginLogRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements LoginLogService { public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements LoginLogService {
@Override @Override
public PageUtils queryPage(Integer page, Integer size) { public PageUtils queryPage(Integer page, Integer size, UserLoginLogRequest userLoginLogRequest) {
//分页参数 //分页参数
if (page <= 0) { if (page <= 0) {
page = 1; page = 1;
@ -21,7 +23,7 @@ public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> i
if (size <= 0) { if (size <= 0) {
size = 10; size = 10;
} }
IPage<LoginLog> loginLogVo = this.getBaseMapper().pageByCondition(new Page(page, size)); IPage<LoginLog> loginLogVo = this.getBaseMapper().pageByCondition(new Page(page, size),userLoginLogRequest);
return new PageUtils(loginLogVo); return new PageUtils(loginLogVo);
} }

@ -6,9 +6,34 @@
<resultMap type="com.daqing.framework.domain.hrms.LoginLog" id="LoginLogMap"> <resultMap type="com.daqing.framework.domain.hrms.LoginLog" id="LoginLogMap">
<result property="id" column="id"/> <result property="id" column="id"/>
</resultMap> </resultMap>
<resultMap type="com.daqing.framework.domain.hrms.LoginLogEntity" id="userLoginLogMap">
<result property="id" column="id"/>
</resultMap>
<select id="pageByCondition" resultMap="LoginLogMap"> <select id="pageByCondition" parameterType="com.daqing.framework.domain.hrms.request.UserLoginLogRequest" resultMap="userLoginLogMap">
SELECT * FROM hrms_login_log 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
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
left join hrms_position hp on hp.id=hep.position_id
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>
<if test="loginLog.startTime != null and loginLog.startTime != '' ">
AND hll.create_time &gt;= #{loginLog.startTime}
</if>
<if test="loginLog.endTime != null and loginLog.endTime != '' ">
AND hll.create_time &lt;= #{loginLog.endTime}
</if>
</where>
</select> </select>
</mapper> </mapper>

@ -0,0 +1,44 @@
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 lombok.Data;
import java.util.Date;
@Data
@TableName("hrms_login_log")
public class LoginLogEntity {
@TableId(type = IdType.AUTO)
private int id;
//用户id
private Long userId;
//登录次数
private int loginNum;
//创建时间
private Date createTime;
//最新登录时间
private Date newestTime;
//员工姓名
private String empName;
//工号
private String jobNumber;
//联系电话
private String phone;
//职位
private String posName;
//部门名称
private String deptName;
}

@ -0,0 +1,32 @@
package com.daqing.framework.domain.hrms.request;
import lombok.Data;
import java.io.Serializable;
/**
* 登录日志请求体对象
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-07 17:12:14
*/
@Data
public class UserLoginLogRequest implements Serializable {
/**
* 姓名
*/
private String name;
/**
* 工号
*/
private String jobNumber;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
}
Loading…
Cancel
Save