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);
|
}
|
}
|