package com.jeesite.modules.admin.wenjuan.entity;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.jeesite.common.collect.ListUtils;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

import java.util.List;

/**
 * 问卷调查表Entity
 * @author wlc
 * @version 2022-06-18
 */
@Table(name="admin_question_item", alias="a", label="问卷调查表信息", columns={
		@Column(name="questionitem_id", attrName="questionitemId", label="主键ID", isPK=true),
		@Column(name="questionnaire_id", attrName="questionnaireId.id", label="问卷调查ID"),
		@Column(name="title", attrName="title", label="问卷项标题", queryType=QueryType.LIKE),
		@Column(name="max_selected", attrName="maxSelected", label="最多可选几项", comment="最多可选几项(0多选 1只选择一项)", isUpdateForce=true),
		@Column(name="seq", attrName="seq", label="排序", isUpdateForce=true),
		@Column(name="is_essay", attrName="isEssay", label="是否问答题", comment="是否问答题(0 true 1false)"),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false, isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false, isUpdateForce=true),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false, isUpdateForce=true),
		@Column(name="remarks", attrName="remarks", label="备注", queryType=QueryType.LIKE),
	}, orderBy="a.create_date ASC"
)
public class AdminQuestionItem extends DataEntity<AdminQuestionItem> {
	
	private static final long serialVersionUID = 1L;
	private String questionitemId;		// 主键ID
	private AdminQuestionnaireSurvey questionnaireId;		// 问卷调查ID 父类
	private String title;		// 问卷项标题
	private Long maxSelected;		// 最多可选几项(0多选 1只选择一项)
	private Long seq;		// 排序
	private String isEssay;		// 是否问答题(0 true 1false)
	private List<AdminQuestionOption> adminQuestionOptionList = ListUtils.newArrayList();		// 子表列表

	public AdminQuestionItem() {
		this(null);
	}

	public AdminQuestionItem(AdminQuestionnaireSurvey questionnaireId){
		this.questionnaireId = questionnaireId;
	}
	
	public String getQuestionitemId() {
		return questionitemId;
	}

	public void setQuestionitemId(String questionitemId) {
		this.questionitemId = questionitemId;
	}
	
	public AdminQuestionnaireSurvey getQuestionnaireId() {
		return questionnaireId;
	}

	public void setQuestionnaireId(AdminQuestionnaireSurvey questionnaireId) {
		this.questionnaireId = questionnaireId;
	}
	
	@Size(min=0, max=255, message="问卷项标题长度不能超过 255 个字符")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	public Long getMaxSelected() {
		return maxSelected;
	}

	public void setMaxSelected(Long maxSelected) {
		this.maxSelected = maxSelected;
	}
	
	public Long getSeq() {
		return seq;
	}

	public void setSeq(Long seq) {
		this.seq = seq;
	}
	
	@Size(min=0, max=255, message="是否问答题长度不能超过 255 个字符")
	public String getIsEssay() {
		return isEssay;
	}

	public void setIsEssay(String isEssay) {
		this.isEssay = isEssay;
	}


	@Valid
	public List<AdminQuestionOption> getAdminQuestionOptionList() {
		return adminQuestionOptionList;
	}

	public void setAdminQuestionOptionList(List<AdminQuestionOption> adminQuestionOptionList) {
		this.adminQuestionOptionList = adminQuestionOptionList;
	}

}