whycrzg
2021-02-20 aa885eba07f4b84390922b4b146d1806676293c0
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
package com.fgkj.controller;
 
import com.fgkj.dto.Chart_Color;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_inf;
import com.fgkj.services.Chart_ColorService;
import com.fgkj.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
@RequestMapping("chartColor")
@RestController
@Api(tags = "chartColor接口")
public class Chart_ColorController{
 
    @Resource
    private Chart_ColorService service;
 
    //修改用户的颜色组
    @PutMapping("/")
    @ApiOperation(notes = "",value="修改用户的颜色组")
    public ServiceModel update(@RequestBody Chart_Color ccolor) {
        // Chart_Color ccolor=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Chart_Color.class);
        Object obj = ActionUtil.getUser();
        ServiceModel model = new ServiceModel();
        if(obj != null){
            User_inf user = (User_inf)obj;
            ccolor.setuId(user.getuId());
            model=service.update(ccolor);
        }else{
            model.setCode(0);
            model.setMsg("失败,用户未登录");
        }
 
        return model;
    }
 
    //查询用户对应得颜色组
    @GetMapping("byCondition")
    @ApiOperation(notes = "",value="查询用户对应得颜色组")
    public ServiceModel serchByCondition() {
        User_inf user = (User_inf) ActionUtil.getUser();
        ServiceModel model = new ServiceModel();
        if(user!=null){
            Chart_Color ccolor = new Chart_Color();
            ccolor.setuId(user.getuId());
            model = service.serchByCondition(ccolor);
        }else{
            model.setCode(0);
            model.setMsg("失败,用户未登录");
        }
 
        return model;
    }
 
}