无关风月
2024-06-15 80b5033b8d5b918c7ca2523bc2a69139c2bab438
ruoyi-service/ruoyi-management/src/main/java/com/ruoyi/management/controller/TSysSetController.java
@@ -53,30 +53,34 @@
    public AjaxResult getSysSet() {
        TSysSet byId = sysSetService.getById(1);
        SysSetVO sysSetVO = new SysSetVO();
        BeanUtils.copyProperties(byId,sysSetVO);
        BeanUtils.copyProperties(byId, sysSetVO);
        return AjaxResult.success(sysSetVO);
    }
    @ApiOperation(value = "保存系统设置", tags = {"后台-系统设置"})
    @PostMapping(value = "/saveSysSet")
    public AjaxResult saveSysSet(SysSetVO vo) {
        TSysSet byId = sysSetService.getById(1);
        BeanUtils.copyProperties(vo,byId);
        BeanUtils.copyProperties(vo, byId);
        byId.setId(1);
        sysSetService.updateById(byId);
        return AjaxResult.success("保存成功");
    }
    @ApiOperation(value = "获取启动页", tags = {"后台-启动页管理"})
    @PostMapping(value = "/getPage")
    public AjaxResult getPage() {
        List<TPage> list = pageService.list();
        return AjaxResult.success(list);
    }
    @ApiOperation(value = "获取注意事项、启动页", tags = {"家长端-获取注意事项、启动页"})
    @PostMapping(value = "/getPage1")
    public R<List<TPage>> getPage1() {
        List<TPage> list = pageService.list();
        return R.ok(list);
    }
    @ApiOperation(value = "保存启动页", tags = {"后台-启动页管理"})
    @PostMapping(value = "/setPage")
    public AjaxResult setPage(@RequestBody PageVO vo) {
@@ -84,89 +88,92 @@
        String page2 = vo.getPage2();
        String page3 = vo.getPage3();
        String page4 = vo.getPage4();
        if (StringUtils.hasLength(page1)){
        if (StringUtils.hasLength(page1)) {
            TPage type = pageService.getOne(new QueryWrapper<TPage>()
                    .eq("type", 1));
            TPage tPage = new TPage();
            if (type == null){
            if (type == null) {
                tPage.setImg(page1);
                tPage.setType(1);
                pageService.save(tPage);
            }else{
            } else {
                type.setImg(page1);
                pageService.updateById(type);
            }
        }
        if (StringUtils.hasLength(page2)){
        if (StringUtils.hasLength(page2)) {
            TPage type = pageService.getOne(new QueryWrapper<TPage>()
                    .eq("type", 2));
            TPage tPage = new TPage();
            if (type == null){
            if (type == null) {
                tPage.setImg(page2);
                tPage.setType(2);
                pageService.save(tPage);
            }else{
            } else {
                type.setImg(page2);
                pageService.updateById(type);
            }
        }
        if (StringUtils.hasLength(page3)){
        if (StringUtils.hasLength(page3)) {
            TPage type = pageService.getOne(new QueryWrapper<TPage>()
                    .eq("type", 3));
            TPage tPage = new TPage();
            if (type == null){
            if (type == null) {
                tPage.setImg(page3);
                tPage.setType(3);
                pageService.save(tPage);
            }else{
            } else {
                type.setImg(page3);
                pageService.updateById(type);
            }
        }
        if (StringUtils.hasLength(page4)){
        if (StringUtils.hasLength(page4)) {
            TPage type = pageService.getOne(new QueryWrapper<TPage>()
                    .eq("type", 4));
            if (type == null){
            if (type == null) {
                TPage tPage = new TPage();
                tPage.setImg(page4);
                tPage.setType(4);
                pageService.save(tPage);
            }else{
            } else {
                type.setImg(page4);
                pageService.updateById(type);
            }
        }
        return AjaxResult.success("保存成功");
    }
    @PostMapping("/agreement")
    @ApiOperation(value = "协议", tags = {"后台-协议管理"})
    public AjaxResult agreement(@RequestBody AggrementDTO dto) {
        TProtocol protocol = protocolService.getById(dto.getType());
        if(StringUtils.hasLength(dto.getContent())){
        if (StringUtils.hasLength(dto.getContent())) {
            protocol.setContent(dto.getContent());
            protocolService.updateById(protocol);
            return AjaxResult.success("修改成功");
        }else{
        } else {
            return AjaxResult.success(protocol.getContent());
        }
    }
    @PostMapping("/agreement1/{type}")
    @ApiOperation(value = "协议", tags = {"家长端/学习端-获取协议"})
    public R<String>  agreement1(@PathVariable("type") Integer type) {
    public R<String> agreement1(@PathVariable("type") Integer type) {
        TProtocol protocol = protocolService.getOne(new QueryWrapper<TProtocol>()
                .eq("type",type));
                .eq("type", type));
        return R.ok(protocol.getContent());
    }
    @PostMapping("/useGuide")
    @ApiOperation(value = "使用指南-列表查询", tags = {"后台-使用指南"})
    public AjaxResult<PageInfo<TUseGuide>> agreement(String title, Integer pageNumber, Integer pageSize) {
        QueryWrapper<TUseGuide> wrapper = new QueryWrapper<>();
        if (StringUtils.hasLength(title)){
            wrapper.like("title",title);
        if (StringUtils.hasLength(title)) {
            wrapper.like("title", title);
        }
        List<String> strings = new ArrayList<>();
        strings.add("insertTime");
@@ -178,13 +185,14 @@
        res.setTotal(useGuides.size());
        return AjaxResult.success(res);
    }
    @PostMapping("/useGuide1")
    @ApiOperation(value = "列表查询", tags = {"家长端-使用指南"})
    public R<PageInfo<TUseGuide>> useGuide1(@RequestBody UseGuideQuery query) {
        query.setPageNumber((query.getPageNumber() - 1) * query.getPageSize());
        QueryWrapper<TUseGuide> wrapper = new QueryWrapper<>();
        if (StringUtils.hasLength(query.getTitle())){
            wrapper.like("title",query.getTitle());
        if (StringUtils.hasLength(query.getTitle())) {
            wrapper.like("title", query.getTitle());
        }
        List<String> strings = new ArrayList<>();
        strings.add("insertTime");
@@ -203,7 +211,7 @@
    @PostMapping("/updateUseGuide")
    @ApiOperation(value = "使用指南-添加/编辑/查看详情", tags = {"使用指南"})
    public AjaxResult<TUseGuide> updateUseGuide(@RequestBody UseGuidDTO dto) {
        switch (dto.getType()){
        switch (dto.getType()) {
            case 1:
                TUseGuide useGuide = new TUseGuide();
                useGuide.setTitle(dto.getTitle());
@@ -226,9 +234,10 @@
        }
        return AjaxResult.success(new TUseGuide());
    }
    @DeleteMapping("/delete")
    @ApiOperation(value = "使用指南-删除", tags = {"使用指南"})
    public AjaxResult updateUseGuide( Integer id) {
    public AjaxResult updateUseGuide(Integer id) {
//        TUseGuide useGuide2 = useGuideService.getById(id);
        useGuideService.removeById(id);
        return AjaxResult.success("删除成功");
@@ -240,5 +249,11 @@
        return R.ok(sysSetService.lambdaQuery().one());
    }
    @ApiOperation(value = "获取正确及错误提示音效", tags = {"学习端-首页"})
    @GetMapping(value = "/promptVoice")
    public R<TSysSet> promptVoice() {
        return R.ok(sysSetService.lambdaQuery().eq(TSysSet::getDisabled, 0).one());
    }
}