新火炬后端单体项目初始化代码
zhangherong
21 小时以前 399e7d565f19f59a8da82277da8f3eab527c2c56
src/main/java/org/jeecg/modules/mes/controller/MesMaterialLoadingController.java
@@ -1,6 +1,5 @@
package org.jeecg.modules.mes.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;
@@ -9,153 +8,104 @@
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.mes.entity.MesMaterialLoading;
import org.jeecg.modules.mes.service.IMesMaterialLoadingService;
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;
/**
* @Description: 上料
* @Author: jeecg-boot
* @Date:   2025-07-04
* @Version: V1.0
*/
@Api(tags="上料")
 * @Description: 上料
 * @Author: jeecg-boot
 * @Date: 2025-07-07
 * @Version: V1.0
 */
@Api(tags = "上料")
@RestController
@RequestMapping("/mesmaterialloading/mesMaterialLoading")
@RequestMapping("/mes/mesMaterialLoading")
@Slf4j
public class MesMaterialLoadingController extends JeecgController<MesMaterialLoading, IMesMaterialLoadingService> {
   @Autowired
   private IMesMaterialLoadingService mesMaterialLoadingService;
    @Autowired
    private IMesMaterialLoadingService mesMaterialLoadingService;
   /**
    * 分页列表查询
    *
    * @param mesMaterialLoading
    * @param pageNo
    * @param pageSize
    * @param req
    * @return
    */
   //@AutoLog(value = "上料-分页列表查询")
   @ApiOperation(value="上料-分页列表查询", notes="上料-分页列表查询")
   @GetMapping(value = "/list")
   public Result<IPage<MesMaterialLoading>> queryPageList(MesMaterialLoading mesMaterialLoading,
                                  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                  HttpServletRequest req) {
       QueryWrapper<MesMaterialLoading> queryWrapper = QueryGenerator.initQueryWrapper(mesMaterialLoading, req.getParameterMap());
       Page<MesMaterialLoading> page = new Page<MesMaterialLoading>(pageNo, pageSize);
       IPage<MesMaterialLoading> pageList = mesMaterialLoadingService.page(page, queryWrapper);
       return Result.OK(pageList);
   }
    /**
     * 分页列表查询
     *
     * @param mesMaterialLoading
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ApiOperation(value = "上料-分页列表查询", notes = "上料-分页列表查询")
    @GetMapping(value = "/list")
    public Result<IPage<MesMaterialLoading>> queryPageList(MesMaterialLoading mesMaterialLoading,
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        Page<MesMaterialLoading> page = new Page<>(pageNo, pageSize);
        IPage<MesMaterialLoading> pageList = mesMaterialLoadingService.queryPageList(page, mesMaterialLoading);
        return Result.OK(pageList);
    }
   /**
    *   添加
    *
    * @param mesMaterialLoading
    * @return
    */
   @AutoLog(value = "上料-添加")
   @ApiOperation(value="上料-添加", notes="上料-添加")
   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:add")
   @PostMapping(value = "/add")
   public Result<String> add(@RequestBody MesMaterialLoading mesMaterialLoading) {
       mesMaterialLoadingService.save(mesMaterialLoading);
       return Result.OK("添加成功!");
   }
    /**
     *   添加
     *
     * @param mesMaterialLoading
     * @return
     */
    @AutoLog(value = "上料-添加")
    @ApiOperation(value = "上料-添加", notes = "上料-添加")
    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody MesMaterialLoading mesMaterialLoading) {
        boolean b = mesMaterialLoadingService.loading(mesMaterialLoading);
        if (!b) {
            Result.error("上料失败!");
        }
        return Result.OK("上料成功!");
    }
   /**
    *  编辑
    *
    * @param mesMaterialLoading
    * @return
    */
   @AutoLog(value = "上料-编辑")
   @ApiOperation(value="上料-编辑", notes="上料-编辑")
   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:edit")
   @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
   public Result<String> edit(@RequestBody MesMaterialLoading mesMaterialLoading) {
       mesMaterialLoadingService.updateById(mesMaterialLoading);
       return Result.OK("编辑成功!");
   }
    /**
     *  编辑
     *
     * @param mesMaterialLoading
     * @return
     */
    @AutoLog(value = "上料-编辑")
    @ApiOperation(value = "上料-编辑", notes = "上料-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<String> edit(@RequestBody MesMaterialLoading mesMaterialLoading) {
        mesMaterialLoadingService.updateById(mesMaterialLoading);
        return Result.OK("编辑成功!");
    }
   /**
    *   通过id删除
    *
    * @param id
    * @return
    */
   @AutoLog(value = "上料-通过id删除")
   @ApiOperation(value="上料-通过id删除", notes="上料-通过id删除")
   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:delete")
   @DeleteMapping(value = "/delete")
   public Result<String> delete(@RequestParam(name="id",required=true) String id) {
       mesMaterialLoadingService.removeById(id);
       return Result.OK("删除成功!");
   }
    /**
     * 通过id查询
     *
     * @param id
     * @return
     */
    //@AutoLog(value = "上料-通过id查询")
    @ApiOperation(value = "上料-通过id查询", notes = "上料-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<MesMaterialLoading> queryById(@RequestParam(name = "id", required = true) String id) {
        MesMaterialLoading mesMaterialLoading = mesMaterialLoadingService.getById(id);
        if (mesMaterialLoading == null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(mesMaterialLoading);
    }
   /**
    *  批量删除
    *
    * @param ids
    * @return
    */
   @AutoLog(value = "上料-批量删除")
   @ApiOperation(value="上料-批量删除", notes="上料-批量删除")
   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:deleteBatch")
   @DeleteMapping(value = "/deleteBatch")
   public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
       this.mesMaterialLoadingService.removeByIds(Arrays.asList(ids.split(",")));
       return Result.OK("批量删除成功!");
   }
   /**
    * 通过id查询
    *
    * @param id
    * @return
    */
   //@AutoLog(value = "上料-通过id查询")
   @ApiOperation(value="上料-通过id查询", notes="上料-通过id查询")
   @GetMapping(value = "/queryById")
   public Result<MesMaterialLoading> queryById(@RequestParam(name="id",required=true) String id) {
       MesMaterialLoading mesMaterialLoading = mesMaterialLoadingService.getById(id);
       if(mesMaterialLoading==null) {
           return Result.error("未找到对应数据");
       }
       return Result.OK(mesMaterialLoading);
   }
   /**
   * 导出excel
   *
   * @param request
   * @param mesMaterialLoading
   */
   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:exportXls")
   @RequestMapping(value = "/exportXls")
   public ModelAndView exportXls(HttpServletRequest request, MesMaterialLoading mesMaterialLoading) {
       return super.exportXls(request, mesMaterialLoading, MesMaterialLoading.class, "上料");
   }
   /**
     * 通过excel导入数据
   *
   * @param request
   * @param response
   * @return
   */
   //@RequiresPermissions("mes_material_loading:importExcel")
   @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
   public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
       return super.importExcel(request, response, MesMaterialLoading.class);
   }
    /**
     * 通过loadingId查询下料信息
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping("/queryUnloadingByLoadingId")
    public Result<?> queryUnloadingByLoadingId(HttpServletRequest request, HttpServletResponse response) {
        String loadingId = request.getParameter("loadingId");
        return Result.OK(mesMaterialLoadingService.queryUnloadingByLoadingId(loadingId));
    }
}