package com.panzhihua.service_community.service.impl;
|
|
import com.panzhihua.common.model.vos.common.ComActEasyPhotoHandlerVo;
|
import com.panzhihua.service_community.entity.ComActEasyPhotoHandler;
|
import com.panzhihua.service_community.dao.ComActEasyPhotoHandlerMapper;
|
import com.panzhihua.service_community.service.ComActEasyPhotoHandlerService;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import org.springframework.beans.BeanUtils;
|
import com.panzhihua.common.model.dtos.common.*;
|
import com.panzhihua.common.model.vos.R;
|
import org.springframework.stereotype.Service;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* title: 随手拍、微心愿处理人绑定表表服务实现类
|
* <p>
|
* projectName 成都呐喊信息技术有限公司-智慧社区项目
|
* <p>
|
* description: 随手拍、微心愿处理人绑定表表服务实现类
|
*
|
* @author lyq
|
* @date 2022-03-01 13:45:11
|
*/
|
@Service("comActEasyPhotoHandlerService")
|
public class ComActEasyPhotoHandlerServiceImpl extends ServiceImpl<ComActEasyPhotoHandlerMapper, ComActEasyPhotoHandler> implements ComActEasyPhotoHandlerService {
|
|
/**
|
* description queryByPage 分页查询
|
*
|
* @param comActEasyPhotoHandler 请求参数
|
* @return 分页查询列表数据
|
* @author lyq
|
* @date 2022-03-01 13:45:11
|
*/
|
@Override
|
public R queryByPage(PageComActEasyPhotoHandlerDto comActEasyPhotoHandler) {
|
return R.ok(this.baseMapper.queryAllByLimit(comActEasyPhotoHandler, new Page(comActEasyPhotoHandler.getPageNum(), comActEasyPhotoHandler.getPageSize())));
|
}
|
|
/**
|
* description insert 新增数据
|
*
|
* @param comActEasyPhotoHandler 请求参数
|
* @return 新增结果
|
* @author lyq
|
* @date 2022-03-01 13:45:11
|
*/
|
@Override
|
public R insert(AddComActEasyPhotoHandlerDto comActEasyPhotoHandler) {
|
ComActEasyPhotoHandler entity = new ComActEasyPhotoHandler();
|
BeanUtils.copyProperties(comActEasyPhotoHandler, entity);
|
if (this.baseMapper.insert(entity) > 0) {
|
return R.ok();
|
}
|
return R.fail("添加失败");
|
}
|
|
/**
|
* description update 修改数据
|
*
|
* @param editDto 请求参数
|
* @return 修改结果
|
* @author lyq
|
* @date 2022-03-01 13:45:11
|
*/
|
@Override
|
public R update(EditComActEasyPhotoHandlerDto editDto) {
|
ComActEasyPhotoHandler entity = this.baseMapper.selectById(editDto.getId());
|
if (entity == null) {
|
return R.fail("未查询到该记录");
|
}
|
BeanUtils.copyProperties(editDto, entity);
|
if (this.baseMapper.updateById(entity) > 0) {
|
return R.ok();
|
}
|
return R.fail("修改失败");
|
}
|
|
/**
|
* description deleteById 通过主键删除数据
|
*
|
* @param id 主键id
|
* @return 删除结果
|
* @author lyq
|
* @date 2022-03-01 13:45:11
|
*/
|
@Override
|
public R deleteById(Long id) {
|
if (this.baseMapper.deleteById(id) > 0) {
|
return R.ok();
|
}
|
return R.fail("删除失败");
|
}
|
|
/**
|
* description detailById 查询详情
|
*
|
* @param id 主键id
|
* @return 详情数据
|
* @author lyq
|
* @date 2022-03-01 13:45:11
|
*/
|
@Override
|
public R detailById(Long id) {
|
return R.ok(this.baseMapper.queryById(id));
|
}
|
|
/**
|
* description queryByPage 查询列表
|
*
|
* @param comActEasyPhotoHandler 请求参数
|
* @return 列表数据
|
* @author lyq
|
* @date 2022-03-01 13:45:11
|
*/
|
@Override
|
public R queryByList(PageComActEasyPhotoHandlerDto comActEasyPhotoHandler) {
|
return R.ok(this.baseMapper.queryAllByList(comActEasyPhotoHandler));
|
}
|
|
/**
|
* 添加随手拍、微心愿处理关联记录
|
* @param communityId 社区id
|
* @param userId 用户id
|
* @param serviceId 业务id
|
* @param type 人员类型(1.后台用户 2.党员 3.志愿者 4.社工 5.四长四员)
|
* @param serviceType 业务类型(1.随手拍 2.微心愿)
|
*/
|
@Override
|
public void addHandleRecord(Long communityId, Long userId, Long serviceId, Integer type, Integer serviceType,Long sponsorId) {
|
ComActEasyPhotoHandler easyPhotoHandler = new ComActEasyPhotoHandler();
|
easyPhotoHandler.setCommunityId(communityId);
|
easyPhotoHandler.setStatus(ComActEasyPhotoHandler.Status.DZX);
|
easyPhotoHandler.setCreateTime(new Date());
|
easyPhotoHandler.setUserId(userId);
|
easyPhotoHandler.setSenderId(sponsorId);
|
easyPhotoHandler.setServiceId(serviceId);
|
easyPhotoHandler.setType(type);
|
easyPhotoHandler.setServiceType(serviceType);
|
this.baseMapper.insert(easyPhotoHandler);
|
}
|
|
/**
|
* 获取处理记录
|
* @param serviceId
|
* @param serviceType
|
* @return
|
*/
|
@Override
|
public List<ComActEasyPhotoHandlerVo> selectHandleRecord(Long serviceId, Integer serviceType) {
|
return this.baseMapper.selectHandleRecord(serviceId, serviceType);
|
}
|
}
|