办学质量监测教学评价系统
ageer
2025-03-02 1385b165c9a62a486b4494ebb11320d3c1117a5e
ruoyi-modules/ruoyi-fusion/src/main/java/org/ruoyi/fusion/controller/VoiceController.java
@@ -1,31 +1,19 @@
package org.ruoyi.fusion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.ruoyi.common.core.domain.R;
import org.ruoyi.common.core.validate.EditGroup;
import org.ruoyi.common.log.annotation.Log;
import org.ruoyi.common.log.enums.BusinessType;
import org.ruoyi.common.satoken.utils.LoginHelper;
import org.ruoyi.common.web.core.BaseController;
import org.ruoyi.system.domain.bo.VoiceRoleBo;
import org.ruoyi.system.domain.vo.VoiceRoleVo;
import org.ruoyi.system.request.RoleListDto;
import org.ruoyi.system.request.RoleRequest;
import org.ruoyi.system.request.SimpleGenerateRequest;
import org.ruoyi.system.response.SimpleGenerateDataResponse;
import org.ruoyi.system.response.rolelist.RoleListVO;
import org.ruoyi.system.service.IVoiceRoleService;
import org.springframework.validation.annotation.Validated;
import org.ruoyi.system.response.rolelist.ChatAppStoreVO;
import org.ruoyi.system.service.IChatAppStoreService;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * 配音角色
 * 应用市场
 *
 * @author Lion Li
 * @date 2024-03-19
@@ -35,63 +23,7 @@
@RequestMapping("/system/voice")
public class VoiceController extends BaseController {
    private final IVoiceRoleService voiceRoleService;
    /**
     * 查询配音角色列表
     */
    @GetMapping("/list")
    public List<VoiceRoleVo> list(VoiceRoleBo bo) {
        if(LoginHelper.getUserId() == null){
            return new ArrayList<>();
        }
        bo.setCreateBy(LoginHelper.getUserId());
        return voiceRoleService.queryList(bo);
    }
    /**
     * 获取配音角色详细信息
     *
     * @param id 主键
     */
    @SaCheckPermission("system:role:query")
    @GetMapping("/{id}")
    public R<VoiceRoleVo> getInfo(@NotNull(message = "主键不能为空")
                                       @PathVariable Long id) {
        return R.ok(voiceRoleService.queryById(id));
    }
    /**
     * 新增配音角色
     */
    @Log(title = "配音角色", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public R<Void> add(@RequestBody RoleRequest roleRequest) {
        return toAjax(voiceRoleService.insertByBo(roleRequest));
    }
    /**
     * 修改配音角色
     */
    @SaCheckPermission("system:role:edit")
    @Log(title = "配音角色", businessType = BusinessType.UPDATE)
    @PutMapping()
    public R<Void> edit(@Validated(EditGroup.class) @RequestBody VoiceRoleBo bo) {
        return toAjax(voiceRoleService.updateByBo(bo));
    }
    /**
     * 删除配音角色
     *
     * @param ids 主键串
     */
    @Log(title = "配音角色", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public R<Void> remove(@NotEmpty(message = "主键不能为空")
                          @PathVariable Long[] ids) {
        return toAjax(voiceRoleService.deleteWithValidByIds(List.of(ids), true));
    }
    private final IChatAppStoreService voiceRoleService;
    /**
     * 实时语音生成
@@ -105,7 +37,7 @@
     * 角色市场
     */
    @GetMapping("/roleList")
    public R<List<RoleListVO>> roleList() {
    public R<List<ChatAppStoreVO>> roleList() {
        return R.ok(voiceRoleService.roleList());
    }