¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationStandardEnum; |
| | | import org.jeecg.modules.eam.entity.EamMaintenanceStandard; |
| | | import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard; |
| | | import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationStandardRequest; |
| | | import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationStandardService; |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @Description: ææ¯ç¶æé´å®è§è |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-07 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "ææ¯ç¶æé´å®è§è") |
| | | @RestController |
| | | @RequestMapping("/eam/eamTechnicalStatusEvaluationStandard") |
| | | public class EamTechnicalStatusEvaluationStandardController extends JeecgController<EamTechnicalStatusEvaluationStandard, IEamTechnicalStatusEvaluationStandardService> { |
| | | @Autowired |
| | | private IEamTechnicalStatusEvaluationStandardService eamTechnicalStatusEvaluationStandardService; |
| | | @Autowired |
| | | private ISysBusinessCodeRuleService businessCodeRuleService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param eamTechnicalStatusEvaluationStandard |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "ææ¯ç¶æé´å®è§è-å页å表æ¥è¯¢", notes = "ææ¯ç¶æé´å®è§è-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamTechnicalStatusEvaluationStandard eamTechnicalStatusEvaluationStandard, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | Page<EamTechnicalStatusEvaluationStandard> page = new Page<>(pageNo, pageSize); |
| | | IPage<EamTechnicalStatusEvaluationStandard> pageList = eamTechnicalStatusEvaluationStandardService.queryPageList(page, eamTechnicalStatusEvaluationStandard); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "ææ¯ç¶æé´å®è§è-æ·»å ") |
| | | @ApiOperation(value = "ææ¯ç¶æé´å®è§è-æ·»å ", notes = "ææ¯ç¶æé´å®è§è-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamTechnicalStatusEvaluationStandardRequest request) { |
| | | if (request == null) { |
| | | return Result.error("æ·»å ç对象ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | if (CollectionUtil.isEmpty(request.getTableDetailList())) { |
| | | return Result.error("æ£æ¥é¡¹ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE); |
| | | request.setStandardCode(codeSeq); |
| | | boolean b = eamTechnicalStatusEvaluationStandardService.addEamTechnicalStatusEvaluationStandard(request); |
| | | if (!b) { |
| | | return Result.error("æ·»å 失败ï¼"); |
| | | } |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "ææ¯ç¶æé´å®è§è-ç¼è¾") |
| | | @ApiOperation(value = "ææ¯ç¶æé´å®è§è-ç¼è¾", notes = "ææ¯ç¶æé´å®è§è-ç¼è¾") |
| | | @PutMapping(value = "/edit") |
| | | public Result<?> edit(@RequestBody EamTechnicalStatusEvaluationStandardRequest request) { |
| | | if (request == null) { |
| | | return Result.error("æ·»å ç对象ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | if (CollectionUtil.isEmpty(request.getTableDetailList())) { |
| | | return Result.error("æ£æ¥é¡¹ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | boolean b = eamTechnicalStatusEvaluationStandardService.editEamTechnicalStatusEvaluationStandard(request); |
| | | if (!b) { |
| | | return Result.error("ç¼è¾å¤±è´¥ï¼"); |
| | | } |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | | /** |
| | | * åç |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "ææ¯ç¶æé´å®è§è-åç") |
| | | @ApiOperation(value = "ææ¯ç¶æé´å®è§è-åç", notes = "ææ¯ç¶æé´å®è§è-åç") |
| | | @PutMapping(value = "/upgrade") |
| | | public Result<?> upgrade(@RequestBody EamTechnicalStatusEvaluationStandardRequest request) { |
| | | if (request == null) { |
| | | return Result.error("æ·»å ç对象ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | if (CollectionUtil.isEmpty(request.getTableDetailList())) { |
| | | return Result.error("ä¿å
»é¡¹ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE); |
| | | request.setStandardCode(codeSeq); |
| | | boolean b = eamTechnicalStatusEvaluationStandardService.upgrade(request); |
| | | if (!b) { |
| | | return Result.error("åç失败ï¼"); |
| | | } |
| | | return Result.OK("åçæå!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "ææ¯ç¶æé´å®è§è-éè¿idæ¥è¯¢") |
| | | @ApiOperation(value = "ææ¯ç¶æé´å®è§è-éè¿idæ¥è¯¢", notes = "ææ¯ç¶æé´å®è§è-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | EamTechnicalStatusEvaluationStandard eamTechnicalStatusEvaluationStandard = eamTechnicalStatusEvaluationStandardService.getById(id); |
| | | return Result.OK(eamTechnicalStatusEvaluationStandard); |
| | | } |
| | | |
| | | /** |
| | | * æäº¤ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "ææ¯ç¶æé´å®è§è-æäº¤") |
| | | @ApiOperation(value = "ææ¯ç¶æé´å®è§è-æäº¤", notes = "ææ¯ç¶æé´å®è§è-æäº¤") |
| | | @GetMapping(value = "/submit") |
| | | public Result<?> submit(@RequestParam(name = "id", required = true) String id) { |
| | | EamTechnicalStatusEvaluationStandard entity = eamTechnicalStatusEvaluationStandardService.getById(id); |
| | | if (entity != null) { |
| | | entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.ENABLE.name()); |
| | | eamTechnicalStatusEvaluationStandardService.updateById(entity); |
| | | } |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿excel导å
¥æ°æ® |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EamTechnicalStatusEvaluationStandard.class); |
| | | } |
| | | |
| | | } |