package com.wzj.soopin.member.domain.bo;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wzj.soopin.member.domain.po.Feedback;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.dromara.common.core.domain.BaseBO;

import java.time.LocalDateTime;

/**
 * 意见反馈 查询 对象
 *
 * @author zcc
 */
@Schema(description = "意见反馈 查询 对象")
@Data
public class FeedbackBO  extends BaseBO {
    @Schema(description ="ID")
    private Long id;

    @Schema(description ="类型 1 举报 2 投诉 3 建议")
    private Integer type;

    @Schema(description ="内容")
    private String content;

    @Schema(description ="图片")
    private String images;

    @Schema(description ="联系电话")
    private String phone;

    @Schema(description ="处理状态 0：未处理  1：已处理")
    private Integer status;

    @Schema(description ="备注")
    private String remark;

    @Schema(description ="处理时间")
    private LocalDateTime handleTime;



    @Schema(description ="反馈对象ID")
    private String aimId;

    @Schema(description ="原因")
    private Integer reasonType;

    @Schema(description ="会员ID")
    private String memberId;

    @Schema(description ="处理人")
    private Long handlerId;

    @Schema(description ="处理结果类型 ")
    private Integer resultType;

    @Schema(description ="处理结果")
    private String resultContent;

    @Schema(description ="反馈对象类型 1 会员 2 群组 3 评论 4 视频  5 聊天" )
    private Integer aimType;

    @Override
    public LambdaQueryWrapper toWrapper() {
       return new LambdaQueryWrapper<Feedback>()
            .eq(type!=null,Feedback::getType, type)
            .eq(content!=null,Feedback::getContent, content)
            .eq(images!=null,Feedback::getImages, images)
            .eq(phone!=null,Feedback::getPhone, phone)
            .eq(status!=null,Feedback::getStatus, status)
            .eq(remark!=null,Feedback::getRemark, remark)
            .eq(handleTime!=null,Feedback::getHandleTime, handleTime)
            .eq(aimId!=null,Feedback::getAimId, aimId)
            .eq(reasonType!=null,Feedback::getReasonType, reasonType)
            .eq(memberId!=null,Feedback::getMemberId, memberId)
            .eq(handlerId!=null,Feedback::getHandlerId, handlerId)
            .eq(resultType!=null,Feedback::getResultType, resultType)
            .eq(resultContent!=null,Feedback::getResultContent, resultContent)
            .ge(beginTime!=null,Feedback::getCreateTime, beginTime)
            .lt(endTime!=null,Feedback::getCreateTime, endTime)
           .eq(aimType!=null,Feedback::getAimType, aimType)
            .orderByDesc(Feedback::getId)
            ;
    }
}
