Van333
2022-12-29 d8f66b834134f6b755fd3fb93bb91b56f9d31f6f
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//package api;
//
//
//import com.baomidou.mybatisplus.extension.api.ApiController;
//import com.github.pagehelper.PageInfo;
//import io.machine.common.utils.R;
//import io.machine.modules.photovoltaic.entity.PhotovoltaicEntity;
//import io.machine.modules.photovoltaic.service.PhotovoltaicEntityService;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import java.io.Serializable;
//import java.util.*;
//import java.util.stream.Collectors;
//
//import static io.machine.common.utils.ShiroUtils.getUserId;
//
///**
// * (PhotovoltaicEntity)表控制层
// *
// * @author makejava
// * @since 2022-09-28 17:35:48
// */
//@RestController
//@RequestMapping("photovoltaic")
//public class PhotovoltaicEntityController extends ApiController {
//    /**
//     * 服务对象
//     */
//    @Resource
//    private PhotovoltaicEntityService photovoltaicEntityService;
//
//    /**
//     * 分页查询所有数据
//     *
//     * @return 所有数据
//     */
//    @RequestMapping("/list")
//    public R selectAll(@RequestBody Map map) {
//        PageInfo<PhotovoltaicEntity> pageInfo = photovoltaicEntityService.list(
//                (Integer) map.get("page"),
//                (Integer) map.get("size"),
//                (String) map.get("key"),
//                getUserId()
//        );
//        return R.ok().put("page", pageInfo);
//    }
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @PostMapping("{id}")
//    public R selectOne(@PathVariable Serializable id) {
//        return R.ok().put("data",this.photovoltaicEntityService.getById(id));
//    }
//
//    /**
//     * 新增数据
//     *
//     * @param photovoltaicEntity 实体对象
//     * @return 新增结果
//     */
//    @PostMapping("save")
//    public R insert(@RequestBody PhotovoltaicEntity photovoltaicEntity) {
//        photovoltaicEntity.setCreateTime(new Date());
//        photovoltaicEntity.setUpdateTime(new Date());
//
//        photovoltaicEntity.setCreateUserId(getUserId());
//        String result = "保存失败";
//        if (this.photovoltaicEntityService.save(photovoltaicEntity)){
//            result = "保存成功";
//        }
//        return R.ok().put("data",result);
//    }
//
//    /**
//     * 修改数据
//     *
//     * @param photovoltaicEntity 实体对象
//     * @return 修改结果
//     */
//    @PostMapping("update")
//    public R update(@RequestBody PhotovoltaicEntity photovoltaicEntity) {
//
//        photovoltaicEntity.setUpdateTime(new Date());
//        String result = "修改失败";
//
//        PageInfo<PhotovoltaicEntity> list = photovoltaicEntityService.list(
//                1,
//                1000,
//                null,
//                getUserId()
//        );
//        List<Integer> haslist = list.getList().stream().map(PhotovoltaicEntity::getPhotovoltaicId).collect(Collectors.toList());
//
//
//        if (!haslist.containsAll(Collections.singleton(photovoltaicEntity.getPhotovoltaicId()))){
//            result = "请检查PhotovoltaicId是否合法";
//        }
//        if (this.photovoltaicEntityService.updateById(photovoltaicEntity)){
//            result = "修改成功";
//        }
//        return R.ok().put("data",result);
//    }
//
//    /**
//     * 删除数据
//     *
//     * @param ids 主键结合
//     * @return 删除结果
//     */
//    @PostMapping("delete")
//    public R delete(@RequestBody Long[] ids) {
//
//        String result = "删除失败";
//
//        PageInfo<PhotovoltaicEntity> list = photovoltaicEntityService.list(
//                1,
//                1000,
//                null,
//                getUserId()
//        );
//        List<Integer> haslist = list.getList().stream().map(PhotovoltaicEntity::getPhotovoltaicId).collect(Collectors.toList());
//
//
//        if (!haslist.containsAll(Arrays.asList(ids))){
//            result = "请检查ids是否合法";
//        }
//        if (this.photovoltaicEntityService.removeByIds(Arrays.asList(ids))){
//            result = ids.clone().toString()+"删除成功";
//        }
//        return R.ok().put("data",result);
//    }
//}
//