| | |
| | | package org.springblade.mdm.basesetting.machine.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.mdm.basesetting.machine.MachineService; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineExcelVO; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineQueryVO; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineSaveVO; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineVO; |
| | | import org.springblade.system.pojo.entity.User; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @Operation(summary = "修改", description = "机床组信息") |
| | | @Operation(summary = "修改", description = "机床信息") |
| | | @PostMapping("/update") |
| | | public R<Boolean> update(@RequestBody MachineSaveVO vo) { |
| | | |
| | | return R.<Boolean>status(service.updateMachine(vo)); |
| | | } |
| | | |
| | | @Operation(summary = "详情", description = "查询机床详情") |
| | | @GetMapping("/detail") |
| | | public R<MachineVO> deatail(long id) { |
| | | return R.data(service.detail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "分页查询", description = "名称或编码") |
| | | @GetMapping("/page") |
| | | public R<IPage<MachineVO>> page(MachineQueryVO query) { |
| | | |
| | | |
| | | IPage<MachineVO> pages = service.pageQuery(query); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @GetMapping("export") |
| | | @ApiOperationSupport(order = 13) |
| | | @Operation(summary = "导出机床", description = "名称或编码") |
| | | public void exportUser(MachineQueryVO query, HttpServletResponse response) { |
| | | query.setCurrent(1); |
| | | query.setSize(Integer.MAX_VALUE); |
| | | IPage<MachineVO> pages = service.pageQuery(query); |
| | | |
| | | List<MachineExcelVO> list = new ArrayList<>(); |
| | | pages.getRecords().forEach(m ->{ |
| | | MachineExcelVO excelVO = new MachineExcelVO(); |
| | | BeanUtils.copyProperties(m, excelVO); |
| | | list.add(excelVO); |
| | | }); |
| | | |
| | | ExcelUtil.export(response, "机床数据" + DateUtil.time(), "用户数据表", list, MachineExcelVO.class); |
| | | } |
| | | |
| | | @Operation(summary = "产生机床回传结构树", description = "产生机床回传结构树") |
| | | @PostMapping("/gen-fileback-dirs") |
| | | public R<Void> genFileBackDirs(@RequestParam Long id) { |
| | | try { |
| | | service.genMachineFileBackDirs(id); |
| | | } catch (Exception e) { |
| | | log.error("产生目录异常",e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.status(true); |
| | | } |
| | | } |