diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/StoreInfoController.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/StoreInfoController.java new file mode 100644 index 0000000..3dd68b7 --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/StoreInfoController.java @@ -0,0 +1,156 @@ +package org.jeecg.modules.demo.erp.controller; + +import java.util.Arrays; +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.modules.demo.erp.entity.StoreInfo; +import org.jeecg.modules.demo.erp.service.IStoreInfoService; + +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 仓库管理 + * @Author: jeecg-boot + * @Date: 2023-06-19 + * @Version: V1.0 + */ +@Api(tags="仓库管理") +@RestController +@RequestMapping("/erp/storeInfo") +@Slf4j +public class StoreInfoController extends JeecgController { + @Autowired + private IStoreInfoService storeInfoService; + + /** + * 分页列表查询 + * + * @param storeInfo + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "仓库管理-分页列表查询") + @ApiOperation(value="仓库管理-分页列表查询", notes="仓库管理-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(StoreInfo storeInfo, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(storeInfo, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = storeInfoService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param storeInfo + * @return + */ + @AutoLog(value = "仓库管理-添加") + @ApiOperation(value="仓库管理-添加", notes="仓库管理-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody StoreInfo storeInfo) { + storeInfoService.save(storeInfo); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param storeInfo + * @return + */ + @AutoLog(value = "仓库管理-编辑") + @ApiOperation(value="仓库管理-编辑", notes="仓库管理-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody StoreInfo storeInfo) { + storeInfoService.updateById(storeInfo); + 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) { + storeInfoService.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.storeInfoService.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) { + StoreInfo storeInfo = storeInfoService.getById(id); + if(storeInfo==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(storeInfo); + } + + /** + * 导出excel + * + * @param request + * @param storeInfo + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, StoreInfo storeInfo) { + return super.exportXls(request, storeInfo, StoreInfo.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, StoreInfo.class); + } + +} diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/entity/StoreInfo.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/entity/StoreInfo.java new file mode 100644 index 0000000..947b995 --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/entity/StoreInfo.java @@ -0,0 +1,86 @@ +package org.jeecg.modules.demo.erp.entity; + +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 仓库管理 + * @Author: jeecg-boot + * @Date: 2023-06-19 + * @Version: V1.0 + */ +@Data +@TableName("store_info") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="store_info对象", description="仓库管理") +public class StoreInfo implements Serializable { + private static final long serialVersionUID = 1L; + + /**id*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + @JsonSerialize(using = ToStringSerializer.class) + private java.lang.Long id; + /**仓库名称*/ + @Excel(name = "仓库名称", width = 15) + @ApiModelProperty(value = "仓库名称") + private java.lang.String name; + /**仓管员*/ + @Excel(name = "仓管员", width = 15) + @ApiModelProperty(value = "仓管员") + private java.lang.String contacts; + /**仓管员id*/ + @Excel(name = "仓管员id", width = 15) + @ApiModelProperty(value = "仓管员id") + private java.lang.String userId; + /**手机号*/ + @Excel(name = "手机号", width = 15) + @ApiModelProperty(value = "手机号") + private java.lang.String phone; + /**仓库地址*/ + @Excel(name = "仓库地址", width = 15) + @ApiModelProperty(value = "仓库地址") + private java.lang.String addr; + /**区域*/ + @Excel(name = "区域", width = 15) + @ApiModelProperty(value = "区域") + private java.lang.String region; + /**是否启用,0:否,1:是*/ + @Excel(name = "是否启用,0:否,1:是", width = 15) + @ApiModelProperty(value = "是否启用,0:否,1:是") + private java.lang.Integer enable; + /**创建时间*/ + @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 java.util.Date crateTime; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**更新时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private java.util.Date updateTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**创建部门*/ + @Excel(name = "创建部门", width = 15) + @ApiModelProperty(value = "创建部门") + private java.lang.String orgCode; +} diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/StoreInfoMapper.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/StoreInfoMapper.java new file mode 100644 index 0000000..29f5613 --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/StoreInfoMapper.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.erp.mapper; + +import org.jeecg.modules.demo.erp.entity.StoreInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 仓库管理 + * @Author: jeecg-boot + * @Date: 2023-06-19 + * @Version: V1.0 + */ +public interface StoreInfoMapper extends BaseMapper { + +} diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/xml/StoreInfoMapper.xml b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/xml/StoreInfoMapper.xml new file mode 100644 index 0000000..44931bf --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/mapper/xml/StoreInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/IStoreInfoService.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/IStoreInfoService.java new file mode 100644 index 0000000..6d103ac --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/IStoreInfoService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.erp.service; + +import org.jeecg.modules.demo.erp.entity.StoreInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 仓库管理 + * @Author: jeecg-boot + * @Date: 2023-06-19 + * @Version: V1.0 + */ +public interface IStoreInfoService extends IService { + +} diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/impl/StoreInfoServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/impl/StoreInfoServiceImpl.java new file mode 100644 index 0000000..47c7069 --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/service/impl/StoreInfoServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.erp.service.impl; + +import org.jeecg.modules.demo.erp.entity.StoreInfo; +import org.jeecg.modules.demo.erp.mapper.StoreInfoMapper; +import org.jeecg.modules.demo.erp.service.IStoreInfoService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 仓库管理 + * @Author: jeecg-boot + * @Date: 2023-06-19 + * @Version: V1.0 + */ +@Service +public class StoreInfoServiceImpl extends ServiceImpl implements IStoreInfoService { + +}