陶杰
2024-10-09 10273247ee11e73b2d691ffaeec8f57f9937aa8d
1.商品评论增加查询条件
已修改2个文件
39 ■■■■■ 文件已修改
src/main/java/com/mzl/flower/dto/request/comment/QueryFlowerCommentDTO.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/comment/FlowerCommentMapperCustom.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/mzl/flower/dto/request/comment/QueryFlowerCommentDTO.java
@@ -1,10 +1,13 @@
package com.mzl.flower.dto.request.comment;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
@Data
public class QueryFlowerCommentDTO {
@@ -45,4 +48,24 @@
    @ApiModelProperty(value = "隐藏标识 0 显示 1隐藏")
    private Integer showFlag;
    @ApiModelProperty(value = "订单编号")
    private String orderNo;
    @ApiModelProperty(value = "商品名称")
    private String flowerName;
    @ApiModelProperty(value = "评价等级")
    private Integer commentGrade;
    @ApiModelProperty(value = "评价日期-开始日期")
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private LocalDate commentStartDate;
    @ApiModelProperty(value = "评价日期-结束日期")
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private LocalDate commentEndDate;
}
src/main/resources/mapper/comment/FlowerCommentMapperCustom.xml
@@ -61,7 +61,21 @@
            and c.show_flag = #{param.showFlag}
        </if>
        <if test="param.orderNo != null and param.orderNo != ''">
            and o.order_no like concat('%', #{param.orderNo}, '%')
        </if>
        <if test="param.flowerName != null and param.flowerName != ''">
            and oi.flower_name like concat('%', #{param.flowerName}, '%')
        </if>
        <if test="param.commentGrade != null">
            and c.comment_grade = #{param.commentGrade}
        </if>
        <if test="param.commentStartDate != null">
            and DATE_FORMAT(c.create_time, '%Y-%m-%d') &gt;= #{param.commentStartDate}
        </if>
        <if test="param.commentEndDate != null">
            and DATE_FORMAT(c.create_time, '%Y-%m-%d') &lt;= #{param.commentEndDate}
        </if>
        order by c.create_time desc