//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 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 list = photovoltaicEntityService.list( // 1, // 1000, // null, // getUserId() // ); // List 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 list = photovoltaicEntityService.list( // 1, // 1000, // null, // getUserId() // ); // List 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); // } //} //