| | |
| | | public Integer create(Information information) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(information) |
| | | || Objects.isNull(information.getSortnum()) |
| | | || Objects.isNull(information.getReleaseDate()) |
| | | // || Objects.isNull(information.getSortnum()) |
| | | // || Objects.isNull(information.getReleaseDate()) |
| | | || StringUtils.isEmpty(information.getTitle()) |
| | | || StringUtils.isEmpty(information.getContnet()) |
| | | || StringUtils.isEmpty(information.getDescribe()) |
| | | || StringUtils.isEmpty(information.getImgurl()) |
| | | // || StringUtils.isEmpty(information.getContent()) |
| | | // || StringUtils.isEmpty(information.getDetail()) |
| | | // || StringUtils.isEmpty(information.getImgurl()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | information.setType(Constants.formatIntegerNum(information.getType())); |
| | | information.setIsdeleted(Constants.ZERO); |
| | | information.setCreateDate(new Date()); |
| | | information.setCreator(user.getId()); |
| | |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | informationMapper.update(new UpdateWrapper<Information>().lambda().set(Information::getIsdeleted,Constants.ZERO).eq(Information::getId,id)); |
| | | informationMapper.update(new UpdateWrapper<Information>().lambda().set(Information::getIsdeleted,Constants.ONE).eq(Information::getId,id)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | informationMapper.deleteBatchIds(ids); |
| | | for (Integer id : ids) { |
| | | this.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(information) |
| | | || Objects.isNull(information.getId()) |
| | | || Objects.isNull(information.getSortnum()) |
| | | || Objects.isNull(information.getReleaseDate()) |
| | | // || Objects.isNull(information.getSortnum()) |
| | | // || Objects.isNull(information.getReleaseDate()) |
| | | || StringUtils.isEmpty(information.getTitle()) |
| | | || StringUtils.isEmpty(information.getContnet()) |
| | | || StringUtils.isEmpty(information.getDescribe()) |
| | | || StringUtils.isEmpty(information.getImgurl()) |
| | | // || StringUtils.isEmpty(information.getContent()) |
| | | // || StringUtils.isEmpty(information.getDetail()) |
| | | // || StringUtils.isEmpty(information.getImgurl()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | |
| | | queryWrapper.lambda() |
| | | .eq(Information::getIsdeleted,Constants.ZERO) |
| | | .eq(pageWrap.getModel().getId() != null, Information::getId, pageWrap.getModel().getId()) |
| | | .eq(pageWrap.getModel().getModule() != null, Information::getModule, pageWrap.getModel().getModule()) |
| | | .eq(pageWrap.getModel().getType() != null, Information::getType, pageWrap.getModel().getType()) |
| | | .eq(pageWrap.getModel().getStatus() != null, Information::getStatus, pageWrap.getModel().getStatus()) |
| | | .eq(pageWrap.getModel().getRemark() != null, Information::getRemark, pageWrap.getModel().getRemark()) |
| | | .eq(pageWrap.getModel().getTitle() != null, Information::getTitle, pageWrap.getModel().getTitle()) |
| | | .eq(pageWrap.getModel().getDescribe() != null, Information::getDescribe, pageWrap.getModel().getDescribe()) |
| | | .eq(pageWrap.getModel().getContnet() != null, Information::getContnet, pageWrap.getModel().getContnet()) |
| | | .like(pageWrap.getModel().getTitle() != null, Information::getTitle, pageWrap.getModel().getTitle()) |
| | | .like(pageWrap.getModel().getDetail() != null, Information::getDetail, pageWrap.getModel().getDetail()) |
| | | .like(pageWrap.getModel().getContent() != null, Information::getContent, pageWrap.getModel().getContent()) |
| | | .ge(pageWrap.getModel().getReleaseDate() != null, Information::getReleaseDate, Utils.Date.getStart(pageWrap.getModel().getReleaseDate())) |
| | | .le(pageWrap.getModel().getReleaseDate() != null, Information::getReleaseDate, Utils.Date.getEnd(pageWrap.getModel().getReleaseDate())) |
| | | .orderByDesc(Information::getSortnum) |
| | | ; |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | |
| | | IPage<Information> iPage = informationMapper.selectPage(page, queryWrapper); |
| | | String fileDir = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.FILE_DIR).getCode(); |
| | | for (Information information:iPage.getRecords()) { |
| | | if(Objects.isNull(information)&& org.apache.commons.lang3.StringUtils.isNotBlank(information.getImgurl())){ |
| | | if(!Objects.isNull(information)&& org.apache.commons.lang3.StringUtils.isNotBlank(information.getImgurl())){ |
| | | information.setFullImgurl(fileDir + information.getImgurl()); |
| | | } |
| | | } |
| | |
| | | QueryWrapper<Information> wrapper = new QueryWrapper<>(information); |
| | | return informationMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void updateStatus(Information information){ |
| | | if(Objects.isNull(information) |
| | | || Objects.isNull(information.getStatus()) |
| | | || Objects.isNull(information.getId()) |
| | | || !(Constants.equalsInteger(information.getStatus(),Constants.ZERO) |
| | | || Constants.equalsInteger(information.getStatus(),Constants.ONE))){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | informationMapper.update(new UpdateWrapper<Information>().lambda().set(Information::getStatus,information.getStatus()).eq(Information::getId,information.getId())); |
| | | } |
| | | } |