Commit a2e62cbb authored by XuYang's avatar XuYang

添加

parent 12471ecc
package org.rcisoft.bus.common;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/2
* @Time:11:17
*/
public class ResponseResult<T> {
/**
* 状态码:成功为1,失败为0
*/
private Integer code;
/**
* 数据
*/
private T data;
/**
* 消息
*/
private String msg;
/**
* @Description: 成功时调用的方法
* @param: object
* @date: 2024/3/23 17:02
*/
public static <T> ResponseResult<T> success(T object) {
ResponseResult<T> responseResult = new ResponseResult<>();
responseResult.code = 1;
responseResult.data = object;
return responseResult;
}
/**
* @Description: 成功时调用的方法
* @param: object
* @date: 2024/3/23 17:02
*/
public static <T> ResponseResult<T> success(T object, String msg) {
ResponseResult<T> responseResult = new ResponseResult<>();
responseResult.code = 1;
responseResult.data = object;
responseResult.msg = msg;
return responseResult;
}
/**
* @Description: 失败时调用的方法
* @param: msg
* @date: 2024/3/23 16:59
*/
public static <T> ResponseResult<T> error(String msg) {
ResponseResult<T> responseResult = new ResponseResult<>();
responseResult.code = 0;
responseResult.msg = msg;
return responseResult;
}
}
package org.rcisoft.bus.testgoods.controller;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bus.common.ResponseResult;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import org.rcisoft.bus.testgoods.service.TestGoodsService;
import org.rcisoft.bus.wmsgoods.entity.WmsGoods;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/2
* @Time:11:00
*/
@Slf4j
@RestController
@RequestMapping("/testgoods")
public class TestGoodsController {
@Autowired
private TestGoodsService testGoodsService;
@Value("${localPath.path}")
private String basePath;
@PostMapping(value = "/add")
public CyResult add(@Valid TestGoods testGoods) {
return testGoodsService.addGood(testGoods);
}
@GetMapping(value = "/findAll")
public CyResult findAll(TestGoods testGoods) {
return testGoodsService.findAll(testGoods);
}
@GetMapping("/remove/{id}")
public CyResult removeLogical(@PathVariable int id) {
return testGoodsService.removeLogical(id);
}
@GetMapping("/find/{id}")
public CyResult findById(@PathVariable int id) {
return testGoodsService.findById(id);
}
@PostMapping("/update")
public CyResult updateGood(TestGoods testGoods) {
return testGoodsService.updateGood(testGoods);
}
@PostMapping("/upload")
public ResponseResult<String> upload(@RequestParam(name = "file") MultipartFile files) {
//file是一个临时文件,需要转存到指定位置,否则本次请求完成后临时文件会删除
log.info("文件上传与下载:{}", files.toString());
//使用原始文件名
String originalFilename = files.getOriginalFilename();
//截取文件名后缀l.jpg
String suffix = null;
if (originalFilename != null) {
suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
}
//使用UUID重新生成文件名,防止文件名称重复造成文件覆盖
String fileName = UUID.randomUUID() + suffix;
//创建一个目录对象
File file = new File(basePath);
//判断当前对象是否存在
if (!file.exists()) {
//不存在则创建目录
file.mkdirs();
}
try {
//将临时文件转存到指定位置
files.transferTo(new File(basePath + fileName));
} catch (IOException e) {
e.printStackTrace();
}
return ResponseResult.success(fileName);
}
/**
* 文件的下载及回显
*
* @param: name, response
* @date: 2023/11/27 16:37
*/
@GetMapping("/download")
public void download(String name, HttpServletResponse response) {
try {
//输入流,通过输入流来读取文件内容
FileInputStream fileInputStream = new FileInputStream(basePath + name);
//输出流。通过输出流将文件写回浏览器,在浏览器展示图片
ServletOutputStream outputStream = response.getOutputStream();
//设置下载文件类型
response.setContentType("image/jpeg");
int len;
byte[] bytes = new byte[1024];
while ((len = fileInputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, len);
outputStream.flush();
}
//关闭资源
outputStream.close();
fileInputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
@GetMapping(value = "/export")
public void outWmsGoods(HttpServletResponse response, TestGoods testGoods, @PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName = "";
switch (excelId) {
case "0":
excelName = "商品信息表信息.xls";
break;
case "1":
excelName = "商品信息表信息.xlsx";
break;
case "2":
excelName = "商品信息表信息.csv";
break;
}
List<TestGoods> testGoodsList = testGoodsService.export(testGoods);
log.info(testGoodsList.toString());
CyEpExcelUtil.exportExcel(testGoodsList, "商品信息表信息", "商品信息表信息", WmsGoods.class, excelName, response);
}
}
package org.rcisoft.bus.testgoods.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/2
* @Time:10:05
*/
@Mapper
public interface TestGoodsRepository extends BaseMapper<TestGoods> {
List<TestGoods> queryTestGoods(@Param("entity") TestGoods testGoods);
}
package org.rcisoft.bus.testgoods.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/2
* @Time:9:59
*/
@Data
@TableName("test_goods")
public class TestGoods extends CyIdIncreEntity<TestGoods> {
/**
* @desc 品名
* @column goods_name
* @default
*/
@Excel(name = "商品名称", orderNum = "0", width = 20)
private String goodsName;
/**
* @desc 商品编码
* @column goods_code
* @default
*/
@Excel(name = "商品编码", orderNum = "1", width = 20)
private String goodsCode;
/**
* @desc 货号
* @column goods_art_number
* @default
*/
@Excel(name = "货号", orderNum = "3", width = 20, replace = {"一类_001", "二类_002", "三类_003"})
private String goodsArtNumber;
/**
* @desc 规格
* @column goods_norms
* @default
*/
@Excel(name = "规格", orderNum = "6", width = 20, replace = {"儿童专用_001", "男士专用_002", "女士专用_003"})
private String goodsNorms;
/**
* @desc 尺码
* @column goods_size
* @default
*/
@Excel(name = "尺码", orderNum = "7", width = 20, replace = {"大号_001", "中号_002", "小号_003"})
private String goodsSize;
@Excel(name = "品名", orderNum = "9", width = 20, replace = {"日用品_001", "化妆品_002", "服装_003"})
private String goodsDictName;
@TableField(exist = false)
private Integer inCounts;
@TableField(exist = false)
private Integer outCounts;
/**
* 回显 出入库 列表 count
*/
@TableField(exist = false)
private Integer goodsCounts;
@TableField(exist = false)
private Integer goodsId;
}
package org.rcisoft.bus.testgoods.service;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import org.rcisoft.core.result.CyResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/2
* @Time:10:08
*/
@Service
public interface TestGoodsService {
/**
* 保存 商品信息表
*
* @param testGoods
* @return
*/
CyResult addGood(TestGoods testGoods);
/**
* 逻辑删除 商品信息表
*
* @param id
* @return
*/
CyResult removeLogical(int id);
/**
* 修改 商品信息表
*
* @param testGoods
* @return
*/
CyResult updateGood(TestGoods testGoods);
/**
* 根据id查询 商品信息表
*
* @param id
* @return
*/
CyResult findById(int id);
/**
* 分页查询 商品信息表
* @param testGoods
* @return
*/
/**
* 查询list 商品信息表
*
* @return
*/
CyResult findAll(TestGoods testGoods);
/**
* 导出商品信息表
*
* @return
*/
List<TestGoods> export(TestGoods testGoods);
}
package org.rcisoft.bus.testgoods.service.imp;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bus.testgoods.dao.TestGoodsRepository;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import org.rcisoft.bus.testgoods.service.TestGoodsService;
import org.rcisoft.core.result.CyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/2
* @Time:10:15
*/
@Slf4j
@Service
public class TestGoodsServiceImp implements TestGoodsService {
@Autowired
private TestGoodsRepository testGoodsRepository;
@Override
public CyResult addGood(TestGoods testGoods) {
CyResult cyResult = new CyResult();
TestGoods existGoods = testGoodsRepository.selectOne
(new QueryWrapper<TestGoods>().eq("goods_code", testGoods.getGoodsCode()));
if (existGoods != null) {
cyResult.setErrorMessage("添加失败,商品重复", null);
return cyResult;
} else {
int insert = testGoodsRepository.insert(testGoods);
cyResult.setSucessMessage("添加成功", insert);
return cyResult;
}
}
@Override
public CyResult removeLogical(int id) {
UpdateWrapper<TestGoods> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("business_id", id);
updateWrapper.set("del_flag", 1);
int update = testGoodsRepository.update(null, updateWrapper);
CyResult cyResult = new CyResult();
if (update > 0) {
cyResult.setSucessMessage("删除成功", null);
return cyResult;
} else {
cyResult.setErrorMessage("网络故障", null);
return cyResult;
}
}
@Override
public CyResult updateGood(TestGoods testGoods) {
int i = testGoodsRepository.updateById(testGoods);
CyResult cyResult = new CyResult();
if (i > 0) {
cyResult.setSucessMessage("修改成功", null);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public CyResult findById(int id) {
TestGoods one = testGoodsRepository.selectOne(new QueryWrapper<TestGoods>().eq("business_id", id));
CyResult cyResult = new CyResult();
if (one != null) {
cyResult.setSucessMessage("", one);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public CyResult findAll(TestGoods testGoods) {
List<TestGoods> testGoods1 = testGoodsRepository.queryTestGoods(testGoods);
CyResult cyResult = new CyResult();
cyResult.setSucessMessage("查询成功", testGoods1);
return cyResult;
}
@Override
public List<TestGoods> export(TestGoods testGoods) {
return testGoodsRepository.queryTestGoods(testGoods);
}
}
package org.rcisoft.bus.testgoodsapply.conroller;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bus.testgoodsapply.entity.TestGoodsApply;
import org.rcisoft.bus.testgoodsapply.service.TestGoodsApplyService;
import org.rcisoft.core.result.CyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:16:26
*/
@Slf4j
@RestController
@RequestMapping("/testGoodsApply")
public class TestGoodsApplyController {
@Autowired
private TestGoodsApplyService testGoodsApplyService;
@PostMapping("/add")
public CyResult addApply(@RequestBody TestGoodsApply testGoodsApply) {
log.info(testGoodsApply.toString());
return testGoodsApplyService.addApply(testGoodsApply);
}
@GetMapping("/findAll")
public CyResult getAll(TestGoodsApply testGoodsApply) {
return testGoodsApplyService.findAllApply(testGoodsApply);
}
@GetMapping("/find/{applyId}")
public CyResult getGoods(@PathVariable Integer applyId) {
return testGoodsApplyService.findApplyById(applyId);
}
@PostMapping("/update")
public CyResult updateApply(TestGoodsApply testGoodsApply) {
return testGoodsApplyService.updateApply(testGoodsApply);
}
@GetMapping("/remove/{applyId}")
public void remove(@PathVariable Integer applyId) {
testGoodsApplyService.removeApply(applyId);
}
}
package org.rcisoft.bus.testgoodsapply.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.rcisoft.bus.testgoodsapply.entity.TestApplyGoods;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:17:18
*/
@Mapper
public interface TestApplyGoodsRepository extends BaseMapper<TestApplyGoods> {
}
package org.rcisoft.bus.testgoodsapply.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import org.rcisoft.bus.testgoodsapply.entity.TestGoodsApply;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:15:18
*/
@Mapper
public interface TestGoodsApplyRepository extends BaseMapper<TestGoodsApply> {
/**
* 根据申请单id查询对应的商品信息
*
* @param applyId
* @return
*/
List<TestGoods> getGoods(Integer applyId);
List<TestGoodsApply> queryTestGoodsApply(@Param("entity") TestGoodsApply testGoodsApply);
}
package org.rcisoft.bus.testgoodsapply.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
import java.io.Serializable;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:17:15
*/
@Data
@TableName("test_apply_goods")
public class TestApplyGoods extends CyIdIncreEntity implements Serializable {
private Integer applyId;
private Integer goodsId;
}
package org.rcisoft.bus.testgoodsapply.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import org.rcisoft.core.entity.CyIdIncreEntity;
import java.io.Serializable;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:14:59
*/
@Data
@TableName("test_goods_apply")
public class TestGoodsApply extends CyIdIncreEntity<TestGoodsApply> implements Serializable {
@TableField(exist = false)
List<TestGoods> testGoods;
/**
* @desc 数量
* @column goods_counts
* @default
*/
@Excel(name = "数量", orderNum = "10", width = 20)
private Integer goodsCounts;
/**
* @desc 申请单号
* @column app_code
* @default
*/
@Excel(name = "申请单号", orderNum = "11", width = 20)
private String appCode;
/**
* @desc 发货方
* @column shipper
* @default
*/
@Excel(name = "发货方", orderNum = "12", width = 20)
private String shipper;
/**
* @desc 发货方地址
* @column shipper_address
* @default
*/
@Excel(name = "发货方地址", orderNum = "13", width = 20)
private String shipperAddress;
/**
* @desc 发货方联系方式
* @column shipper_phone
* @default
*/
@Excel(name = "发货方联系方式", orderNum = "14", width = 20)
private String shipperPhone;
/**
* @desc 制单员
* @column maker
* @default
*/
@Excel(name = "制单员", orderNum = "17", width = 20)
private String maker;
@Excel(name = "入库", orderNum = "17", width = 20)
private String inGoods;
@Excel(name = "库位号", orderNum = "17", width = 20)
private String goodsNumber;
}
package org.rcisoft.bus.testgoodsapply.service;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import org.rcisoft.bus.testgoodsapply.entity.TestGoodsApply;
import org.rcisoft.core.result.CyResult;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:16:08
*/
public interface TestGoodsApplyService {
/**
* 添加申请单
*
* @param testGoodsApply
* @return
*/
CyResult addApply(TestGoodsApply testGoodsApply);
/**
* 修改申请单
*
* @param testGoodsApply
* @return
*/
CyResult updateApply(TestGoodsApply testGoodsApply);
/**
* 删除(逻辑删除)申请单
*
* @param applyId
* @return
*/
CyResult removeApply(Integer applyId);
/**
* 查询全部申请单
*
* @return
*/
CyResult findAllApply(TestGoodsApply testGoodsApply);
/**
* 通过id查询申请单
*
* @param applyId
* @return
*/
CyResult findApplyById(Integer applyId);
List<TestGoods> getGoods(Integer applyId);
void removeApplyConnection(Integer applyId);
}
package org.rcisoft.bus.testgoodsapply.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.rcisoft.bus.testgoods.entity.TestGoods;
import org.rcisoft.bus.testgoodsapply.dao.TestApplyGoodsRepository;
import org.rcisoft.bus.testgoodsapply.dao.TestGoodsApplyRepository;
import org.rcisoft.bus.testgoodsapply.entity.TestApplyGoods;
import org.rcisoft.bus.testgoodsapply.entity.TestGoodsApply;
import org.rcisoft.bus.testgoodsapply.service.TestGoodsApplyService;
import org.rcisoft.core.result.CyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:16:18
*/
@Service
public class TestGoodsApplyServiceImpl implements TestGoodsApplyService {
@Autowired
private TestGoodsApplyRepository testGoodsApplyRepository;
@Autowired
private TestApplyGoodsRepository testApplyGoodsRepository;
public List<TestGoods> getGoods(Integer applyId) {
List<TestGoods> goods = testGoodsApplyRepository.getGoods(applyId);
CyResult cyResult = new CyResult();
if (goods.size() > 0) {
cyResult.setSucessMessage("查询成功", goods);
} else {
cyResult.setErrorMessage("网路故障", null);
}
return goods;
}
@Override
public void removeApplyConnection(Integer applyId) {
UpdateWrapper<TestApplyGoods> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("apply_id", applyId);
updateWrapper.set("del_flag", '1');
testApplyGoodsRepository.update(null, updateWrapper);
}
@Override
public CyResult addApply(TestGoodsApply testGoodsApply) {
int insert = testGoodsApplyRepository.insert(testGoodsApply);
TestApplyGoods testApplyGoods = new TestApplyGoods();
BeanUtil.copyProperties(testGoodsApply, testApplyGoods);
List<TestGoods> testGoods = testGoodsApply.getTestGoods();
List<Integer> collect = testGoods.stream().map(testGoods1 -> {
testApplyGoods.setApplyId(testGoodsApply.getBusinessId());
testApplyGoods.setGoodsId(testGoods1.getBusinessId());
return testApplyGoodsRepository.insert(testApplyGoods);
}).toList();
CyResult cyResult = new CyResult();
if (insert > 0) {
cyResult.setSucessMessage("添加成功", null);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public CyResult updateApply(TestGoodsApply testGoodsApply) {
int update = testGoodsApplyRepository.updateById(testGoodsApply);
CyResult cyResult = new CyResult();
if (update > 0) {
cyResult.setSucessMessage("修改成功", null);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public CyResult removeApply(Integer applyId) {
UpdateWrapper<TestGoodsApply> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("business_id", applyId);
updateWrapper.set("del_flag", '1');
int update = testGoodsApplyRepository.update(null, updateWrapper);
removeApplyConnection(applyId);
CyResult cyResult = new CyResult();
if (update > 0) {
cyResult.setSucessMessage("删除成功", null);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public CyResult findAllApply(TestGoodsApply testGoodsApply) {
List<TestGoodsApply> all = testGoodsApplyRepository.queryTestGoodsApply(testGoodsApply);
CyResult cyResult = new CyResult();
if (all.size() > 0) {
cyResult.setSucessMessage("查询成功", all);
} else {
cyResult.setSucessMessage("", null);
}
return cyResult;
}
@Override
public CyResult findApplyById(Integer applyId) {
TestGoodsApply testGoodsApply =
testGoodsApplyRepository
.selectOne(new QueryWrapper<TestGoodsApply>().eq("business_id", applyId));
CyResult cyResult = new CyResult();
if (testGoodsApply != null) {
testGoodsApply.setTestGoods(getGoods(applyId));
cyResult.setSucessMessage("查询成功", testGoodsApply);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
}
package org.rcisoft.bus.testgoodsstock.controller;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bus.testgoodsstock.dto.TestGoodsStockDTO;
import org.rcisoft.bus.testgoodsstock.service.TestGoodsStockService;
import org.rcisoft.core.result.CyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:9:51
*/
@Slf4j
@RestController
@RequestMapping("/testGoodsStock")
public class TestGoodsStockController {
@Autowired
private TestGoodsStockService testGoodsStockService;
/**
* 逻辑删除 库存管理表
*
* @param id
* @return
*/
@DeleteMapping("/remove/{id}")
public CyResult removeLogical(@PathVariable Integer id) {
return testGoodsStockService.removeLogical(id);
}
/**
* 修改 库存管理表
*
* @param testGoodsStock
* @return
*/
@PostMapping("/update")
public CyResult updateCounts(TestGoodsStockDTO testGoodsStock) {
return testGoodsStockService.updateCounts(testGoodsStock);
}
/**
* 根据id查询 库存管理表
*
* @param id
* @return
*/
@GetMapping("find/{id}")
public CyResult findById(@PathVariable int id) {
return testGoodsStockService.findById(id);
}
/**
* 查询list 库存管理表
*
* @param testGoodsStock
* @return
*/
@GetMapping("/findAll")
public CyResult findAll(TestGoodsStockDTO testGoodsStock) {
log.info("object:{}", testGoodsStock);
return testGoodsStockService.findAll(testGoodsStock);
}
}
package org.rcisoft.bus.testgoodsstock.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.bus.testgoodsstock.dto.TestGoodsStockDTO;
import org.rcisoft.bus.testgoodsstock.entity.TestGoodsStock;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:9:04
*/
@Mapper
public interface TestGoodsStockRepository extends BaseMapper<TestGoodsStock> {
List<TestGoodsStockDTO> queryTestGoodsStocks(@Param("entity") TestGoodsStockDTO testGoodsStock);
}
package org.rcisoft.bus.testgoodsstock.dto;
import lombok.Data;
import org.rcisoft.bus.testgoodsstock.entity.TestGoodsStock;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:11:22
*/
@Data
public class TestGoodsStockDTO extends TestGoodsStock {
/**
* @desc 商品名称
* @column goods_name
* @default
*/
private String goodsName;
private String goodsDictName;
/**
* @desc 商品编码
* @column goods_code
* @default
*/
private String goodsCode;
/**
* @desc 商品货号
* @column goods_article_number
* @default
*/
private String goodsArtNumber;
/**
* @desc 商品规格
* @column goods_norms
* @default
*/
private String goodsNorms;
/**
* @desc 商品尺码
* @column goods_size
* @default
*/
private String goodsSize;
}
package org.rcisoft.bus.testgoodsstock.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.rcisoft.core.entity.CyIdIncreEntity;
import java.io.Serializable;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:9:00
*/
@Data
@TableName("test_goods_stock")
public class TestGoodsStock extends CyIdIncreEntity<TestGoodsStock> implements Serializable {
/**
* @desc 商品id
* @column goods_id
* @default
*/
@Excel(name = "商品id", orderNum = "0", width = 20)
private Integer goodsId;
/**
* @desc 商品数量
* @column goods_counts
* @default
*/
@Excel(name = "商品数量", orderNum = "1", width = 20)
private Integer goodsCounts;
@TableField(exist = false)
private Integer inventoryValue;
}
package org.rcisoft.bus.testgoodsstock.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.rcisoft.bus.testgoodsstock.dto.TestGoodsStockDTO;
import org.rcisoft.bus.testgoodsstock.entity.TestGoodsStock;
import org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.result.CyResult;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:9:26
*/
public interface TestGoodsStockService {
/**
* 逻辑删除 库存管理表
*
* @param id
* @return
*/
CyResult removeLogical(Integer id);
/**
* 修改 库存管理表
*
* @param testGoodsStock
* @return
*/
CyResult updateCounts(TestGoodsStock testGoodsStock);
/**
* 根据id查询 库存管理表
*
* @param id
* @return
*/
CyResult findById(int id);
/**
* 分页查询 库存管理表
*
* @param testGoodsStock
* @return
*/
IPage<WmsGoodsStockPageResultsDto> findAllByPagination(CyPageInfo<WmsGoodsStockPageResultsDto> paginationUtility,
TestGoodsStock testGoodsStock);
/**
* 查询list 库存管理表
*
* @param testGoodsStock
* @return
*/
CyResult findAll(TestGoodsStockDTO testGoodsStock);
/**
* 导出库存管理表
*
* @return
*/
List<TestGoodsStock> export(TestGoodsStock testGoodsStock);
}
package org.rcisoft.bus.testgoodsstock.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.bus.testgoodsstock.dao.TestGoodsStockRepository;
import org.rcisoft.bus.testgoodsstock.dto.TestGoodsStockDTO;
import org.rcisoft.bus.testgoodsstock.entity.TestGoodsStock;
import org.rcisoft.bus.testgoodsstock.service.TestGoodsStockService;
import org.rcisoft.bus.wmsgoodsstock.dto.WmsGoodsStockPageResultsDto;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.result.CyResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author:Mr.Yang
* @Description:Test_Object
* @Date:2024/7/3
* @Time:9:28
*/
@Service
@Slf4j
public class TestGoodsStockServiceImpl implements TestGoodsStockService {
@Autowired
private TestGoodsStockRepository testGoodsStockRepository;
@Override
public CyResult removeLogical(Integer id) {
UpdateWrapper<TestGoodsStock> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("business_id", id);
updateWrapper.set("del_flag", 1);
int update = testGoodsStockRepository.update(null, updateWrapper);
CyResult cyResult = new CyResult();
if (update > 0) {
cyResult.setSucessMessage("删除成功", null);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public CyResult updateCounts(TestGoodsStock testGoodsStock) {
int line = testGoodsStockRepository.updateById(testGoodsStock);
CyResult cyResult = new CyResult();
if (line > 0) {
cyResult.setSucessMessage("修改成功", null);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public CyResult findById(int id) {
TestGoodsStock selectOne
= testGoodsStockRepository.selectOne(new QueryWrapper<TestGoodsStock>().eq("business_id", id));
CyResult cyResult = new CyResult();
if (selectOne != null) {
cyResult.setSucessMessage("", selectOne);
} else {
cyResult.setErrorMessage("网络故障", null);
}
return cyResult;
}
@Override
public IPage<WmsGoodsStockPageResultsDto>
findAllByPagination(CyPageInfo<WmsGoodsStockPageResultsDto> paginationUtility, TestGoodsStock testGoodsStock) {
return null;
}
@Override
public CyResult findAll(TestGoodsStockDTO testGoodsStock) {
List<TestGoodsStockDTO> testGoodsStocks = testGoodsStockRepository.queryTestGoodsStocks(testGoodsStock);
log.info("stock:{}", testGoodsStocks);
CyResult cyResult = new CyResult();
cyResult.setSucessMessage("", testGoodsStocks);
return cyResult;
}
@Override
public List<TestGoodsStock> export(TestGoodsStock testGoodsStock) {
return null;
}
}
<?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.rcisoft.bus.testgoods.dao.TestGoodsRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.bus.wmsgoods.entity.WmsGoods">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="flag" jdbcType="CHAR" property="flag"/>
<result column="del_flag" jdbcType="CHAR" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="goods_name" jdbcType="VARCHAR" property="goodsName"/>
<result column="goods_dict_name" jdbcType="VARCHAR" property="goodsDictName"/>
<result column="goods_code" jdbcType="VARCHAR" property="goodsCode"/>
<result column="goods_style" jdbcType="VARCHAR" property="goodsStyle"/>
<result column="goods_art_number" jdbcType="VARCHAR" property="goodsArtNumber"/>
<result column="goods_season" jdbcType="VARCHAR" property="goodsSeason"/>
<result column="goods_colour" jdbcType="VARCHAR" property="goodsColour"/>
<result column="goods_norms" jdbcType="VARCHAR" property="goodsNorms"/>
<result column="goods_size" jdbcType="VARCHAR" property="goodsSize"/>
<result column="goods_brand" jdbcType="VARCHAR" property="goodsBrand"/>
<!--回显 入库/出库 列表-->
<result column="goods_counts" jdbcType="VARCHAR" property="goodsCounts"/>
</resultMap>
<select id="queryTestGoods" resultMap="BaseResultMap">
select * from test_goods
where 1=1
and del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
<if test="entity.goodsName !=null and entity.goodsName != '' ">
and goods_name like concat('%',#{entity.goodsName},'%')
</if>
<if test="entity.goodsDictName !=null and entity.goodsDictName != '' ">
and goods_dict_name like concat('%',#{entity.goodsDictName},'%')
</if>
<if test="entity.goodsCode !=null and entity.goodsCode != '' ">
and goods_code like concat('%',#{entity.goodsCode},'%')
</if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and goods_art_number like concat('%',#{entity.goodsArtNumber},'%')
</if>
<if test="entity.goodsNorms !=null and entity.goodsNorms != '' ">
and goods_norms like concat('%',#{entity.goodsNorms},'%')
</if>
<if test="entity.goodsSize !=null and entity.goodsSize != '' ">
and goods_size like concat('%',#{entity.goodsSize},'%')
</if>
ORDER BY business_id DESC
</select>
</mapper>
<?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.rcisoft.bus.testgoodsapply.dao.TestGoodsApplyRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.bus.testgoodsapply.entity.TestGoodsApply">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="flag" jdbcType="CHAR" property="flag"/>
<result column="del_flag" jdbcType="CHAR" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="goods_counts" jdbcType="INTEGER" property="goodsCounts"/>
<result column="goods_number" jdbcType="INTEGER" property="goodsNumber"/>
<result column="app_code" jdbcType="VARCHAR" property="appCode"/>
<result column="shipper" jdbcType="VARCHAR" property="shipper"/>
<result column="shipper_address" jdbcType="VARCHAR" property="shipperAddress"/>
<result column="shipper_phone" jdbcType="VARCHAR" property="shipperPhone"/>
<result column="maker" jdbcType="VARCHAR" property="maker"/>
<result column="in_goods" jdbcType="VARCHAR" property="inGoods"/>
</resultMap>
<resultMap id="BaseGoodsResultMap" type="org.rcisoft.bus.testgoods.entity.TestGoods">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="flag" jdbcType="CHAR" property="flag"/>
<result column="del_flag" jdbcType="CHAR" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="goods_name" jdbcType="VARCHAR" property="goodsName"/>
<result column="goods_dict_name" jdbcType="VARCHAR" property="goodsDictName"/>
<result column="goods_code" jdbcType="VARCHAR" property="goodsCode"/>
<result column="goods_style" jdbcType="VARCHAR" property="goodsStyle"/>
<result column="goods_art_number" jdbcType="VARCHAR" property="goodsArtNumber"/>
<result column="goods_season" jdbcType="VARCHAR" property="goodsSeason"/>
<result column="goods_colour" jdbcType="VARCHAR" property="goodsColour"/>
<result column="goods_norms" jdbcType="VARCHAR" property="goodsNorms"/>
<result column="goods_size" jdbcType="VARCHAR" property="goodsSize"/>
<result column="goods_brand" jdbcType="VARCHAR" property="goodsBrand"/>
<!--回显 入库/出库 列表-->
<result column="goods_counts" jdbcType="VARCHAR" property="goodsCounts"/>
</resultMap>
<select id="queryTestGoodsApply" resultMap="BaseResultMap">
select * from test_goods_apply
where 1=1
and del_flag = '0'
<if test="entity.goodsCounts !=null and entity.goodsCounts != '' ">
and goods_counts = #{entity.goodsCounts}
</if>
<if test="entity.appCode !=null and entity.appCode != '' ">
and app_code like concat('%',#{entity.appCode},'%')
</if>
<if test="entity.shipper !=null and entity.shipper != '' ">
and shipper like concat('%',#{entity.shipper},'%')
</if>
<if test="entity.shipperAddress !=null and entity.shipperAddress != '' ">
and shipper_address like concat('%',#{entity.shipperAddress},'%')
</if>
<if test="entity.shipperPhone !=null and entity.shipperPhone != '' ">
and shipper_phone like concat('%',#{entity.shipperPhone},'%')
</if>
<if test="entity.maker !=null and entity.maker != '' ">
and maker like concat('%',#{entity.maker},'%')
</if>
ORDER BY business_id DESC
</select>
<select id="getGoods" resultMap="BaseGoodsResultMap">
select tg.*
from test_goods tg
left join test_apply_goods tag
on tg.business_id = tag.goods_id
where tag.del_flag = '0'
and tg.del_flag = '0'
AND tag.apply_id = #{applyId}
ORDER BY tg.business_id ASC
</select>
</mapper>
<?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.rcisoft.bus.testgoodsstock.dao.TestGoodsStockRepository">
<resultMap id="BaseDTOResultMap" type="org.rcisoft.bus.testgoodsstock.dto.TestGoodsStockDTO">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="flag" jdbcType="CHAR" property="flag"/>
<result column="del_flag" jdbcType="CHAR" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="goods_id" jdbcType="INTEGER" property="goodsId"/>
<result column="goods_counts" jdbcType="INTEGER" property="goodsCounts"/>
<result column="goods_name" jdbcType="VARCHAR" property="goodsName"/>
<result column="goods_dict_name" jdbcType="VARCHAR" property="goodsDictName"/>
<result column="goods_code" jdbcType="VARCHAR" property="goodsCode"/>
<result column="goods_art_number" jdbcType="VARCHAR" property="goodsArtNumber"/>
<result column="goods_norms" jdbcType="VARCHAR" property="goodsNorms"/>
<result column="goods_size" jdbcType="VARCHAR" property="goodsSize"/>
<result column="inventoryValue" jdbcType="INTEGER" property="inventoryValue"/>
</resultMap>
<select id="queryTestGoodsStocks" resultMap="BaseDTOResultMap">
select tgs.*,
tg.goods_name,
tg.goods_dict_name,
tg.goods_code,
tg.goods_art_number,
tg.goods_norms,
tg.goods_size
from test_goods_stock tgs left join test_goods tg on tg.business_id = tgs.goods_id
where
tgs.del_flag = '0'
and tg.del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and tgs.flag = #{entity.flag}
</if>
<if test="entity.goodsId !=null and entity.goodsId != '' ">
and tgs.goods_id = #{entity.goodsId}
</if>
<if test="entity.goodsCounts !=null and entity.goodsCounts != '' ">
and tgs.goods_counts = #{entity.goodsCounts}
</if>
<if test="entity.goodsName !=null and entity.goodsName != '' ">
and tg.goods_name = #{entity.goodsName}
</if>
<if test="entity.goodsDictName !=null and entity.goodsDictName != '' ">
and tg.goods_dict_name = #{entity.goodsDictName}
</if>
<if test="entity.goodsCode !=null and entity.goodsCode != '' ">
and tg.goods_code = #{entity.goodsCode}
</if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and tg.goods_art_number = #{entity.goodsArtNumber}
</if>
<if test="entity.goodsNorms !=null and entity.goodsNorms != '' ">
and tg.goods_norms = #{entity.goodsNorms}
</if>
<if test="entity.goodsSize !=null and entity.goodsSize != '' ">
and tg.goods_size = #{entity.goodsSize}
</if>
<if test="entity.inventoryValue != null and entity.inventoryValue != ''">
and tgs.goods_counts &lt; #{entity.inventoryValue}
</if>
ORDER BY tgs.business_id ASC
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment