无关风月
2025-01-22 99367ea1c11a68b420936e7f7db5fa7367da4f44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.xinquan.system.controller;
 
 
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.xinquan.common.core.domain.R;
import com.xinquan.common.log.annotation.Log;
import com.xinquan.common.log.enums.BusinessType;
import com.xinquan.system.api.domain.vo.AppUserVO;
import com.xinquan.system.api.domain.UserLevelSetting;
import com.xinquan.system.api.domain.vo.UpdateUserGroupVO;
import com.xinquan.system.service.UserLevelSettingService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
 
/**
 * <p>
 * 用户等级表 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-08-21
 */
@RestController
@RequestMapping("/system/user-level-setting")
public class UserLevelSettingController {
    @Resource
    private UserLevelSettingService userLevelSettingService;
    /**
     * 远程调用根据树苗等级获取疗愈图标和疗愈名称
     *
     * @return 用户信息
     * @see AppUserVO
     */
    @GetMapping("/getIconNameByLevel/{level}")
    public R<UserLevelSetting> getIconNameByLevel(@PathVariable("level")Integer level) {
        UserLevelSetting one = userLevelSettingService.lambdaQuery()
                .eq(UserLevelSetting::getTreeLevelType, level).one();
        return R.ok(one);
    }
 
    @PostMapping("/updateUserGroup")
    @ApiOperation(value = "修改等级经验值",tags = "管理后台-树苗音频设置")
    @Log(title = "【树苗音频设置】修改", businessType = BusinessType.UPDATE)
    public R updateTreeGroup(@RequestBody UpdateUserGroupVO vo) {
        UserLevelSetting one = userLevelSettingService.lambdaQuery()
                .eq(UserLevelSetting::getTreeLevelType, vo.getTreeLevelType()).one();
        LambdaUpdateWrapper<UserLevelSetting> userLevelSettingLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        userLevelSettingLambdaUpdateWrapper.eq(UserLevelSetting::getId, one.getId());
        userLevelSettingLambdaUpdateWrapper.set(UserLevelSetting::getLevelName,vo.getLevelName());
        userLevelSettingLambdaUpdateWrapper.set(UserLevelSetting::getLevelIcon,vo.getLevelIcon());
        userLevelSettingLambdaUpdateWrapper.set(UserLevelSetting::getUpdateTime, LocalDateTime.now());
        userLevelSettingService.update(userLevelSettingLambdaUpdateWrapper);
        return R.ok();
    }
    @PostMapping("/getUserGroup")
    @ApiOperation(value = "获取等级经验值列表",tags = "管理后台-等级经验值管理")
    public R<List<UserLevelSetting>> getTreeGroup() {
        List<UserLevelSetting> list = userLevelSettingService.lambdaQuery().list();
        return R.ok(list);
    }
}