yanghui
2022-11-17 b30e1a48f2bc5f65a0efd2e69e090fed2d7a627c
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
66
67
68
69
70
71
package com.panzhihua.service_community.api;
 
import javax.annotation.Resource;
 
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.model.dos.SysConfDO;
import com.panzhihua.service_community.service.SysConfService;
 
import lombok.extern.slf4j.Slf4j;
 
@Slf4j
@RestController
@RequestMapping("/sys/conf/")
public class SysConfApi {
 
    @Resource
    private SysConfService sysConfService;
 
    @GetMapping("get")
    public R get(@RequestParam("code") String code) {
        SysConfDO sysConfDO =
            sysConfService.getOne(new QueryWrapper<SysConfDO>().lambda().eq(SysConfDO::getCode, code));
        String value = Constants.ZZ_APP_TAG_LIST;
        if (sysConfDO != null) {
            value = sysConfDO.getValue();
        }
        return R.ok(value);
    }
 
    /**
     * 根据系统code以及社区id查询配置表value值
     *
     * @param key         系统code
     * @param communityId 社区id
     * @return 系统配置value值
     */
    @GetMapping("getSysConfValue")
    public R getSysConfValue(@RequestParam("key") String key,@RequestParam("communityId") Long communityId) {
        return sysConfService.getSysConfValue(key,communityId);
    }
 
    /**
     * 新增系统code配置数据
     *
     * @param key         系统code
     * @param communityId 社区id
     * @return 新增结果
     */
    @GetMapping("addSysConfValue")
    public R addSysConfValue(@RequestParam("key") String key,@RequestParam("communityId") Long communityId,@RequestParam("name") String name,@RequestParam("value") String value) {
        return sysConfService.addSysConfValue(key,communityId,name,value);
    }
 
    /**
     * 编辑系统配置
     * @param communityId   社区id
     * @param status    配置值
     * @return  编辑结果
     */
    @GetMapping("editSysConfValue")
    public R editSysConfValue(@RequestParam("communityId") Long communityId,@RequestParam("status") Integer status) {
        return sysConfService.editSysConfValue(communityId,status);
    }
}