¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentFaultReason; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentFaultReasonService; |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: è®¾å¤æ
éåå ç»´æ¤ |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-03-19 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags="è®¾å¤æ
éåå ç»´æ¤") |
| | | @RestController |
| | | @RequestMapping("/eam/equipmentFaultReason") |
| | | public class EamEquipmentFaultReasonController extends JeecgController<EamEquipmentFaultReason, IEamEquipmentFaultReasonService> { |
| | | @Autowired |
| | | private IEamEquipmentFaultReasonService eamEquipmentFaultReasonService; |
| | | |
| | | @Autowired |
| | | private ISysBusinessCodeRuleService businessCodeRuleService; |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param eamEquipmentFaultReason |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="è®¾å¤æ
éåå ç»´æ¤-å页å表æ¥è¯¢", notes="è®¾å¤æ
éåå ç»´æ¤-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamEquipmentFaultReason eamEquipmentFaultReason, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EamEquipmentFaultReason> queryWrapper = QueryGenerator.initQueryWrapper(eamEquipmentFaultReason, req.getParameterMap()); |
| | | queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0); |
| | | Page<EamEquipmentFaultReason> page = new Page<EamEquipmentFaultReason>(pageNo, pageSize); |
| | | IPage<EamEquipmentFaultReason> pageList = eamEquipmentFaultReasonService.page(page, queryWrapper); |
| | | List<EamEquipmentFaultReason> records = pageList.getRecords(); |
| | | records.forEach(r ->{ |
| | | r.setText(r.getFaultName()); |
| | | r.setValue(r.getId()); |
| | | }); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param eamEquipmentFaultReason |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="è®¾å¤æ
éåå ç»´æ¤-æ·»å ", notes="è®¾å¤æ
éåå ç»´æ¤-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamEquipmentFaultReason eamEquipmentFaultReason) { |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.EQUIPMENT_FAULT_REASON_RULE); |
| | | eamEquipmentFaultReason.setFaultCode(codeSeq); |
| | | eamEquipmentFaultReason.setDelFlag(CommonConstant.DEL_FLAG_0); |
| | | eamEquipmentFaultReasonService.save(eamEquipmentFaultReason); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param eamEquipmentFaultReason |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="è®¾å¤æ
éåå ç»´æ¤-ç¼è¾", notes="è®¾å¤æ
éåå ç»´æ¤-ç¼è¾") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamEquipmentFaultReason eamEquipmentFaultReason) { |
| | | eamEquipmentFaultReasonService.updateById(eamEquipmentFaultReason); |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idå é¤ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="è®¾å¤æ
éåå ç»´æ¤-éè¿idå é¤", notes="è®¾å¤æ
éåå ç»´æ¤-éè¿idå é¤") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
| | | eamEquipmentFaultReasonService.removeById(id); |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="è®¾å¤æ
éåå ç»´æ¤-æ¹éå é¤", notes="è®¾å¤æ
éåå ç»´æ¤-æ¹éå é¤") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.eamEquipmentFaultReasonService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("æ¹éå 餿åï¼"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="è®¾å¤æ
éåå ç»´æ¤-éè¿idæ¥è¯¢", notes="è®¾å¤æ
éåå ç»´æ¤-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
| | | EamEquipmentFaultReason eamEquipmentFaultReason = eamEquipmentFaultReasonService.getById(id); |
| | | return Result.OK(eamEquipmentFaultReason); |
| | | } |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * |
| | | * @param request |
| | | * @param eamEquipmentFaultReason |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamEquipmentFaultReason eamEquipmentFaultReason) { |
| | | return super.exportXls(request, eamEquipmentFaultReason, EamEquipmentFaultReason.class, "è®¾å¤æ
éåå ç»´æ¤"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿excel导å
¥æ°æ® |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EamEquipmentFaultReason.class); |
| | | } |
| | | |
| | | } |