pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoOp/OpeFeedbackReplyMapper.java
@@ -2,7 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoOp.OpeFeedbackReply; import com.dy.pipIrrGlobal.voOp.Vofeedback; import com.dy.pipIrrGlobal.voOp.VofeedbackReply; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -28,7 +28,17 @@ int updateByPrimaryKey(OpeFeedbackReply record); // Long getRecordCount(Map<String, Object> params); /** * 获取反馈回复数量 * @param params * @return */ Long getRecordCount(Map<String, Object> params); // List<Vofeedback> getFeedbackReplys(Map<String, Object> params); /** * 获取反馈回复 * @param params * @return */ List<VofeedbackReply> getFeedbackReply(Map<String, Object> params); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoOp/OpeFeedbackReply.java
@@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import lombok.*; import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank; import java.util.Date; @@ -45,7 +46,7 @@ /** * 回复内容 */ @NotNull @NotBlank private String replyContent; /** @@ -57,6 +58,7 @@ * 回复人ID */ @NotNull @JSONField(serializeUsing= ObjectWriterImplToString.class) private Long replierId; pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voOp/VofeedbackReply.java
New file @@ -0,0 +1,40 @@ package com.dy.pipIrrGlobal.voOp; import com.dy.common.po.BaseEntity; import lombok.Data; import java.util.Date; /** * @author :WuZeYu * @Date :2024/8/1 20:07 * @LastEditTime :2024/8/1 20:07 * @Description */ @Data public class VofeedbackReply implements BaseEntity { private static final long serialVersionUID = 202408012009001L; /** * 主键id */ private String id; /** * 反馈编号 */ private String feedbackId; /** * 回复内容 */ private String replyContent; /** * 回复时间 */ private Date replyTime; /** * 回复人ID */ private String replierId; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/OpeFeedbackReplyMapper.xml
@@ -99,4 +99,52 @@ replier_id = #{replierId,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT} </update> <select id="getRecordCount" resultType="java.lang.Long"> select count(*) from ope_feedback_reply ofbr inner join ope_feedback ofb on ofbr.feedback_id = ofb.id <where> <if test="feedbackId != null and feedbackId != '' "> and ofbr.feedback_id = #{feedbackId,jdbcType=BIGINT} </if> <if test="replierId != null and replierId != '' "> and ofbr.replier_id = #{replierId,jdbcType=BIGINT} </if> <if test="replyTimeStart != null"> and ofbr.reply_time >= #{replyTimeStart} </if> <if test="replyTimeStop != null"> and ofbr.reply_time <= #{replyTimeStop} </if> </where> </select> <select id="getFeedbackReply" resultType="com.dy.pipIrrGlobal.voOp.VofeedbackReply"> select CAST(ofbr.id as char) AS id, CAST(ofbr.feedback_id as char) AS feedbackId, ofbr.reply_content as replyContent, ofbr.reply_time as replyTime, CAST(ofbr.replier_id as char) AS replierId from ope_feedback_reply ofbr inner join ope_feedback ofb on ofbr.feedback_id = ofb.id <where> <if test="feedbackId != null and feedbackId != '' "> and ofbr.feedback_id = #{feedbackId,jdbcType=BIGINT} </if> <if test="replierId != null and replierId != '' "> and ofbr.replier_id = #{replierId,jdbcType=BIGINT} </if> <if test="replyTimeStart != null"> and ofbr.reply_time >= #{replyTimeStart} </if> <if test="replyTimeStop != null"> and ofbr.reply_time <= #{replyTimeStop} </if> </where> order by ofbr.id desc <if test="pageCurr != null and pageSize != null"> LIMIT ${(pageCurr-1)*pageSize}, ${pageSize} </if> </select> </mapper> pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackCtrl.java
@@ -7,6 +7,7 @@ import com.dy.pipIrrGlobal.pojoOp.OpeFeedback; import com.dy.pipIrrGlobal.pojoOp.OpeFeedbackReply; import com.dy.pipIrrGlobal.voOp.Vofeedback; import com.dy.pipIrrGlobal.voOp.VofeedbackReply; import io.swagger.v3.oas.annotations.Parameter; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; @@ -148,13 +149,84 @@ if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } if (reply.getFeedbackId() == null){ return BaseResponseUtils.buildFail("请传入反馈编号id"); } Integer rec = Optional.ofNullable(feedbackSv.addReply(reply)).orElse(0); if (rec == 0) { return BaseResponseUtils.buildFail("添加回复失败"); } return BaseResponseUtils.buildSuccess(true); } /** * 修改问题反馈回复 * @param reply * @param bindingResult * @return */ @PostMapping(path = "updateReply", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> updateReply(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid OpeFeedbackReply reply, @Parameter(hidden = true) BindingResult bindingResult) { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } int count ; try { count = feedbackSv.updateReply(reply); } catch (Exception e) { log.error("修改问题反馈回复异常", e); return BaseResponseUtils.buildException(e.getMessage()); } if (count <= 0) { return BaseResponseUtils.buildFail("修改反馈回复失败"); } else { return BaseResponseUtils.buildSuccess(true); } } /** * 删除问题反馈回复 * @param map * @return */ @PostMapping(path = "deleteReply") @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> deleteReply(@RequestBody Map map) { if (map == null || map.size() <= 0) { return BaseResponseUtils.buildFail("请传入id"); } Long id = Long.parseLong(map.get("id").toString()); try { Integer recordCount = Optional.ofNullable(feedbackSv.deleteReply(id)).orElse(0); if (recordCount == 0) { return BaseResponseUtils.buildFail("删除失败"); } else { return BaseResponseUtils.buildSuccess(true); } } catch (Exception e) { log.error("删除异常", e); return BaseResponseUtils.buildException(e.getMessage()); } } /** * 分页查询问题反馈回复 * @param qo * @return */ @GetMapping(path = "getFeedbackReply") @SsoAop() public BaseResponse<QueryResultVo<List<VofeedbackReply>>> getFeedbackReply(ReplyQueryVo qo) { try { QueryResultVo<List<VofeedbackReply>> res = feedbackSv.getFeedbackReply(qo); if (res == null) { return BaseResponseUtils.buildFail("查询失败"); } return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("查询异常", e); return BaseResponseUtils.buildException(e.getMessage()); } } } pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/FeedbackSv.java
@@ -6,6 +6,7 @@ import com.dy.pipIrrGlobal.pojoOp.OpeFeedback; import com.dy.pipIrrGlobal.pojoOp.OpeFeedbackReply; import com.dy.pipIrrGlobal.voOp.Vofeedback; import com.dy.pipIrrGlobal.voOp.VofeedbackReply; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; @@ -83,7 +84,7 @@ } /** * 问题反馈回复 * 添加问题反馈回复 * @param reply * @return */ @@ -91,4 +92,40 @@ reply.setReplyTime(new Date()); return opeFeedbackReplyMapper.insertSelective(reply); } /** * 修改问题反馈回复 * @param reply * @return */ public int updateReply(OpeFeedbackReply reply) { reply.setReplyTime(new Date()); return opeFeedbackReplyMapper.updateByPrimaryKeySelective(reply); } /** * 删除问题反馈回复 * @param id * @return */ public Integer deleteReply(Long id) { return opeFeedbackReplyMapper.deleteByPrimaryKey(id); } /** * 获取反馈回复 * @param qo * @return */ public QueryResultVo<List<VofeedbackReply>> getFeedbackReply(ReplyQueryVo qo) { Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); Long itemTotal = opeFeedbackReplyMapper.getRecordCount(params); QueryResultVo<List<VofeedbackReply>> rsVo = new QueryResultVo<>(); rsVo.pageSize = qo.pageSize; rsVo.pageCurr = qo.pageCurr; rsVo.calculateAndSet(itemTotal, params); rsVo.obj = opeFeedbackReplyMapper.getFeedbackReply(params); return rsVo; } } pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/QueryVo.java
@@ -34,12 +34,12 @@ /** * 查询开始日期 */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd") private Date timeStart; /** * 查询结束日期 */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd") private Date timeStop; } pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/java/com/dy/pipIrrOperation/feedback/ReplyQueryVo.java
New file @@ -0,0 +1,43 @@ package com.dy.pipIrrOperation.feedback; import com.dy.common.webUtil.QueryConditionVo; import lombok.*; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * @author :WuZeYu * @Date :2024/8/1 19:40 * @LastEditTime :2024/8/1 19:40 * @Description */ @Data @EqualsAndHashCode(callSuper = false) @ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @Builder public class ReplyQueryVo extends QueryConditionVo { /** * 反馈编号 */ private String feedbackId; /** * 回复人 */ private String replierId; /** * 回复时间开始日期 */ @DateTimeFormat(pattern = "yyyy-MM-dd") private Date replyTimeStart; /** * 回复时间结束日期 */ @DateTimeFormat(pattern = "yyyy-MM-dd") private Date replyTimeStop; }