|
@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.common.response.PageInfo;
|
|
|
import com.fdkankan.manage.entity.Case;
|
|
|
-import com.fdkankan.manage.entity.CaseIcon;
|
|
|
import com.fdkankan.manage.mapper.ICaseMapper;
|
|
|
-import com.fdkankan.manage.service.ICaseIconService;
|
|
|
import com.fdkankan.manage.service.ICaseService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.manage.vo.request.CaseParam;
|
|
@@ -33,8 +31,6 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements ICaseService {
|
|
|
|
|
|
- @Autowired
|
|
|
- ICaseIconService caseIconService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -43,27 +39,23 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
|
|
|
if(param.getTypeId() != null){
|
|
|
wrapper.eq(Case::getTypeId,param.getTypeId());
|
|
|
}
|
|
|
+ if(StringUtils.isNotBlank(param.getTitle())){
|
|
|
+ wrapper.like(Case::getTitle,param.getTitle());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getStartTime())){
|
|
|
+ wrapper.gt(Case::getPublicTime,param.getStartTime());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(param.getEndTime())){
|
|
|
+ wrapper.lt(Case::getPublicTime,param.getEndTime());
|
|
|
+ }
|
|
|
wrapper.orderByAsc(Case::getSort);
|
|
|
wrapper.orderByDesc(Case::getCreateTime);
|
|
|
Page<Case> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
|
- List<CaseIcon> list = caseIconService.list();
|
|
|
- HashMap<Integer,CaseIcon> map = new HashMap<>();
|
|
|
- for (CaseIcon icon : list) {
|
|
|
- map.put(icon.getId(),icon);
|
|
|
- }
|
|
|
|
|
|
List<CaseVo> caseVos = new ArrayList<>();
|
|
|
for (Case record : page.getRecords()) {
|
|
|
CaseVo vo = new CaseVo();
|
|
|
BeanUtils.copyProperties(record,vo);
|
|
|
- String iconIds = record.getIconIds();
|
|
|
- JSONArray jsonArray = JSONObject.parseArray(iconIds);
|
|
|
- List<CaseIcon> iconList = new ArrayList<>();
|
|
|
- for (Object o : jsonArray) {
|
|
|
- Integer id = (Integer) o;
|
|
|
- iconList.add(map.get(id));
|
|
|
- }
|
|
|
- vo.setIconList(iconList);
|
|
|
caseVos.add(vo);
|
|
|
}
|
|
|
Page<CaseVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|