You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

78 lines
3.8 KiB

package com.mydreamjob.job.dto;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
/**
* 创建/编辑岗位的请求 DTO
*/
@Data
public class JobCreateRequest {
@NotBlank(message = "job title is required")
@Size(max = 120, message = "title must be at most 120 characters")
private String title;
@NotBlank(message = "job description is required")
private String description;
private String requirements;
@NotBlank(message = "city is required")
@Size(max = 80, message = "city must be at most 80 characters")
private String city;
@NotBlank(message = "employment type is required")
@Size(max = 30, message = "employment type must be at most 30 characters")
private String employmentType;
@Schema(description = "最低月薪,单位元/月")
private Integer salaryMin;
@Schema(description = "最高月薪,单位元/月")
private Integer salaryMax;
@Size(max = 40, message = "experience must be at most 40 characters")
@Schema(types = {"string", "null"}, maxLength = 40,
description = "经验要求,≤40 字符。缺省/null:创建存 NULL;空串或纯空白清空为 NULL;"
+ "非空去两端空白后保存;超过 40 字符拒绝且不截断。")
private String experience;
@Size(max = 40, message = "education must be at most 40 characters")
@Schema(types = {"string", "null"}, maxLength = 40,
description = "学历要求,≤40 字符。缺省/null:创建存 NULL;空串或纯空白清空为 NULL;"
+ "非空去两端空白后保存;超过 40 字符拒绝且不截断。")
private String education;
@Schema(types = {"array", "null"}, extensions = @Extension(name = "x-normalization", properties = {
@ExtensionProperty(name = "trimItems", value = "true", parseValue = true),
@ExtensionProperty(name = "deduplicate", value = "true", parseValue = true),
@ExtensionProperty(name = "rejectBlankItems", value = "true", parseValue = true),
@ExtensionProperty(name = "maxItems", value = "20", parseValue = true),
@ExtensionProperty(name = "itemMaxLength", value = "40", parseValue = true)}),
description = "福利标签:字符串数组,最多 20 项(在去重并去除首尾空白之后计算)、trim后单项 ≤40 字符;"
+ "null 或缺省:创建时不设置(存 NULL);传 [] 表示清空;非空数组会逐项 trim、拒绝空白项、"
+ "去重保序、超 20 项或单项超 40 字符一律 400。")
private List<String> benefits;
/** 薪资月数:只接受 JSON 整数,范围 1—24;小数/字符串/布尔等一律 400(见 StrictIntegerDeserializer)。 */
@Schema(types = {"integer", "null"},
description = "薪资月数;仅接受 JSON 整数 1—24,非整数(小数/字符串/布尔等)一律 400;"
+ "缺省/null 表示不设置(创建存 NULL)。",
minimum = "1", maximum = "24")
@JsonDeserialize(using = StrictIntegerDeserializer.class)
private Integer salaryMonths;
@Size(max = 255, message = "work location must be at most 255 characters")
@Schema(types = {"string", "null"}, maxLength = 255,
description = "工作地点,≤255 字符。缺省/null:创建存 NULL;空串或纯空白清空为 NULL;"
+ "非空去两端空白后保存;超过 255 字符拒绝且不截断。")
private String workLocation;
}