Parcourir la source

接口路径与拦截排除

chenc il y a 3 ans
Parent
commit
79b1b0f5de

+ 2 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -91,6 +91,8 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token
         filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdf预览
         filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
+        filterChainDefinitionMap.put("/openApi", "anon");//openApi接口排除
+
 
         filterChainDefinitionMap.put("/sys/getLoginQrcode/**", "anon"); //登录二维码
         filterChainDefinitionMap.put("/sys/getQrcodeToken/**", "anon"); //监听扫码

+ 167 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/controller/PurchaseWarehousingController.java

@@ -0,0 +1,167 @@
+package org.jeecg.modules.openApi.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.openApi.entity.PurchaseWarehousing;
+import org.jeecg.modules.openApi.service.IPurchaseWarehousingService;
+import java.util.Date;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * @Description: 采购入库
+ * @Author: jeecg-boot
+ * @Date:   2022-03-31
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags="采购入库")
+@RestController
+@RequestMapping("/openApi/purchaseWarehousing")
+public class PurchaseWarehousingController extends JeecgController<PurchaseWarehousing, IPurchaseWarehousingService> {
+	@Autowired
+	private IPurchaseWarehousingService purchaseWarehousingService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param purchaseWarehousing
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "采购入库-分页列表查询")
+	@ApiOperation(value="采购入库-分页列表查询", notes="采购入库-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<?> queryPageList(PurchaseWarehousing purchaseWarehousing,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<PurchaseWarehousing> queryWrapper = QueryGenerator.initQueryWrapper(purchaseWarehousing, req.getParameterMap());
+		Page<PurchaseWarehousing> page = new Page<PurchaseWarehousing>(pageNo, pageSize);
+		IPage<PurchaseWarehousing> pageList = purchaseWarehousingService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 * 添加
+	 *
+	 * @param purchaseWarehousing
+	 * @return
+	 */
+	@AutoLog(value = "采购入库-添加")
+	@ApiOperation(value="采购入库-添加", notes="采购入库-添加")
+	@PostMapping(value = "/add")
+	public Result<?> add(@RequestBody PurchaseWarehousing purchaseWarehousing) {
+		purchaseWarehousingService.save(purchaseWarehousing);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 * 编辑
+	 *
+	 * @param purchaseWarehousing
+	 * @return
+	 */
+	@AutoLog(value = "采购入库-编辑")
+	@ApiOperation(value="采购入库-编辑", notes="采购入库-编辑")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<?> edit(@RequestBody PurchaseWarehousing purchaseWarehousing) {
+		purchaseWarehousingService.updateById(purchaseWarehousing);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 * 通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "采购入库-通过id删除")
+	@ApiOperation(value="采购入库-通过id删除", notes="采购入库-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		purchaseWarehousingService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 * 批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "采购入库-批量删除")
+	@ApiOperation(value="采购入库-批量删除", notes="采购入库-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.purchaseWarehousingService.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<?> queryById(@RequestParam(name="id",required=true) String id) {
+		PurchaseWarehousing purchaseWarehousing = purchaseWarehousingService.getById(id);
+		return Result.OK(purchaseWarehousing);
+	}
+
+  /**
+   * 导出excel
+   *
+   * @param request
+   * @param purchaseWarehousing
+   */
+  @RequestMapping(value = "/exportXls")
+  public ModelAndView exportXls(HttpServletRequest request, PurchaseWarehousing purchaseWarehousing) {
+      return super.exportXls(request, purchaseWarehousing, PurchaseWarehousing.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, PurchaseWarehousing.class);
+  }
+
+}

+ 103 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/entity/PurchaseWarehousing.java

@@ -0,0 +1,103 @@
+package org.jeecg.modules.openApi.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 采购入库
+ * @Author: jeecg-boot
+ * @Date:   2022-03-31
+ * @Version: V1.0
+ */
+@Data
+@TableName("demo")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="demo对象", description="采购入库")
+public class PurchaseWarehousing {
+    
+	/**主键ID*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键ID")
+	private String id;
+	/**姓名*/
+	@Excel(name = "姓名", width = 15)
+    @ApiModelProperty(value = "姓名")
+	private String name;
+	/**关键词*/
+	@Excel(name = "关键词", width = 15)
+    @ApiModelProperty(value = "关键词")
+	private String keyWord;
+	/**打卡时间*/
+	@Excel(name = "打卡时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "打卡时间")
+	private Date punchTime;
+	/**工资*/
+	@Excel(name = "工资", width = 15)
+    @ApiModelProperty(value = "工资")
+	private java.math.BigDecimal salaryMoney;
+	/**奖金*/
+	@Excel(name = "奖金", width = 15)
+    @ApiModelProperty(value = "奖金")
+	private Double bonusMoney;
+	/**性别 {男:1,女:2}*/
+	@Excel(name = "性别 {男:1,女:2}", width = 15)
+    @ApiModelProperty(value = "性别 {男:1,女:2}")
+	private String sex;
+	/**年龄*/
+	@Excel(name = "年龄", width = 15)
+    @ApiModelProperty(value = "年龄")
+	private Integer age;
+	/**生日*/
+	@Excel(name = "生日", width = 15, format = "yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "生日")
+	private Date birthday;
+	/**邮箱*/
+	@Excel(name = "邮箱", width = 15)
+    @ApiModelProperty(value = "邮箱")
+	private String email;
+	/**个人简介*/
+	@Excel(name = "个人简介", width = 15)
+    @ApiModelProperty(value = "个人简介")
+	private String content;
+	/**创建人*/
+	@Excel(name = "创建人", width = 15)
+    @ApiModelProperty(value = "创建人")
+	private String createBy;
+	/**创建时间*/
+	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**修改人*/
+	@Excel(name = "修改人", width = 15)
+    @ApiModelProperty(value = "修改人")
+	private String updateBy;
+	/**修改时间*/
+	@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+	/**所属部门编码*/
+	@Excel(name = "所属部门编码", width = 15)
+    @ApiModelProperty(value = "所属部门编码")
+	private String sysOrgCode;
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/mapper/PurchaseWarehousingMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.openApi.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.openApi.entity.PurchaseWarehousing;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 采购入库
+ * @Author: jeecg-boot
+ * @Date:   2022-03-31
+ * @Version: V1.0
+ */
+public interface PurchaseWarehousingMapper extends BaseMapper<PurchaseWarehousing> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/mapper/xml/PurchaseWarehousingMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.demo.openApi.mapper.PurchaseWarehousingMapper">
+
+</mapper>

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/IPurchaseWarehousingService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.openApi.service;
+
+import org.jeecg.modules.openApi.entity.PurchaseWarehousing;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 采购入库
+ * @Author: jeecg-boot
+ * @Date:   2022-03-31
+ * @Version: V1.0
+ */
+public interface IPurchaseWarehousingService extends IService<PurchaseWarehousing> {
+
+}

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/PurchaseWarehousingServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.openApi.service.impl;
+
+import org.jeecg.modules.openApi.entity.PurchaseWarehousing;
+import org.jeecg.modules.openApi.mapper.PurchaseWarehousingMapper;
+import org.jeecg.modules.openApi.service.IPurchaseWarehousingService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 采购入库
+ * @Author: jeecg-boot
+ * @Date:   2022-03-31
+ * @Version: V1.0
+ */
+@Service
+public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehousingMapper, PurchaseWarehousing> implements IPurchaseWarehousingService {
+
+}