Administrator
2024-08-01 3b32adb6b7b8d40f85e84f8b1a775f2ec1df88af
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackSv.java
@@ -1,8 +1,18 @@
package com.dy.pipIrrOperation.feedback;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoOp.OpeFeedbackMapper;
import com.dy.pipIrrGlobal.pojoOp.OpeFeedback;
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
@@ -15,4 +25,55 @@
@Service
@RequiredArgsConstructor
public class FeedbackSv {
    @Autowired
    private OpeFeedbackMapper opeFeedbackMapper;
    /**
     * 添加问题反馈
     * @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;
    }
}