[add]新增仓库管理

master
NH-LHG 2 years ago
parent a1206ca269
commit 7af7a96d14

@ -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<StoreInfo, IStoreInfoService> {
@Autowired
private IStoreInfoService storeInfoService;
/**
*
*
* @param storeInfo
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "仓库管理-分页列表查询")
@ApiOperation(value="仓库管理-分页列表查询", notes="仓库管理-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<StoreInfo>> queryPageList(StoreInfo storeInfo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<StoreInfo> queryWrapper = QueryGenerator.initQueryWrapper(storeInfo, req.getParameterMap());
Page<StoreInfo> page = new Page<StoreInfo>(pageNo, pageSize);
IPage<StoreInfo> pageList = storeInfoService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
*
*
* @param storeInfo
* @return
*/
@AutoLog(value = "仓库管理-添加")
@ApiOperation(value="仓库管理-添加", notes="仓库管理-添加")
@PostMapping(value = "/add")
public Result<String> 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<String> 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<String> 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<String> 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<StoreInfo> 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);
}
}

@ -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;
/**是否启用01是*/
@Excel(name = "是否启用01是", width = 15)
@ApiModelProperty(value = "是否启用01是")
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;
}

@ -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<StoreInfo> {
}

@ -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.erp.mapper.StoreInfoMapper">
</mapper>

@ -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<StoreInfo> {
}

@ -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<StoreInfoMapper, StoreInfo> implements IStoreInfoService {
}
Loading…
Cancel
Save