FaceRecognitionDao.java
2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.Person;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.boot.autoconfigure.batch.BatchProperties;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* Created with IntelliJ IDEA.
*
* @author: zhuhai
* Date: 2023-12-21
* Time: 16:54
*/
@Repository
public class FaceRecognitionDao {
@Resource
private JdbcTemplate jdbcTemplate;
@Resource
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Resource
private BGateDao bGateDao;
public List<Person> queryGateFaceRecognitionList(Long mallId, Date countDate) {
List<Long> gateIds = bGateDao.getMallInsideGateIds(mallId);
if (CollectionUtils.isEmpty(gateIds)) {
return null;
}
String sql = "select account_id,mall_id,gate_id,person_unid,direction,countdate as countDate," +
"counttime as countTime from d_face_recognition " +
"where mall_id = :mallId and countdate = :countDate and gate_id in(:gateIds) " +
"and person_type = 0 and direction in(-1,1,6) order by person_unid asc,counttime asc;";
Map<String, Object> queryMap = new HashMap<>();
queryMap.put("mallId", mallId);
queryMap.put("countDate", countDate);
queryMap.put("gateIds", gateIds);
return namedParameterJdbcTemplate.query(sql, queryMap, new BeanPropertyRowMapper<>(Person.class));
}
public List<Person> queryFaceRecognitionList(Long mallId, Date countDate) {
String sql = "select account_id,mall_id,gate_id,person_unid,direction,countdate as countDate,person_type,age,gender," +
"counttime as countTime from d_face_recognition where mall_id = ? and countdate = ? " +
"and direction in(-1,1,6) order by person_unid asc, counttime asc;";
return jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Person.class), mallId, countDate);
}
}