huanghongfa
2021-01-21 32d3e175d20afe7e98825eec99b5a9e3fa4f0a34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package com.panzhihua.service_dangjian.service.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panzhihua.common.model.dtos.partybuilding.ComPbServiceTeamDTO;
import com.panzhihua.common.model.dtos.partybuilding.PageComPbServiceTeamDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComActEasyPhotoCommentVO;
import com.panzhihua.common.model.vos.partybuilding.ComPbServiceTeamVO;
import com.panzhihua.service_dangjian.dao.ComPbServiceTeamDAO;
import com.panzhihua.service_dangjian.model.dos.ComPbServiceTeamDO;
import com.panzhihua.service_dangjian.service.ComPbServiceTeamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 服务团队
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2021-01-21 17:39
 **/
@Slf4j
@Service
public class ComPbServiceTeamServiceImpl implements ComPbServiceTeamService {
    @Resource
    private ComPbServiceTeamDAO comPbServiceTeamDAO;
    /**
     * 新增服务团队人员
     *
     * @param comPbServiceTeamDTO 新增内容
     * @return 新增结果
     */
    @Override
    public R addServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) {
        ComPbServiceTeamDO comPbServiceTeamDO=new ComPbServiceTeamDO();
        BeanUtils.copyProperties(comPbServiceTeamDTO,comPbServiceTeamDO);
        int insert = comPbServiceTeamDAO.insert(comPbServiceTeamDO);
        if (insert>0) {
            return R.ok();
        }
        return R.fail();
    }
 
    /**
     * 编辑团队人员
     *
     * @param comPbServiceTeamDTO 编辑内容
     * @return 编辑结果
     */
    @Override
    public R putServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) {
        ComPbServiceTeamDO comPbServiceTeamDO=new ComPbServiceTeamDO();
        BeanUtils.copyProperties(comPbServiceTeamDTO,comPbServiceTeamDO);
        comPbServiceTeamDAO.updateById(comPbServiceTeamDO);
        return R.ok();
    }
 
    /**
     * 分页查询服务团队成员
     *
     * @param pageComPbServiceTeamDTO 查询参数
     * @return 查询结果
     */
    @Override
    public R PageComPbServiceTeamDTO(PageComPbServiceTeamDTO pageComPbServiceTeamDTO) {
        Page page = new Page<>();
        Long pageNum = pageComPbServiceTeamDTO.getPageNum();
        Long pageSize = pageComPbServiceTeamDTO.getPageSize();
        if (null==pageNum||0==pageNum) {
            pageNum = 1l;
        }
        if (null==pageSize||0==pageSize) {
            pageSize = 10l;
        }
        page.setSize(pageSize);
        page.setCurrent(pageNum);
        IPage<ComPbServiceTeamVO> iPage = comPbServiceTeamDAO.PageComPbServiceTeamDTO(page, pageComPbServiceTeamDTO);
        return R.ok(iPage);
    }
 
    /**
     * 删除服务团队人员
     *
     * @param comPbServiceTeamDTO 删除主键
     * @return 删除结果
     */
    @Override
    public R deleteServiceTeam(ComPbServiceTeamDTO comPbServiceTeamDTO) {
        int delete = comPbServiceTeamDAO.deleteById(comPbServiceTeamDTO.getId());
        if (delete>0) {
            return R.ok();
        }
        return R.fail();
    }
}