| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.panzhihua.service_community.dao.ComActEasyPhotoClassifyMapper; |
| | | import com.panzhihua.service_community.model.dos.ComActEasyPhotoClassifyDO; |
| | | import com.panzhihua.service_community.service.ComActEasyPhotoClassifyService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @auther lyq |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComActEasyPhotoClassifyServiceImpl extends ServiceImpl<ComActEasyPhotoClassifyMapper, ComActEasyPhotoClassifyDO> implements ComActEasyPhotoClassifyService { |
| | | public class ComActEasyPhotoClassifyServiceImpl extends |
| | | ServiceImpl<ComActEasyPhotoClassifyMapper, ComActEasyPhotoClassifyDO> implements ComActEasyPhotoClassifyService { |
| | | |
| | | /** |
| | | * 运营后台-新增随手拍分类 |
| | | * @param addPhotoClassify 请求参数 |
| | | * @return 新增结果 |
| | | * |
| | | * @param addPhotoClassify |
| | | * 请求参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @Override |
| | | public R addPhotoClassify(AddEasyPhotoClassifyDTO addPhotoClassify){ |
| | | ComActEasyPhotoClassifyDO photoClassifyDO = this.baseMapper.selectOne(new QueryWrapper<ComActEasyPhotoClassifyDO>().lambda() |
| | | .eq(ComActEasyPhotoClassifyDO::getName,addPhotoClassify.getName())); |
| | | if(photoClassifyDO != null){ |
| | | public R addPhotoClassify(AddEasyPhotoClassifyDTO addPhotoClassify) { |
| | | ComActEasyPhotoClassifyDO photoClassifyDO = |
| | | this.baseMapper.selectOne(new QueryWrapper<ComActEasyPhotoClassifyDO>().lambda() |
| | | .eq(ComActEasyPhotoClassifyDO::getName, addPhotoClassify.getName())); |
| | | if (photoClassifyDO != null) { |
| | | return R.fail("该随手拍分类已存在,请勿重复添加"); |
| | | } |
| | | photoClassifyDO = new ComActEasyPhotoClassifyDO(); |
| | | BeanUtils.copyProperties(addPhotoClassify,photoClassifyDO); |
| | | BeanUtils.copyProperties(addPhotoClassify, photoClassifyDO); |
| | | photoClassifyDO.setCreateAt(new Date()); |
| | | photoClassifyDO.setStatus(ComActEasyPhotoClassifyDO.status.yes); |
| | | if(this.baseMapper.insert(photoClassifyDO) > 0){ |
| | | if (this.baseMapper.insert(photoClassifyDO) > 0) { |
| | | return R.ok(); |
| | | }else{ |
| | | } else { |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 运营后台-编辑随手拍分类 |
| | | * @param addPhotoClassify 请求参数 |
| | | * @return 编辑结果 |
| | | * |
| | | * @param addPhotoClassify |
| | | * 请求参数 |
| | | * @return 编辑结果 |
| | | */ |
| | | @Override |
| | | public R editPhotoClassify(AddEasyPhotoClassifyDTO addPhotoClassify){ |
| | | public R editPhotoClassify(AddEasyPhotoClassifyDTO addPhotoClassify) { |
| | | ComActEasyPhotoClassifyDO photoClassifyDO = this.baseMapper.selectById(addPhotoClassify.getId()); |
| | | if(photoClassifyDO == null){ |
| | | if (photoClassifyDO == null) { |
| | | return R.fail("该随手拍分类不存在"); |
| | | } |
| | | BeanUtils.copyProperties(addPhotoClassify,photoClassifyDO); |
| | | BeanUtils.copyProperties(addPhotoClassify, photoClassifyDO); |
| | | photoClassifyDO.setUpdateAt(new Date()); |
| | | if(this.baseMapper.updateById(photoClassifyDO) > 0){ |
| | | if (this.baseMapper.updateById(photoClassifyDO) > 0) { |
| | | return R.ok(); |
| | | }else{ |
| | | } else { |
| | | return R.fail(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 运营后台-随手拍分类详情 |
| | | * @param id 随手拍分类id |
| | | * @return 随手拍分类 |
| | | * |
| | | * @param id |
| | | * 随手拍分类id |
| | | * @return 随手拍分类 |
| | | */ |
| | | @Override |
| | | public R detailPhotoClassify(Long id){ |
| | | public R detailPhotoClassify(Long id) { |
| | | ComActEasyPhotoClassifyVO photoClassifyVO = new ComActEasyPhotoClassifyVO(); |
| | | ComActEasyPhotoClassifyDO photoClassifyDO = this.baseMapper.selectById(id); |
| | | if(photoClassifyDO == null){ |
| | | if (photoClassifyDO == null) { |
| | | return R.fail("该随手拍分类不存在"); |
| | | } |
| | | BeanUtils.copyProperties(photoClassifyDO,photoClassifyVO); |
| | | BeanUtils.copyProperties(photoClassifyDO, photoClassifyVO); |
| | | return R.ok(photoClassifyVO); |
| | | } |
| | | |
| | | /** |
| | | * 运营后台-分页查询随手拍分类 |
| | | * @param addPhotoClassify 请求参数 |
| | | * @return 随手拍分类列表 |
| | | * |
| | | * @param addPhotoClassify |
| | | * 请求参数 |
| | | * @return 随手拍分类列表 |
| | | */ |
| | | @Override |
| | | public R pagePhotoClassify(AddEasyPhotoClassifyDTO addPhotoClassify){ |
| | | return R.ok(this.baseMapper.getPhotoClassifyPage(new Page(addPhotoClassify.getPageNum(),addPhotoClassify.getPageSize()),addPhotoClassify)); |
| | | public R pagePhotoClassify(AddEasyPhotoClassifyDTO addPhotoClassify) { |
| | | return R.ok(this.baseMapper.getPhotoClassifyPage( |
| | | new Page(addPhotoClassify.getPageNum(), addPhotoClassify.getPageSize()), addPhotoClassify)); |
| | | } |
| | | |
| | | /** |
| | | * 运营后台-查询随手拍分类列表 |
| | | * @return 随手拍分类列表 |
| | | * |
| | | * @return 随手拍分类列表 |
| | | */ |
| | | @Override |
| | | public R listPhotoClassify(){ |
| | | public R listPhotoClassify() { |
| | | return R.ok(this.baseMapper.getPhotoClassifyList()); |
| | | } |
| | | |
| | | /** |
| | | * 运营后台-随手拍分类删除 |
| | | * @param id 随手拍分类id |
| | | * @return 删除结果 |
| | | * |
| | | * @param id |
| | | * 随手拍分类id |
| | | * @return 删除结果 |
| | | */ |
| | | @Override |
| | | public R deletePhotoClassify(Long id){ |
| | | if(this.baseMapper.deleteById(id) > 0){ |
| | | public R deletePhotoClassify(Long id) { |
| | | if (this.baseMapper.deleteById(id) > 0) { |
| | | return R.ok(); |
| | | }else{ |
| | | } else { |
| | | return R.fail(); |
| | | } |
| | | } |