Merge remote-tracking branch 'origin/master'

master
river 4 years ago
commit 3419d84fd3
  1. 8
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/controller/DgAuditProcessController.java
  2. 2
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/TodayApprovalRecordResponse.java
  3. 2
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/DqFinancialHrmsAuthApplication.java
  4. 69
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/HrmsAccessRecordsLogController.java
  5. 18
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/dao/HrmsAccessRecordsLogMapper.java
  6. 27
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/model/AccessRecordsObjRes.java
  7. 29
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/model/AccessRecordsRes.java
  8. 4
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/model/HrmsAccessRecordsLog.java
  9. 12
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/IHrmsAccessRecordsLogService.java
  10. 218
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/HrmsAccessRecordsLogServiceImpl.java
  11. 3
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
  12. 58
      dq-financial-hrms-auth/src/main/resources/mapper/hrauth/HrmsAccessRecordsLogMapper.xml

@ -7,6 +7,7 @@ import com.daqing.financial.guarantee.model.response.ApprovalNum;
import com.daqing.financial.guarantee.model.response.TodayApprovalRecordResponse; import com.daqing.financial.guarantee.model.response.TodayApprovalRecordResponse;
import com.daqing.financial.guarantee.service.IDgAuditProcessService; import com.daqing.financial.guarantee.service.IDgAuditProcessService;
import com.daqing.financial.guarantee.util.R; import com.daqing.financial.guarantee.util.R;
import com.daqing.financial.guarantee.util.TaskNodeUtil;
import com.daqing.framework.domain.guarantee.DgAuditProcess; import com.daqing.framework.domain.guarantee.DgAuditProcess;
import com.daqing.framework.domain.guarantee.po.ProcessPO; import com.daqing.framework.domain.guarantee.po.ProcessPO;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
@ -82,7 +83,7 @@ public class DgAuditProcessController {
return ResponseResult.SUCCESS(processPO); return ResponseResult.SUCCESS(processPO);
} }
@ApiOperation(value = "今日审批记录") @ApiOperation(value = "今日审批记录",response = TodayApprovalRecordResponse.class)
@GetMapping("todayApprovalRecord") @GetMapping("todayApprovalRecord")
public R nowadaysAuditProcess(){ public R nowadaysAuditProcess(){
List<TodayApprovalRecordResponse> approvalRecords = auditProcessService.todayApprovalRecord(); List<TodayApprovalRecordResponse> approvalRecords = auditProcessService.todayApprovalRecord();
@ -90,6 +91,11 @@ public class DgAuditProcessController {
//统计状态个数 //统计状态个数
approvalRecords.forEach(todayApprovalRecordResponse -> { approvalRecords.forEach(todayApprovalRecordResponse -> {
if (todayApprovalRecordResponse.getStatus()!=null){ if (todayApprovalRecordResponse.getStatus()!=null){
String taskNode = todayApprovalRecordResponse.getTaskNode();
if (taskNode!=null){
String converter = TaskNodeUtil.converter(taskNode);
todayApprovalRecordResponse.setTaskNode(converter);
}
switch (todayApprovalRecordResponse.getStatus()){ switch (todayApprovalRecordResponse.getStatus()){
case "0": case "0":
approvalNum.setInitiateNum(approvalNum.getInitiateNum()+1); approvalNum.setInitiateNum(approvalNum.getInitiateNum()+1);

@ -1,5 +1,6 @@
package com.daqing.financial.guarantee.model.response; package com.daqing.financial.guarantee.model.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -30,6 +31,7 @@ public class TodayApprovalRecordResponse {
private String taskNode; private String taskNode;
@ApiModelProperty("处理时间") @ApiModelProperty("处理时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date processingTime; private Date processingTime;
@ApiModelProperty("状态") @ApiModelProperty("状态")

@ -5,10 +5,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableFeignClients(basePackages = "com.daqing.financial.hrauth.feign") @EnableFeignClients(basePackages = "com.daqing.financial.hrauth.feign")
@EnableDiscoveryClient @EnableDiscoveryClient
@SpringBootApplication @SpringBootApplication
@EnableScheduling
@ComponentScan(basePackages = "com.daqing") @ComponentScan(basePackages = "com.daqing")
public class DqFinancialHrmsAuthApplication { public class DqFinancialHrmsAuthApplication {

@ -1,9 +1,22 @@
package com.daqing.financial.hrauth.controller; package com.daqing.financial.hrauth.controller;
import com.daqing.financial.hrauth.model.HrmsAccessRecordsLog;
import com.daqing.financial.hrauth.service.IHrmsAccessRecordsLogService;
import com.daqing.financial.hrauth.service.impl.HrmsAccessRecordsLogServiceImpl;
import com.daqing.framework.domain.hrms.response.RolePermissionResponse;
import com.daqing.framework.model.response.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
@ -13,8 +26,62 @@ import org.springframework.stereotype.Controller;
* @author Qyq * @author Qyq
* @since 2021-01-12 * @since 2021-01-12
*/ */
@Controller @RestController
@RequestMapping("/hrms-access-records-log") @RequestMapping("/hrms-access-records-log")
public class HrmsAccessRecordsLogController { public class HrmsAccessRecordsLogController {
@Autowired
private IHrmsAccessRecordsLogService iHrmsAccessRecordsLogService;
/**
* 访问记录显示前五条最新数据定时任务-每五分钟更新一次
* @param
* @return
*/
@Scheduled(cron ="0 */5 * * * ?")
@GetMapping("/queryAccessRecords")
public ResponseResult queryAccessRecords() {
List<HrmsAccessRecordsLog> list = iHrmsAccessRecordsLogService.queryAccessRecords();
return new ResponseResult<List<HrmsAccessRecordsLog>>().SUCCESS(list);
}
/**
* 访问次数
* @return
*/
@Scheduled(cron ="0 */5 * * * ?")
@GetMapping("/queryVisitNum")
public ResponseResult queryVisitNum() {
Map map = iHrmsAccessRecordsLogService.queryVisitNum();
return new ResponseResult<List<HrmsAccessRecordsLog>>().SUCCESS(map);
}
/**
* 今日登录用户总数
* @return
*/
@GetMapping("/queryLoginNum")
public ResponseResult queryLoginNum() {
Map map = iHrmsAccessRecordsLogService.queryLoginNum();
return new ResponseResult<List<HrmsAccessRecordsLog>>().SUCCESS(map);
}
/**
* 登录用户趋势图
* @return
*/
@GetMapping("/queryLoginOnline")
public ResponseResult queryLoginOnline() {
Map map = iHrmsAccessRecordsLogService.queryLoginOnline();
return new ResponseResult<List<HrmsAccessRecordsLog>>().SUCCESS(map);
}
/**
* 登录用户趋势图
* @return
*/
@GetMapping("/queryLoginOnline2")
public ResponseResult queryLoginOnline2() {
Map map = iHrmsAccessRecordsLogService.queryLoginOnline2();
return new ResponseResult<List<HrmsAccessRecordsLog>>().SUCCESS(map);
}
} }

@ -1,8 +1,13 @@
package com.daqing.financial.hrauth.dao; package com.daqing.financial.hrauth.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.daqing.financial.hrauth.model.AccessRecordsObjRes;
import com.daqing.financial.hrauth.model.AccessRecordsRes;
import com.daqing.financial.hrauth.model.HrmsAccessRecordsLog; import com.daqing.financial.hrauth.model.HrmsAccessRecordsLog;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
@ -14,4 +19,17 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface HrmsAccessRecordsLogMapper extends BaseMapper<HrmsAccessRecordsLog> { public interface HrmsAccessRecordsLogMapper extends BaseMapper<HrmsAccessRecordsLog> {
List<HrmsAccessRecordsLog> queryAccessRecords(@Param("loginTime") String dateTime);
int queryAccessCountPC(@Param("loginTime")String dateTime);
int queryAccessCountAPP(@Param("loginTime")String dateTime);
int queryUserCount(@Param("loginTime")String dateTime);
List<String> queryLoginTime(@Param("loginTime")String dateTime);
List<Integer> queryLoginSum(@Param("loginTime")String dateTime);
List<AccessRecordsObjRes> queryLoginObj(@Param("loginTime")String dateTime);
} }

@ -0,0 +1,27 @@
package com.daqing.financial.hrauth.model;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 访问记录表
* </p>
*
* @author Qyq
* @since 2021-01-12
*/
@Data
@TableName("hrms_access_records_log")
public class AccessRecordsObjRes implements Serializable {
@ApiModelProperty(value = "今日登录用户时间点")
private String loginTime;
@ApiModelProperty(value = "今日登录用户不同时间点登录总数")
private Integer loginSum;
}

@ -0,0 +1,29 @@
package com.daqing.financial.hrauth.model;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 访问记录表
* </p>
*
* @author Qyq
* @since 2021-01-12
*/
@Data
@TableName("hrms_access_records_log")
public class AccessRecordsRes implements Serializable {
@ApiModelProperty(value = "PC总访问量")
private Integer countPC;
@ApiModelProperty(value = "APP总访问量")
private Integer countAPP;
@ApiModelProperty(value = "总访问量")
private Integer countSum;
}

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -29,6 +30,8 @@ public class HrmsAccessRecordsLog implements Serializable {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
private Integer userId;
/** /**
* 账号 * 账号
*/ */
@ -53,5 +56,6 @@ public class HrmsAccessRecordsLog implements Serializable {
/** /**
* 登录时间 * 登录时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date loginTime; private Date loginTime;
} }

@ -3,6 +3,9 @@ package com.daqing.financial.hrauth.service;
import com.daqing.financial.hrauth.model.HrmsAccessRecordsLog; import com.daqing.financial.hrauth.model.HrmsAccessRecordsLog;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
* 访问记录表 服务类 * 访问记录表 服务类
@ -13,4 +16,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface IHrmsAccessRecordsLogService extends IService<HrmsAccessRecordsLog> { public interface IHrmsAccessRecordsLogService extends IService<HrmsAccessRecordsLog> {
List<HrmsAccessRecordsLog> queryAccessRecords();
Map queryVisitNum();
Map queryLoginNum();
Map queryLoginOnline();
Map queryLoginOnline2();
} }

@ -1,11 +1,18 @@
package com.daqing.financial.hrauth.service.impl; package com.daqing.financial.hrauth.service.impl;
import com.daqing.financial.hrauth.model.AccessRecordsObjRes;
import com.daqing.financial.hrauth.model.HrmsAccessRecordsLog; import com.daqing.financial.hrauth.model.HrmsAccessRecordsLog;
import com.daqing.financial.hrauth.dao.HrmsAccessRecordsLogMapper; import com.daqing.financial.hrauth.dao.HrmsAccessRecordsLogMapper;
import com.daqing.financial.hrauth.service.IHrmsAccessRecordsLogService; import com.daqing.financial.hrauth.service.IHrmsAccessRecordsLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
* 访问记录表 服务实现类 * 访问记录表 服务实现类
@ -17,4 +24,215 @@ import org.springframework.stereotype.Service;
@Service @Service
public class HrmsAccessRecordsLogServiceImpl extends ServiceImpl<HrmsAccessRecordsLogMapper, HrmsAccessRecordsLog> implements IHrmsAccessRecordsLogService { public class HrmsAccessRecordsLogServiceImpl extends ServiceImpl<HrmsAccessRecordsLogMapper, HrmsAccessRecordsLog> implements IHrmsAccessRecordsLogService {
@Autowired
private HrmsAccessRecordsLogMapper hrmsAccessRecordsLogMapper;
@Override
public List<HrmsAccessRecordsLog> queryAccessRecords() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateTime=sdf.format(new Date());
//显示当天前五条最新数据
List<HrmsAccessRecordsLog> list = hrmsAccessRecordsLogMapper.queryAccessRecords(dateTime);
return list;
}
@Override
public Map queryVisitNum() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateTime=sdf.format(new Date());
//查询当天PC端登录和小程序登录总条数
int countPC = hrmsAccessRecordsLogMapper.queryAccessCountPC(dateTime);
int countAPP = hrmsAccessRecordsLogMapper.queryAccessCountAPP(dateTime);
int countSum = countPC+countAPP;
Map<String,Integer> map = new HashMap<String,Integer>();
map.put("countPC",countPC);
map.put("countAPP",countAPP);
map.put("countSum",countSum);
return map;
}
@Override
public Map queryLoginNum() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateTime=sdf.format(new Date());
//今日登录用户总数
int userCount = hrmsAccessRecordsLogMapper.queryUserCount(dateTime);
Map<String,Integer> map = new HashMap<String,Integer>();
map.put("userCount",userCount);
return map;
}
@Override
public Map queryLoginOnline() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateTime=sdf.format(new Date());
//今日登录用户时间点
List<String> timeList = hrmsAccessRecordsLogMapper.queryLoginTime(dateTime);
System.out.println("timeList=============="+timeList);
//timeList==============[11, 12, 14, 15, 16, 17]
//今日登录用户不同时间点登录总数
List<Integer> approvalList = hrmsAccessRecordsLogMapper.queryLoginSum(dateTime);
System.out.println("approvalList================"+approvalList);
//approvalList================[1, 1, 2, 3, 1, 1]
List<AccessRecordsObjRes> loginObj = hrmsAccessRecordsLogMapper.queryLoginObj(dateTime);
System.out.println("loginObj================"+loginObj);
//loginObj================[AccessRecordsObjRes(loginTime=11:00, loginSum=1), AccessRecordsObjRes(loginTime=12:00, loginSum=1), AccessRecordsObjRes(loginTime=14:00, loginSum=1), AccessRecordsObjRes(loginTime=15:00, loginSum=3), AccessRecordsObjRes(loginTime=16:00, loginSum=2)]
List list = new ArrayList();
for (String str:timeList) {
//如果第一个为奇数,就取它的偶数时间点
if(Integer.parseInt(str)%2!=0){
int a = Integer.parseInt(str)-1;
list.add(String.valueOf(a));
}else{
list.add(str);
}
}
System.out.println("timeList2=============="+list);
//timeList2==============[10, 12, 14, 14, 16, 16]
Map<Integer,String> same = same(list);
System.out.println("same==============="+same);
//14 重复,行: 3,4
//16 重复,行: 5,6
List<String> strList = new ArrayList<>();
Iterator<Integer> iter = same.keySet().iterator();
while(iter.hasNext()){
Integer key=iter.next();
String value = same.get(key);
System.out.println(key+" "+value);
strList.add(value);
}
Collections.sort(strList);
System.out.println("strListSort============="+strList);
//strList=============[8,9, 2,3, 4,5, 6,7]
//approvalList================[2, 1, 2, 12, 2, 3, 1, 1, 1, 1]
//[10, 12, 14, 16, 18, 22]
List list2 = new ArrayList();
//遍历每一个approvalList,取出它们对应的下标
outer:for(int i=0;i<approvalList.size();i++){
for(int j=0;j<strList.size();j++){
if(strList.get(j).contains(String.valueOf(i))){
String s = strList.get(j);
String[] split = s.split(",");
Integer sum =0;
for(String str:split){
Integer a =approvalList.get(Integer.parseInt(str));
sum = sum+a;
}
list2.add(sum);
int length = split.length;
if(i+length < approvalList.size()){
i=i+length;
continue;
}else{//结束所有循环
break outer;
}
}else{//不包含情况下
//list2.add(approvalList.get(i));
continue;
}
}
list2.add(approvalList.get(i));
}
System.out.println("list2=============="+list2);
//去重
List distinctList=(List) list.stream().distinct().collect(Collectors.toList());
System.out.println(distinctList);
//[10, 12, 14, 16]
Map<String, List> map = new HashMap<>();
map.put("timeList",distinctList);
map.put("numList",list2);
return map;
}
//查找list中的重复数据,并得到重复数据索引位置
public static Map same(List<String> list) {
Map<Integer, String> map = new HashMap<Integer, String>();
Map map2 = new HashMap();
for (int i = 0; i < list.size(); i++) {
Integer key = Integer.parseInt(list.get(i));
String old = map.get(key);
if (old != null) {
map.put(key, old + "," + (i));
} else {
map.put(key, "" + (i));
}
}
Iterator<Integer> it = map.keySet().iterator();
while (it.hasNext()) {
Integer key = it.next();
String value = map.get(key);
if (value.indexOf(",") != -1) {
System.out.println(key + " 重复,行: " + value);
map2.put(key,value);
}
}
return map2;
}
@Override
public Map queryLoginOnline2() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateTime=sdf.format(new Date());
List<AccessRecordsObjRes> accessList = hrmsAccessRecordsLogMapper.queryLoginObj(dateTime);
System.out.println("accessList=============="+accessList);
//获取当前时间点小时
SimpleDateFormat sdf2 = new SimpleDateFormat("HH");
String hour=sdf2.format(new Date());
int dayHour = Integer.parseInt(hour);
Map map = new HashMap();
List list = new ArrayList();
List list2 = new ArrayList();
//首先通过for循环遍历所有的偶数
for(int i=0;i<dayHour;i=i+2){
//通过stream.filter()过滤时间段属性,access即为0对应的0->1时间段以及对应登录人数,或者2对应的2->3时间段以及对应的登录人数
String s1 = frontCompWithZore(2, i);
String s2 = frontCompWithZore(2, i+1);
List<AccessRecordsObjRes> access = accessList.stream()
.filter(s->s.getLoginTime().equals(s1) || s.getLoginTime().equals(s2))
.collect(Collectors.toList());
System.out.println("access==========="+access);
//获取对应的偶数时间段以及对应的登录用户数
String loginTime=null;
for (AccessRecordsObjRes res:access) {
loginTime = s1;
Integer loginSum = res.getLoginSum();
res.setLoginSum(loginSum);
}
int sum = access.stream().mapToInt(AccessRecordsObjRes::getLoginSum).sum();
if(sum==0){
loginTime=s1;
}
list.add(loginTime);
list2.add(sum);
}
map.put("loginTime",list);
map.put("loginSum",list2);
return map;
}
/**
* 将元数据前补零补后的总长度为指定的长度以字符串的形式返回
* 重组后的数据
*/
public static String frontCompWithZore(int formatLength,int formatNumber) {
/**
* 0 指前面补充零
* formatLength 字符总长度为 formatLength
* inputNumber 格式化数字
* d 代表为正数
*/
String newString = String.format("%0" + formatLength + "d", formatNumber);
return newString;
}
} }

@ -229,8 +229,9 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginDao, UserEntity>
} }
recordsLog.setAccount(userEntity.getAccount()); recordsLog.setAccount(userEntity.getAccount());
recordsLog.setName(name); recordsLog.setName(name);
recordsLog.setType(1); recordsLog.setType(0);//用户端类型:0->PC;1->小程序;
recordsLog.setLoginTime(new Date()); recordsLog.setLoginTime(new Date());
recordsLog.setUserId(userEntity.getId().intValue());
hrmsAccessRecordsLogMapper.insert(recordsLog); hrmsAccessRecordsLogMapper.insert(recordsLog);
//返回用户信息 //返回用户信息

@ -5,6 +5,7 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.daqing.financial.hrauth.model.HrmsAccessRecordsLog"> <resultMap id="BaseResultMap" type="com.daqing.financial.hrauth.model.HrmsAccessRecordsLog">
<id column="id" property="id" /> <id column="id" property="id" />
<id column="user_id" property="userId" />
<result column="account" property="account" /> <result column="account" property="account" />
<result column="name" property="name" /> <result column="name" property="name" />
<result column="deptName" property="deptName" /> <result column="deptName" property="deptName" />
@ -12,4 +13,61 @@
<result column="login_time" property="loginTime" /> <result column="login_time" property="loginTime" />
</resultMap> </resultMap>
<select id="queryAccessRecords" parameterType="string" resultMap="BaseResultMap">
select * from hrms_access_records_log
where login_time LIKE CONCAT('%',#{loginTime},'%')
order by login_time desc
limit 5
</select>
<select id="queryAccessCountPC" parameterType="string" resultType="int">
select count(0) from hrms_access_records_log
where login_time LIKE CONCAT('%',#{loginTime},'%')
AND `type`=0
</select>
<select id="queryAccessCountAPP" parameterType="string" resultType="int">
select count(0) from hrms_access_records_log
where login_time LIKE CONCAT('%',#{loginTime},'%')
AND `type`=1
</select>
<select id="queryUserCount" parameterType="string" resultType="int">
select count(0) from (
select user_id from hrms_access_records_log
where login_time LIKE CONCAT('%',#{loginTime},'%')
group by user_id
)a
</select>
<select id="queryLoginTime" parameterType="string" resultType="string">
SELECT
date_format( login_time, '%H' ) AS create_time2
FROM
hrms_access_records_log
WHERE login_time LIKE CONCAT('%',#{loginTime},'%')
GROUP BY create_time2
ORDER BY create_time2 asc
</select>
<select id="queryLoginSum" parameterType="string" resultType="java.lang.Integer">
SELECT
count(0),date_format( login_time, '%H:00' ) AS create_time2
FROM
hrms_access_records_log
WHERE login_time LIKE CONCAT('%',#{loginTime},'%')
GROUP BY create_time2
ORDER BY create_time2 asc
</select>
<select id="queryLoginObj" parameterType="string" resultType="com.daqing.financial.hrauth.model.AccessRecordsObjRes">
SELECT
count(0) as loginSum,date_format( login_time, '%H' ) AS loginTime
FROM
hrms_access_records_log
WHERE login_time LIKE CONCAT('%',#{loginTime},'%')
GROUP BY loginTime
ORDER BY loginTime asc
</select>
</mapper> </mapper>

Loading…
Cancel
Save