package cn.com.ty.lift.ud.expertPunish.controller.query;

import java.math.BigDecimal;
import java.util.Date;

import cn.com.ty.lift.ud.question.mapper.entity.QuestionBankEntity;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import cn.com.ty.lift.ud.common.BasePageQuery;
import cn.com.ty.lift.ud.expertPunish.mapper.entity.ExpertsPunishment;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * 专家惩罚记录查询条件
 * 
 * @author Xson
 * @date 2020-07-08
 */
@Data
@ApiModel(description = "查询条件")
public final class ExpertsPunishmentQuery extends BasePageQuery {

     private Long id;

    @ApiModelProperty("标题")
    private String title;

    private String desc;

     private String picUrl;

     @ApiModelProperty("惩罚金额")
     private BigDecimal punishAmount;
     
     @ApiModelProperty("专家id")
     @JsonSerialize(using=ToStringSerializer.class)
     private Long chargeId;

    @ApiModelProperty("惩罚状态 0 已处罚 1 已撤销")
    private Integer statuz;




    /**
     * 查询条件
     * @return
     */
    @Override
    public Wrapper condition() {
        QueryWrapper<ExpertsPunishment> query = new QueryWrapper<>();
        //标题
        if (StringUtils.isNotBlank(title)) {
            query.like("title", title);
        }
        //专家
        if (null != chargeId ) {
            query.eq("charge_id", chargeId);
        }
        //惩罚金额
        if (null != punishAmount) {
            query.eq("punish_amount", punishAmount);
        }
        //状态
        if (null != statuz) {
            query.eq("statuz", statuz);
        }
        query.orderByDesc("create_time");
        query.eq("1",1);
        return query;
    }

    /**
     * 分页条件
     * @return
     */
    @Override
    public IPage page() {
        Page<ExpertsPunishment> page = new Page<>(getPageNum(), getPageSize());
        return page;
    }

}

