DPersonTrackDetailDao.java
1.53 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
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.DPersonTrackDetail;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*
* @author: zhuhai
* Date: 2023-12-22
* Time: 9:28
*/
@Repository
public class DPersonTrackDetailDao {
@Resource
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Resource
private JdbcTemplate jdbcTemplate;
public void createDPersonTrackDetailBatch(List<DPersonTrackDetail> personTrackDetailList) {
SqlParameterSource[] batch = SqlParameterSourceUtils.createBatch(personTrackDetailList.toArray());
String sql = "insert into d_person_track_detail (mall_id,account_id,gate_id,count_date,person_unid,group_unid,arrive_time, leave_time, visit_duration, is_engage)" +
" values(:mallId,:accountId,:gateId,:countDate,:personUnid,:groupUnid,:arriveTime,:leaveTime,:visitDuration,:isEngage)";
namedParameterJdbcTemplate.batchUpdate(sql, batch);
}
public void deleteData(Long mallId, Date countDate) {
String sql = "delete from d_person_track_detail where mall_id = ? and count_date = ?";
jdbcTemplate.update(sql, mallId, countDate);
}
}