package db import ( "context" "youngee_b_api/model/gorm_model" ) // CreateJob 新建岗位 func CreateJob(ctx context.Context, job gorm_model.YounggeeJob) error { db := GetWriteDB(ctx) err := db.Create(&job).Error if err != nil { return err } return nil } // UpdateJob 更新岗位 func UpdateJob(ctx context.Context, job gorm_model.YounggeeJob) error { db := GetWriteDB(ctx) whereCondition := gorm_model.YounggeeJob{JobId: job.JobId} err := db.Model(&gorm_model.YounggeeJob{}).Where(whereCondition).Updates(job).Error if err != nil { return err } return nil } // DeleteJob 删除岗位 func DeleteJob(ctx context.Context, job gorm_model.YounggeeJob) error { db := GetWriteDB(ctx) whereCondition := gorm_model.YounggeeJob{JobId: job.JobId} err := db.Where(whereCondition).Delete(&gorm_model.YounggeeJob{}).Error if err != nil { return err } return nil }