BMallDao.java
1.49 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
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.BMall;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import jakarta.annotation.Resource;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 */
@Repository
public class BMallDao {
    @Resource
    private JdbcTemplate jdbcTemplate;
    /**
     * 查询门店
     * @param mallId
     * @return
     */
    public BMall getMallById(Long mallId) {
        String sql = "select id,name,parent_id,unid,status,external_id,group_id from b_mall where id = ?;";
        List<BMall> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BMall.class), mallId);
        if (list == null || list.size() == 0) {
            return null;
        }
        return list.get(0);
    }
    /**
     * 查询场所下的门店
     * @param locationMallId
     * @return
     */
    public List<Long> getMallByLocationMallId(Long locationMallId) {
        String sql = "select id from b_mall where parent_id = ?;";
        return jdbcTemplate.queryForList(sql, Long.class, locationMallId);
    }
    /**
     * 查询门店的出入口通道id
     * @param storeId
     * @return
     */
    public List<Long> getStoreInOutChannelIds(Long storeId) {
        String sql = "SELECT channel_id FROM r_mall_gate WHERE mall_id = ? and is_mall_gate = 1 and in_out = 1;";
        return jdbcTemplate.queryForList(sql, Long.class, storeId);
    }
}