wuzeyu
2024-08-01 4f6a87494a6117ba10e4f0769bcd59a5bd30474d
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
package com.dy.pipIrrOperation.feedback;
 
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoOp.OpeFeedbackMapper;
import com.dy.pipIrrGlobal.daoOp.OpeFeedbackReplyMapper;
import com.dy.pipIrrGlobal.pojoOp.OpeFeedback;
import com.dy.pipIrrGlobal.pojoOp.OpeFeedbackReply;
import com.dy.pipIrrGlobal.voOp.Vofeedback;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.List;
import java.util.Map;
 
/**
 * @author ZhuBaoMin
 * @date 2024-07-29 13:42
 * @LastEditTime 2024-07-29 13:42
 * @Description
 */
 
@Slf4j
@Service
@RequiredArgsConstructor
public class FeedbackSv {
    @Autowired
    private OpeFeedbackMapper opeFeedbackMapper;
 
    @Autowired
    private OpeFeedbackReplyMapper opeFeedbackReplyMapper;
 
    /**
     * 添加问题反馈
     * @param feedback
     * @return
     */
    public int add(OpeFeedback feedback) {
        feedback.setState((byte)0);
        feedback.setFeedbackTime(new Date());
        int i = opeFeedbackMapper.insertSelective(feedback);
        return i;
    }
 
    /**
     * 修改问题反馈状态
     * @param feedback
     * @return
     */
    public int update(OpeFeedback feedback) {
        int i = opeFeedbackMapper.updateByPrimaryKeySelective(feedback);
        return i;
    }
 
    /**
     * 删除问题反馈
     * @param id
     * @return
     */
    public int delete(Long id) {
        int i = opeFeedbackMapper.deleteByPrimaryKey(id);
        return i;
    }
 
    /**
     * 获取问题反馈
     * @param qo
     * @return
     */
    public QueryResultVo<List<Vofeedback>> getFeedbacks(QueryVo qo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo);
        Long itemTotal = opeFeedbackMapper.getRecordCount(params);
 
        QueryResultVo<List<Vofeedback>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = qo.pageSize;
        rsVo.pageCurr = qo.pageCurr;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = opeFeedbackMapper.getFeedbacks(params);
        return rsVo;
    }
 
    /**
     * 问题反馈回复
     * @param reply
     * @return
     */
    public Integer addReply(OpeFeedbackReply reply) {
        reply.setReplyTime(new Date());
        return opeFeedbackReplyMapper.insertSelective(reply);
    }
}