AreaServiceImpl.java
1.65 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Copyright (c) 2018, 2028, glsx and/or its affiliates. All rights reserved.
* GLSX PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.glsx.usercenter.service.impl;
import com.glsx.usercenter.mapper.SysAreaMapper;
import com.glsx.usercenter.pojo.user.SysArea;
import com.glsx.usercenter.pojo.user.SysAreaExample;
import com.glsx.usercenter.service.IAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName: AreaServiceImpl
* @Description: TODO(这里用一句话描述这个类的作用)
* @author Zheng Xiajun
* @date 2019年1月23日
*
*/
@Service
public class AreaServiceImpl implements IAreaService {
@Autowired
private SysAreaMapper sysAreaMapper;
@Override
public List<SysArea> selectByExample(SysAreaExample example) {
return sysAreaMapper.selectByExample(example);
}
@Override
public SysArea getAllChargeItems(Integer id) {
SysAreaExample example=new SysAreaExample ();
example.createCriteria().andIdEqualTo(id);
List<SysArea> child = sysAreaMapper.selectByExample(example);
example.clear();
example.createCriteria().andIdEqualTo(child.get(0).getParentId());
List<SysArea> parent= sysAreaMapper.selectByExample(example);
example.clear();
example.createCriteria().andIdEqualTo(parent.get(0).getParentId());
SysArea prandPa= sysAreaMapper.selectByExample(example).get(0);
parent.get(0).setChildren(child);
prandPa.setChildren(parent);
return prandPa;
}
}