Helius
2021-06-16 5728be2af515b2200e782aa201ca5d4d67d9ea47
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
package com.ibeetl.admin.console.service;
 
import com.ibeetl.admin.console.dao.XzxSysAddressLevelInfoDao;
import com.ibeetl.admin.core.entity.XzxSysAddressLevelInfo;
import com.ibeetl.admin.core.service.CoreBaseService;
import com.ibeetl.admin.core.util.PlatformException;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * XzxSysAddressLevelInfo Service
 */
 
@Service
@Transactional
public class XzxSysAddressLevelInfoService extends CoreBaseService<XzxSysAddressLevelInfo> {
 
    @Autowired private XzxSysAddressLevelInfoDao xzxSysAddressLevelInfoDao;
 
    public PageQuery<XzxSysAddressLevelInfo>queryByCondition(PageQuery query){
        PageQuery ret =  xzxSysAddressLevelInfoDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }
    public List<Map<String, Object>>  queryAllProvince(String level){
        List<Map<String, Object>> result = new ArrayList<>();
            result = xzxSysAddressLevelInfoDao.queryAllProvince();
        for (Map<String, Object> pMap:result) {
            List<Map<String, Object>> cList  = xzxSysAddressLevelInfoDao.queryAllCity(pMap.get("code").toString());
            for (Map<String, Object> cMap:cList) {
                if(null!=cMap.get("code")){
                    List<Map<String, Object>> tList  = xzxSysAddressLevelInfoDao.queryAllArea(cMap.get("code").toString());
                    cMap.put("children",tList);
                }
            }
            pMap.put("children",cList);
        }
        return result;
    }
    public void batchDelXzxSysAddressLevelInfo(List<Long> ids){
        try {
            xzxSysAddressLevelInfoDao.batchDelXzxSysAddressLevelInfoByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除XzxSysAddressLevelInfo失败", e);
        }
    }
}