leutu
2024-05-08 7922905e4987789b636abdce1a240f4cee7c971b
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.terra.lfdcexp.controller;
 
import java.util.Arrays;
import java.util.Map;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.terra.lfdcexp.config.R;
import com.terra.lfdcexp.entity.SysUserEntity;
import com.terra.lfdcexp.entity.WeilanMonEntity;
import com.terra.lfdcexp.service.WeilanMonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
 
/**
 * ${comments}
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2023-12-05 16:11:48
 */
@Api(tags = "WeilanMonController")
@RestController
@RequestMapping("generator/weilanmon")
public class WeilanMonController {
    @Autowired
    private WeilanMonService weilanMonService;
 
    /**
     * 列表
     */
    @PostMapping("/list")
 
    @ApiOperation(value = "generator:weilanmon:list", notes = "")
    public R list(@RequestBody WeilanMonEntity params){
 
        if( params != null && params.getFId() != null )
             return R.ok().put("page", weilanMonService.list(new QueryWrapper<WeilanMonEntity>().eq("f_id",params.getFId())));
 
        return R.ok().put("page", weilanMonService.list());
    }
 
 
    /**
     * 信息
     */
    @PostMapping("/info/{id}")
 
    @ApiOperation(value = "generator:weilanmon:info", notes = "")
    public R info(@PathVariable("id") Integer id){
        WeilanMonEntity weilanMon = weilanMonService.getById(id);
 
        return R.ok().put("weilanMon", weilanMon);
    }
 
    /**
     * 保存
     */
    @PostMapping("/save")
 
    @ApiOperation(value = "generator:weilanmon:save", notes = "")
    public R save(@RequestBody WeilanMonEntity weilanMon){
        weilanMonService.save(weilanMon);
 
        return R.ok();
    }
    /**
     * 修改
     */
    @PostMapping("/update")
 
    @ApiOperation(value = "generator:weilanmon:update", notes = "")
    public R update(@RequestBody WeilanMonEntity weilanMon){
        weilanMonService.updateById(weilanMon);
 
        return R.ok();
    }
 
    /**
     * 删除
     */
    @PostMapping("/delete")
 
    @ApiOperation(value = "generator:weilanmon:delete", notes = "")
    public R delete(@RequestBody Integer[] ids){
        weilanMonService.removeByIds(Arrays.asList(ids));
 
        return R.ok();
    }
    @PostMapping("/deleteByString")
 
    @ApiOperation(value = "generator:weilanmon:deleteByString", notes = "")
    public R deleteByString(String ids){
        if( ids == null || ids.split(",").length == 0 ) return  R.error("ids is null");
        weilanMonService.removeByIds(Arrays.asList(ids.split(",")));
 
        return R.ok();
    }
}