| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.MapUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.domain.ZfEvent; |
| | | import com.ruoyi.domain.ZfPet; |
| | | import com.ruoyi.domain.ZfPetNote; |
| | | import com.ruoyi.mapper.ZfPetNoteMapper; |
| | | import com.ruoyi.service.ZfPetNoteService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | |
| | | lqw.orderByDesc(ZfPetNote::getCreateTime); |
| | | Page<ZfPetNote> ZfPetNotePage = new Page<>(pageNum,pageSize); |
| | | Page<ZfPetNote> pageResult = page(ZfPetNotePage, lqw); |
| | | System.out.println(pageResult); |
| | | HashMap<String, Object> data = MapUtils.getResult(pageResult); |
| | | System.out.println(data); |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public AjaxResult getAllPetNoteByPetId(Long pid) { |
| | | LambdaQueryWrapper<ZfPetNote> lqw = new LambdaQueryWrapper<>(); |
| | | public AjaxResult getAllPetNoteByPetId(Integer pageNum,Integer pageSize,String pid,ZfPetNote zfPetNote) { |
| | | LambdaQueryWrapper<ZfPetNote> lqw = buildCondition(zfPetNote); |
| | | lqw.eq(ZfPetNote::getPid,pid); |
| | | lqw.orderByDesc(ZfPetNote::getCreateTime); |
| | | List<ZfPetNote> list = list(lqw); |
| | | return AjaxResult.success(list); |
| | | Page<ZfPetNote> zfPetNotePage = new Page<>(pageNum, pageSize); |
| | | Page<ZfPetNote> pageResult = page(zfPetNotePage, lqw); |
| | | HashMap<String, Object> result = MapUtils.getResult(pageResult); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | @Override |
| | | public List<ZfPetNote> getPetNoteByPetId(String pid ) { |
| | | ZfPetNote zfPetNote = new ZfPetNote(); |
| | | zfPetNote.setPid(pid); |
| | | LambdaQueryWrapper<ZfPetNote> lqw = buildCondition(zfPetNote); |
| | | lqw.eq(ZfPetNote::getPid,pid); |
| | | lqw.orderByDesc(ZfPetNote::getCreateTime); |
| | | return list(lqw); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<ZfPetNote> selectByIds(Long[] ids) { |
| | | List<ZfPetNote> list = new ArrayList<>(); |
| | | if(ids.length!=0) |
| | | list = listByIds(Arrays.asList(ids)); |
| | | else |
| | | list = list(); |
| | | return list; |
| | | } |
| | | |
| | | private LambdaQueryWrapper<ZfPetNote> uniqueCondition(ZfPetNote zfPetNote) { |
| | | LambdaQueryWrapper<ZfPetNote> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(StringUtils.isNotEmpty(zfPetNote.getTitle()),ZfPetNote::getTitle,zfPetNote.getTitle()); |