DMallPersonGroupDayCountDataDao.java
2.36 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
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.DMallPersonGroupDayCountData;
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: 2022-11-02
* Time: 19:32
*/
@Repository
public class DMallPersonGroupDayCountDataDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SQL_INSERT = "insert into d_mall_person_group_day_count_data(mall_id,count_date,total_person_num,staff_num,customer_num,customer_adult_num,customer_child_num,customer_alone,customer_group) 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 from d_mall_person_group_day_count_data where count_date=? and mall_id = ?";
private static final String SQL_UPDATE = "update d_mall_person_group_day_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(DMallPersonGroupDayCountData countData) {
jdbcTemplate.update(SQL_INSERT, countData.getMallId(), countData.getCountDate(), countData.getTotalPersonNum(), countData.getStaffNum(), countData.getCustomerNum(), countData.getCustomerAdultNum(), countData.getCustomerChildNum(), countData.getCustomerAlone(), countData.getCustomerGroup());
}
public List<DMallPersonGroupDayCountData> selectByMallIdAndCountDate(Long mallId, Date countDate) {
RowMapper<DMallPersonGroupDayCountData> rowMapper = new BeanPropertyRowMapper<>(DMallPersonGroupDayCountData.class);
return jdbcTemplate.query(SQL_QUERY, rowMapper, countDate, mallId);
}
public void update(DMallPersonGroupDayCountData countData) {
jdbcTemplate.update(SQL_UPDATE, countData.getTotalPersonNum(), countData.getStaffNum(), countData.getCustomerNum(), countData.getCustomerAdultNum(), countData.getCustomerChildNum(), countData.getCustomerAlone(), countData.getCustomerGroup(), countData.getId());
}
}