package api.service.impl;
|
|
import api.bean.Pages;
|
import api.bean.PhotovoltaicError;
|
import api.dao.PhotovoltaicErrorDao;
|
import api.service.PhotovoltaicErrorService;
|
import api.service.SysUserRoleService;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* (PhotovoltaicError)表服务实现类
|
*
|
* @author makejava
|
* @since 2022-09-30 11:53:07
|
*/
|
@Service("photovoltaicErrorService")
|
public class PhotovoltaicErrorServiceImpl extends ServiceImpl<PhotovoltaicErrorDao, PhotovoltaicError> implements PhotovoltaicErrorService {
|
|
@Autowired
|
private SysUserRoleService sysUserRoleService;
|
|
@Autowired
|
private PhotovoltaicErrorDao photovoltaicErrorDao;
|
@Override
|
public PageInfo<PhotovoltaicError> list(Pages pages,Long userId) {
|
//获取角色列表
|
Long roleId = sysUserRoleService.queryRoleId(userId);
|
|
if (roleId == null || roleId == 0) {
|
return null;
|
}
|
|
int page = pages.getPage() - 1;
|
int size = pages.getSize();
|
|
List<PhotovoltaicError> allList = new ArrayList<>();
|
|
if (pages.getPhotovoltaicId() == null){
|
if (roleId.longValue() == 1) {
|
allList = photovoltaicErrorDao.findAllBySort(page, size, pages.getField(), pages.getSort());
|
}else{
|
allList = photovoltaicErrorDao.findByCompanyBySort(page, size,userId, null, pages.getField(), pages.getSort());
|
}
|
}else {
|
PageHelper.startPage(page, size);
|
allList = photovoltaicErrorDao.findByPhotovoltaicId(pages.getPhotovoltaicId());
|
}
|
|
PageInfo<PhotovoltaicError> pageInfo = new PageInfo<>(allList);
|
|
return pageInfo;
|
|
}
|
}
|