Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/recruitment/dto/create-recruitment.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
IsNotEmpty,
IsOptional,
IsString,
IsEmail,
} from 'class-validator';

/**
Expand All @@ -15,6 +16,21 @@ export class CreateRecruitmentDto {
@IsNotEmpty({ message: '用户ID不能为空' })
userId: number;

/**
* 邮件地址
*/
@IsString({ message: '邮件地址必须是字符串' })
@IsNotEmpty({ message: '邮件地址不能为空' })
@IsEmail({}, { message: '邮件地址格式不正确' })
email: string;

/**
* 电话号
*/
@IsString({ message: '手机号必须是字符串' })
@IsNotEmpty({ message: '手机号不能为空' })
phone: string;

/**
* 求职类型
* 1: 前端部门, 2: UI部门, 3: 办公部门
Expand Down
17 changes: 17 additions & 0 deletions src/recruitment/dto/query-recruitment.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
Min,
Max,
IsDateString,
IsString,
IsEmail,
} from 'class-validator';
import { Type } from 'class-transformer';

Expand Down Expand Up @@ -65,4 +67,19 @@ export class QueryRecruitmentDto {
@IsOptional()
@IsDateString({}, { message: '结束时间格式不正确,应为ISO格式的日期字符串' })
endTime?: string;

/**
* 邮件地址(支持模糊查询)
*/
@IsOptional()
@IsString({ message: '邮件地址必须是字符串' })
@IsEmail({}, { message: '邮件地址格式不正确' })
email?: string;

/**
* 电话号码(支持模糊查询)
*/
@IsOptional()
@IsString({ message: '电话号码必须是字符串' })
phone?: string;
}
12 changes: 12 additions & 0 deletions src/recruitment/dto/recruitment-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ export class RecruitmentResponseDto {
*/
updateTime: Date;

/**
* 邮件地址
*/
email: string;

/**
* 电话号码
*/
phone: string;

constructor(recruitment: RecruitmentEntity) {
this.officialResumeId = recruitment.officialResumeId;
this.userId = recruitment.userId;
Expand All @@ -67,6 +77,8 @@ export class RecruitmentResponseDto {
this.resumeFilePath = recruitment.resumeFilePath;
this.createTime = recruitment.createTime;
this.updateTime = recruitment.updateTime;
this.email = recruitment.email;
this.phone = recruitment.phone;
}

/**
Expand Down
18 changes: 18 additions & 0 deletions src/recruitment/entities/recruiment.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ export class RecruitmentEntity {
})
officialFeedbackInfromation: string;

// email
@Column({
name: "email",
nullable: true,
type: "varchar",
default: "",
})
email: string;

// 电话号
@Column({
name: "phone",
nullable: true,
type: "varchar",
default: "",
})
phone: string;

// 简历文件地址
@Column({
name: "resume_file_path",
Expand Down
2 changes: 2 additions & 0 deletions src/recruitment/recruitment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export class RecruitmentController {
* Body: {
* "userId": 1,
* "recrType": 1,
* "email": "example@example.com",
* "phone": "13800138000",
* "resumeFilePath": "/uploads/resumes/resume.pdf"
* }
*/
Expand Down
12 changes: 12 additions & 0 deletions src/recruitment/recruitment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export class RecruitmentService {
status,
startTime,
endTime,
email,
phone,
} = query;
const skip = (page - 1) * limit;

Expand All @@ -71,6 +73,16 @@ export class RecruitmentService {
queryBuilder.andWhere('recruitment.officialResumeStatus = :status', { status });
}

// 根据邮箱过滤
if (email) {
queryBuilder.andWhere('recruitment.email LIKE :email', { email: `%${email}%` });
}

// 根据电话过滤
if (phone) {
queryBuilder.andWhere('recruitment.phone LIKE :phone', { phone: `%${phone}%` });
}

// 根据时间范围过滤
if (startTime && endTime) {
queryBuilder.andWhere(
Expand Down
Loading