package com.aps.core.controller.mainPlan; import java.util.List; import com.aps.common.security.utils.DictUtils; import com.aps.system.api.domain.SysDictData; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.aps.common.log.annotation.Log; import com.aps.common.log.enums.BusinessType; import com.aps.common.security.annotation.RequiresPermissions; import com.aps.core.domain.ApsWeldSeamTemp; import com.aps.core.service.IApsWeldSeamTempService; import com.aps.common.core.web.controller.BaseController; import com.aps.common.core.web.domain.AjaxResult; import com.aps.common.core.utils.poi.ExcelUtil; import com.aps.common.core.web.page.TableDataInfo; /** * 焊缝-临时Controller * * @author wwj * @date 2025-04-09 */ @RestController @RequestMapping("/weldSeamTemp") public class ApsWeldSeamTempController extends BaseController { @Autowired private IApsWeldSeamTempService apsWeldSeamTempService; /** * 查询焊缝-临时列表 */ @GetMapping("/list") public TableDataInfo list(ApsWeldSeamTemp apsWeldSeamTemp) { // startPage(); List list = apsWeldSeamTempService.selectApsWeldSeamTempList(apsWeldSeamTemp); //工单类型 List workOrderTypes = DictUtils.getDictCache("aps_weld_work_order_type"); //分类 List classification = DictUtils.getDictCache("aps_weld_classification"); list.forEach(tmp->{ classification.stream().filter(t->t.getDictValue().equals(tmp.getClassification())) .findFirst().ifPresent(t->{ tmp.setClassification(t.getDictLabel());}) ; workOrderTypes.stream().filter(t->t.getDictValue().equals(tmp.getWorkOrderType())) .findFirst().ifPresent(t->{ tmp.setWorkOrderType(t.getDictLabel());}) ; }); return getDataTable(list); } /** * 导出焊缝-临时列表 */ @RequiresPermissions("weldSeamTemp:weldSeamTemp:export") @Log(title = "焊缝-临时", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ApsWeldSeamTemp apsWeldSeamTemp) { List list = apsWeldSeamTempService.selectApsWeldSeamTempList(apsWeldSeamTemp); ExcelUtil util = new ExcelUtil(ApsWeldSeamTemp.class); util.exportExcel(response, list, "焊缝-临时数据"); } /** * 获取焊缝-临时详细信息 */ @RequiresPermissions("weldSeamTemp:weldSeamTemp:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") String id) { return success(apsWeldSeamTempService.selectApsWeldSeamTempById(id)); } /** * 新增焊缝-临时 */ @RequiresPermissions("weldSeamTemp:weldSeamTemp:add") @Log(title = "焊缝-临时", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ApsWeldSeamTemp apsWeldSeamTemp) { return toAjax(apsWeldSeamTempService.insertApsWeldSeamTemp(apsWeldSeamTemp)); } /** * 修改焊缝-临时 */ @RequiresPermissions("weldSeamTemp:weldSeamTemp:edit") @Log(title = "焊缝-临时", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ApsWeldSeamTemp apsWeldSeamTemp) { return toAjax(apsWeldSeamTempService.updateApsWeldSeamTemp(apsWeldSeamTemp)); } /** * 删除焊缝-临时 */ @RequiresPermissions("weldSeamTemp:weldSeamTemp:remove") @Log(title = "焊缝-临时", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return toAjax(apsWeldSeamTempService.deleteApsWeldSeamTempByIds(ids)); } }