Bladeren bron

feat: 投诉新增分页接口和修改接口

xdd 2 weken geleden
bovenliggende
commit
a302e94a62

+ 1 - 0
fs-service/src/main/java/com/fs/complaint/dto/ComplaintQueryDTO.java

@@ -10,6 +10,7 @@ public class ComplaintQueryDTO {
 
     private String complaintNo;
     private Long categoryId;
+    private String categoryName;
     private Integer status;
     private String contactPhone;
     private String startTime;

+ 8 - 2
fs-service/src/main/java/com/fs/complaint/mapper/FsComplaintMapper.java

@@ -39,8 +39,8 @@ public interface FsComplaintMapper {
     /**
      * 插入投诉信息
      */
-    @Insert("INSERT INTO fs_complaint(complaint_no, category_id, content, contact_phone, contact_email, status, create_time, update_time) " +
-            "VALUES(#{complaintNo}, #{categoryId}, #{content}, #{contactPhone}, #{contactEmail}, #{status}, #{createTime}, #{updateTime})")
+    @Insert("INSERT INTO fs_complaint(complaint_no, category_id, category_name, content, contact_phone, contact_email, status, create_time, update_time) " +
+            "VALUES(#{complaintNo}, #{categoryId}, #{categoryName}, #{content}, #{contactPhone}, #{contactEmail}, #{status}, #{createTime}, #{updateTime})")
     @Options(useGeneratedKeys = true, keyProperty = "id")
     int insert(FsComplaint complaint);
 
@@ -77,6 +77,9 @@ public interface FsComplaintMapper {
             if (complaint.getCategoryId() != null) {
                 sql.append(", category_id = #{categoryId}");
             }
+            if (complaint.getCategoryName() != null) {
+                sql.append(", category_name = #{categoryName}");
+            }
             if (complaint.getContent() != null) {
                 sql.append(", content = #{content}");
             }
@@ -104,6 +107,9 @@ public interface FsComplaintMapper {
             if (queryDTO.getCategoryId() != null) {
                 where.append(" AND category_id = #{categoryId}");
             }
+            if (queryDTO.getCategoryName() != null && !queryDTO.getCategoryName().trim().isEmpty()) {
+                where.append(" AND category_name LIKE CONCAT('%', #{categoryName}, '%')");
+            }
             if (queryDTO.getStatus() != null) {
                 where.append(" AND status = #{status}");
             }