DMallPersonGroupHourCountDataDao.java
2.55 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
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.DMallPersonGroupDayCountData;
import com.viontech.keliu.entity.DMallPersonGroupHourCountData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* Created with IntelliJ IDEA.
*
* @author: zhuhai
* Date: 2023-03-28
* Time: 19:32
*/
@Repository
public class DMallPersonGroupHourCountDataDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SQL_INSERT = "insert into d_mall_person_group_hour_count_data(mall_id,count_date,total_person_num,staff_num,customer_num,customer_adult_num,customer_child_num,customer_alone,customer_group,count_time,hour) values(?,?,?,?,?,?,?,?,?,?,?)";
private static final String SQL_QUERY = "select id, mall_id,count_date,total_person_num,staff_num,customer_num,customer_adult_num,customer_child_num,customer_alone,customer_group,count_time,hour from d_mall_person_group_hour_count_data where count_date=? and mall_id = ? and count_time= ?";
private static final String SQL_UPDATE = "update d_mall_person_group_hour_count_data set total_person_num = ?, staff_num = ?, customer_num = ?, customer_adult_num = ?, customer_child_num = ?, customer_alone = ?, customer_group = ? where id = ?";
public void create(DMallPersonGroupHourCountData countData) {
jdbcTemplate.update(SQL_INSERT, countData.getMallId(), countData.getCountDate(), countData.getTotalPersonNum(), countData.getStaffNum(), countData.getCustomerNum(), countData.getCustomerAdultNum(), countData.getCustomerChildNum(), countData.getCustomerAlone(), countData.getCustomerGroup(), countData.getCountTime(), countData.getHour());
}
public List<DMallPersonGroupHourCountData> selectByMallIdAndCountDate(Long mallId, Date countDate, Date countTime) {
RowMapper<DMallPersonGroupHourCountData> rowMapper = new BeanPropertyRowMapper<>(DMallPersonGroupHourCountData.class);
return jdbcTemplate.query(SQL_QUERY, rowMapper, countDate, mallId, countTime);
}
public void update(DMallPersonGroupHourCountData countData) {
jdbcTemplate.update(SQL_UPDATE, countData.getTotalPersonNum(), countData.getStaffNum(), countData.getCustomerNum(), countData.getCustomerAdultNum(), countData.getCustomerChildNum(), countData.getCustomerAlone(), countData.getCustomerGroup(), countData.getId());
}
}