czt
2025-06-11 283da741b2429cf5a53786e5ee1b5528b757fdf6
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package com.fzzy.igds.sys;
 
import com.fzzy.igds.dzhwk.data.BaseParam;
import com.fzzy.igds.dzhwk.domain.DicArea;
import com.fzzy.igds.sys.mapper.DicAreaMapper;
import com.fzzy.igds.sys.repository.DicAreaRepository;
import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @Description
 * @Author CZT
 * @Date 2024/11/23 09:56
 */
@Slf4j
@Service("sys.dicAreaService")
public class DicAreaService {
 
    @Resource
    private DicAreaRepository dicAreaRepository;
    @Resource
    private DicAreaMapper dicAreaMapper;
 
    /**
     * JPA分页查询数据
     *
     * @param pageable
     */
    public Page<DicArea> findAll(Pageable pageable) {
        return dicAreaRepository.findAll(pageable);
    }
 
    /**
     * JPA分页查询数据
     *
     * @param specification
     * @param pageable
     * @return
     */
    public Page<DicArea> findAll(Specification<DicArea> specification, Pageable pageable) {
        return dicAreaRepository.findAll(specification, pageable);
    }
 
    /**
     * JPA根据父编码查询区域信息
     *
     * @param parentCode
     * @return
     */
    public List<DicArea> getDicAreaByParentCode(String parentCode) {
        if(StringUtils.isEmpty(parentCode)){
            return dicAreaRepository.findAll();
        }
        return dicAreaRepository.getDicAreaByParentCode(parentCode);
    }
 
    /**
     * JPA保存数据
     *
     * @param data
     * @return
     */
    public String saveDicArea(DicArea data) {
        dicAreaRepository.save(data);
        return null;
    }
 
 
    /**
     * JPA删除数据
     *
     * @param data
     * @return
     */
    public String delDicArea(DicArea data) {
        dicAreaRepository.delete(data);
        return null;
    }
 
    /**
     * 根据名称获取区域编码
     *
     * @param name
     * @return
     */
    public DicArea listDicAreaByName(String name) {
        return dicAreaRepository.listDicAreaByName(name);
    }
 
    /**
     * 根据区域编码获取名称
     *
     * @param code
     * @return
     */
    public DicArea listDicAreaByCode(String code) {
        return dicAreaRepository.listDicAreaByCode(code);
    }
 
 
    /**
     * Mybatis 分页查询数据
     *
     * @param specification
     * @param pageable
     * @return
     */
    /**
     *
     * @param page
     * @param param
     * @return
     */
    public List<DicArea> listDicArea(com.fzzy.igds.dzhwk.data.Page<DicArea> page, BaseParam param) {
        return dicAreaMapper.listDicArea(page,param);
    }
}