44323
2024-05-22 b45c2583b4764edb95efe9880c4abfddb8a1ec21
ruoyi-service/ruoyi-management/src/main/java/com/ruoyi/management/controller/TSysSetController.java
@@ -11,6 +11,7 @@
import com.ruoyi.management.domain.TUseGuide;
import com.ruoyi.management.dto.AggrementDTO;
import com.ruoyi.management.dto.UseGuidDTO;
import com.ruoyi.management.query.UseGuideQuery;
import com.ruoyi.management.service.ITPageService;
import com.ruoyi.management.service.ITProtocolService;
import com.ruoyi.management.service.ITSysSetService;
@@ -20,7 +21,6 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
@@ -101,6 +101,15 @@
            return AjaxResult.success(protocol.getContent());
        }
    }
    @PostMapping("/agreement1/{type}")
    @ApiOperation(value = "协议", tags = {"家长端/学习端-获取协议"})
    public R<String>  agreement1(@PathVariable("type") Integer type) {
        TProtocol protocol = protocolService.getOne(new QueryWrapper<TProtocol>()
                .eq("type",type));
        return R.ok(protocol.getContent());
    }
    @PostMapping("/useGuide")
    @ApiOperation(value = "使用指南-列表查询", tags = {"后台-使用指南"})
    public AjaxResult<PageInfo<TUseGuide>> agreement(String title, Integer pageNumber, Integer pageSize) {
@@ -118,6 +127,23 @@
        res.setTotal(useGuides.size());
        return AjaxResult.success(res);
    }
    @PostMapping("/useGuide1")
    @ApiOperation(value = "列表查询", tags = {"家长端-使用指南"})
    public R<PageInfo<TUseGuide>> useGuide1(@RequestBody UseGuideQuery query) {
        QueryWrapper<TUseGuide> wrapper = new QueryWrapper<>();
        if (StringUtils.hasLength(query.getTitle())){
            wrapper.like("title",query.getTitle());
        }
        List<String> strings = new ArrayList<>();
        strings.add("insertTime");
        wrapper.orderByDesc(strings);
        PageInfo<TUseGuide> res = new PageInfo<>(query.getPageNumber(), query.getPageSize());
        List<TUseGuide> useGuides = useGuideService.list(wrapper);
        res.setRecords(useGuides);
        res.setTotal(useGuides.size());
        return R.ok(res);
    }
    @PostMapping("/updateUseGuide")
    @ApiOperation(value = "使用指南-添加/编辑/查看详情", tags = {"使用指南"})
    public AjaxResult<TUseGuide> updateUseGuide(@RequestBody UseGuidDTO dto) {
@@ -126,7 +152,6 @@
                TUseGuide useGuide = new TUseGuide();
                useGuide.setTitle(dto.getTitle());
                useGuide.setSort(dto.getSort());
                useGuide.setIsDelete(0);
                useGuide.setAnswer(dto.getAnswer());
                useGuide.setInsertTime(new Date());
                useGuideService.save(useGuide);
@@ -145,14 +170,19 @@
        }
        return AjaxResult.success(new TUseGuide());
    }
    @DeleteMapping("/delete{id}")
    @DeleteMapping("/delete")
    @ApiOperation(value = "使用指南-删除", tags = {"使用指南"})
    public AjaxResult updateUseGuide(@PathVariable Integer id) {
        TUseGuide useGuide2 = useGuideService.getById(id);
        useGuide2.setIsDelete(1);
        useGuideService.updateById(useGuide2);
    public AjaxResult updateUseGuide( Integer id) {
//        TUseGuide useGuide2 = useGuideService.getById(id);
        useGuideService.removeById(id);
        return AjaxResult.success("删除成功");
    }
    @GetMapping("/shareInfo")
    @ApiOperation(value = "获取分享图片、标题及可获积分数", tags = {"获取分享图片、标题及可获积分数"})
    public R<TSysSet> shareInfo() {
        return R.ok(sysSetService.lambdaQuery().one());
    }
}