package com.fzzy.api.view.pr;
|
|
import com.bstek.dorado.annotation.DataProvider;
|
import com.bstek.dorado.annotation.DataResolver;
|
import com.bstek.dorado.annotation.Expose;
|
import com.fzzy.api.entity.GbCheckItem;
|
import com.fzzy.api.view.repository.GbCheckItemRep;
|
import org.apache.commons.lang.StringUtils;
|
import org.springframework.beans.BeanUtils;
|
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 GbCheckItemPR {
|
|
@Autowired
|
private GbCheckItemRep gbCheckItemRep;
|
|
/**
|
* gbCheckItemPR#listAll
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<GbCheckItem> listAll() {
|
List<GbCheckItem> list = gbCheckItemRep.findAll();
|
return list;
|
}
|
|
/**
|
* gbCheckItemPR#updateSave
|
*
|
* @param entity
|
*/
|
@DataResolver
|
public void updateSave(GbCheckItem entity) {
|
|
// 手动将doradoEntity对象转换为标准Bean对象
|
GbCheckItem data = new GbCheckItem();
|
BeanUtils.copyProperties(entity, data);
|
|
gbCheckItemRep.save(data);
|
}
|
|
/**
|
* gbCheckItemPR#delData
|
*
|
* @param data
|
*/
|
@Expose
|
public String delData(GbCheckItem data) {
|
|
gbCheckItemRep.deleteById(data.getCode());
|
|
return null;
|
}
|
|
/**
|
* gbCheckItemPR#findByCode
|
*
|
* @return
|
*/
|
@DataProvider
|
public List<GbCheckItem> findByCode(Map<String, Object> param) {
|
|
if(null != param){
|
String key = (String) param.get("key");
|
if (StringUtils.isNotEmpty(key)) {
|
key = "%" + key + "%";
|
return gbCheckItemRep.findByCode(key,key);
|
}
|
}
|
return gbCheckItemRep.findAll();
|
}
|
}
|