package com.fzzy.api.view.pr;
|
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.fzzy.api.entity.GbArea;
|
import com.fzzy.api.view.repository.GbAreaRep;
|
import org.apache.commons.lang.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 行政区划代码、产地
|
* @author he
|
*/
|
@Component
|
public class GbAreaPR {
|
|
@Autowired
|
private GbAreaRep gbAreaRep;
|
|
/**
|
* gbAreaPR#listAll
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<GbArea> listAll() {
|
return gbAreaRep.findAll();
|
}
|
|
/**
|
* gbAreaPR#findByCode
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<GbArea> findByCode(Map<String, Object> param) {
|
|
if(null != param){
|
String key = (String) param.get("key");
|
if (StringUtils.isNotEmpty(key)) {
|
key = "%" + key + "%";
|
return gbAreaRep.findByCode(key,key);
|
}
|
}
|
return gbAreaRep.findAll();
|
}
|
|
/**
|
* 根据parentId查询信息
|
* gbAreaPR#listByParent
|
*
|
* @param parentCode
|
* @return
|
*/
|
@DataProvider
|
public List<GbArea> listByParent(String parentCode) {
|
return gbAreaRep.listByParent(parentCode);
|
}
|
|
}
|