sinake
6 天以前 fa6ed957f78c1ef9182aa8147a60293616f59343
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
package com.ruoyi.web.controller.common;
 
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.domain.BaseAnnextype;
import com.ruoyi.project.service.IBaseAnnextypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Random;
 
@Slf4j
@Api(description = "外链")
@RestController
@RequestMapping("/GiLink")
public class GiLinkController {
    @Autowired
    private IBaseAnnextypeService baseAnnextypeService;
 
    @ApiOperation("新增")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BaseAnnextype baseAnnextype) {
        Random rand = new Random(4);
        String hexString = String.format("%x", rand.nextInt());
        boolean save = baseAnnextypeService.save(baseAnnextype);
        return AjaxResult.success(baseAnnextype);
    }
 
 
    @ApiOperation("代码获取信息")
    @GetMapping(value = "/getCode")
    public AjaxResult getCode(Long id) {
 
        return AjaxResult.success(baseAnnextypeService.getById(id));
    }
 
}