feat: 更新后端skill服务

- 更新 skill_handler.go handler层
- 更新 skill.go model层
- 更新 skill_repo.go repository层
- 更新 skill_service.go service层
- 更新 main.go 入口文件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 15:23:22 +08:00
parent e2c9bbd0d1
commit 414147911a
5 changed files with 163 additions and 43 deletions

View File

@@ -53,8 +53,25 @@ func (r *SkillRepository) FindByName(skillName string) (*model.Skill, error) {
return &skill, nil
}
// Update 更新技能(只更新传入的字段)
func (r *SkillRepository) Update(skill *model.Skill) error {
return r.db.Save(skill).Error
updates := make(map[string]interface{})
if skill.SkillName != "" {
updates["skill_name"] = skill.SkillName
}
if skill.SkillDesc != "" {
updates["skill_desc"] = skill.SkillDesc
}
if skill.SkillType != "" {
updates["skill_type"] = skill.SkillType
}
if skill.Status != "" {
updates["status"] = skill.Status
}
if skill.Path != "" {
updates["path"] = skill.Path
}
return r.db.Model(&model.Skill{}).Where("id = ?", skill.ID).Updates(updates).Error
}
func (r *SkillRepository) Delete(id string) error {