完善oms-api
This commit is contained in:
parent
5bd0f4cefd
commit
6aac4bd048
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.qihang.oms.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.qihang.common.common.AjaxResult;
|
||||||
|
import com.qihang.common.common.TableDataInfo;
|
||||||
|
import com.qihang.oms.common.BaseController;
|
||||||
|
import com.qihang.oms.domain.OGoods;
|
||||||
|
import com.qihang.oms.service.OGoodsService;
|
||||||
|
import com.qihang.oms.vo.GoodsSpecListVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品管理Controller
|
||||||
|
*
|
||||||
|
* @author qihang
|
||||||
|
* @date 2023-12-29
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/goods")
|
||||||
|
public class GoodsController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private OGoodsService goodsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索商品SKU
|
||||||
|
* 条件:商品编码、SKU、商品名称
|
||||||
|
*/
|
||||||
|
@GetMapping("/searchSku")
|
||||||
|
public TableDataInfo searchSkuBy(String keyword)
|
||||||
|
{
|
||||||
|
List<GoodsSpecListVo> list = goodsService.searchGoodsSpec(keyword);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询商品管理列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('goods:goods:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(OGoods goods)
|
||||||
|
{
|
||||||
|
List<OGoods> list = goodsService.selectGoodsList(goods);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品管理详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('goods:goods:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(goodsService.selectGoodsById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增商品管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('goods:goods:add')")
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody OGoods goods)
|
||||||
|
{
|
||||||
|
goods.setCreateBy(getUsername());
|
||||||
|
int result = goodsService.insertGoods(goods);
|
||||||
|
if(result == -1) new AjaxResult(501,"商品编码已存在");
|
||||||
|
return toAjax(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('goods:goods:edit')")
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody OGoods goods)
|
||||||
|
{
|
||||||
|
return toAjax(goodsService.updateGoods(goods));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品管理
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('goods:goods:remove')")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(goodsService.deleteGoodsByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.qihang.oms.controller;
|
package com.qihang.oms.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.qihang.common.common.AjaxResult;
|
|
||||||
import com.qihang.common.common.TableDataInfo;
|
import com.qihang.common.common.TableDataInfo;
|
||||||
import com.qihang.oms.common.BaseController;
|
import com.qihang.oms.common.BaseController;
|
||||||
import com.qihang.oms.domain.OOrder;
|
import com.qihang.oms.domain.OOrder;
|
||||||
|
|
@ -19,7 +18,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/order")
|
@RequestMapping("/order")
|
||||||
public class ErpOrderController extends BaseController
|
public class OrderController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private OOrderService orderService;
|
private OOrderService orderService;
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.qihang.oms.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.qihang.common.common.AjaxResult;
|
||||||
|
import com.qihang.common.common.TableDataInfo;
|
||||||
|
import com.qihang.oms.common.BaseController;
|
||||||
|
import com.qihang.oms.domain.ORefund;
|
||||||
|
import com.qihang.oms.service.ORefundService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退换货Controller
|
||||||
|
*
|
||||||
|
* @author qihang
|
||||||
|
* @date 2024-01-13
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/refund")
|
||||||
|
public class RefundController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ORefundService refundService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询退换货列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('api:returned:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ORefund refund)
|
||||||
|
{
|
||||||
|
List<ORefund> list = refundService.selectList(refund);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取退换货详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('api:returned:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(refundService.selectById(id));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改退换货
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('api:returned:edit')")
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ORefund refund)
|
||||||
|
{
|
||||||
|
//erpOrderReturnedService.updateErpOrderReturned(erpOrderReturned)
|
||||||
|
return toAjax(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,9 @@ package com.qihang.oms.mapper;
|
||||||
|
|
||||||
import com.qihang.oms.domain.OGoods;
|
import com.qihang.oms.domain.OGoods;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.qihang.oms.vo.GoodsSpecListVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TW
|
* @author TW
|
||||||
|
|
@ -10,7 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
* @Entity com.qihang.oms.domain.OGoods
|
* @Entity com.qihang.oms.domain.OGoods
|
||||||
*/
|
*/
|
||||||
public interface OGoodsMapper extends BaseMapper<OGoods> {
|
public interface OGoodsMapper extends BaseMapper<OGoods> {
|
||||||
|
List<GoodsSpecListVo> searchGoodsSpec(String keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ package com.qihang.oms.service;
|
||||||
|
|
||||||
import com.qihang.oms.domain.OGoods;
|
import com.qihang.oms.domain.OGoods;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.qihang.oms.vo.GoodsSpecListVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TW
|
* @author TW
|
||||||
|
|
@ -9,5 +12,30 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
* @createDate 2024-03-11 14:24:49
|
* @createDate 2024-03-11 14:24:49
|
||||||
*/
|
*/
|
||||||
public interface OGoodsService extends IService<OGoods> {
|
public interface OGoodsService extends IService<OGoods> {
|
||||||
|
List<GoodsSpecListVo> searchGoodsSpec(String keyword);
|
||||||
|
List<OGoods> selectGoodsList(OGoods goods);
|
||||||
|
OGoods selectGoodsById(Long id);
|
||||||
|
/**
|
||||||
|
* 新增商品管理
|
||||||
|
*
|
||||||
|
* @param goods 商品管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertGoods(OGoods goods);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改商品管理
|
||||||
|
*
|
||||||
|
* @param goods 商品管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateGoods(OGoods goods);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除商品管理
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的商品管理主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteGoodsByIds(Long[] ids);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.qihang.common.common.ResultVo;
|
import com.qihang.common.common.ResultVo;
|
||||||
import com.qihang.oms.domain.ORefund;
|
import com.qihang.oms.domain.ORefund;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author qilip
|
* @author qilip
|
||||||
|
|
@ -13,4 +15,8 @@ import com.qihang.oms.domain.ORefund;
|
||||||
public interface ORefundService extends IService<ORefund> {
|
public interface ORefundService extends IService<ORefund> {
|
||||||
ResultVo<Integer> jdRefundMessage(String refundId);
|
ResultVo<Integer> jdRefundMessage(String refundId);
|
||||||
ResultVo<Integer> taoRefundMessage(String refundId);
|
ResultVo<Integer> taoRefundMessage(String refundId);
|
||||||
|
List<ORefund> selectList(ORefund refund);
|
||||||
|
|
||||||
|
ORefund selectById(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,57 @@
|
||||||
package com.qihang.oms.service.impl;
|
package com.qihang.oms.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.qihang.oms.domain.OGoods;
|
import com.qihang.oms.domain.OGoods;
|
||||||
import com.qihang.oms.service.OGoodsService;
|
import com.qihang.oms.service.OGoodsService;
|
||||||
import com.qihang.oms.mapper.OGoodsMapper;
|
import com.qihang.oms.mapper.OGoodsMapper;
|
||||||
|
import com.qihang.oms.vo.GoodsSpecListVo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TW
|
* @author TW
|
||||||
* @description 针对表【o_goods(商品库存管理)】的数据库操作Service实现
|
* @description 针对表【o_goods(商品库存管理)】的数据库操作Service实现
|
||||||
* @createDate 2024-03-11 14:24:49
|
* @createDate 2024-03-11 14:24:49
|
||||||
*/
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class OGoodsServiceImpl extends ServiceImpl<OGoodsMapper, OGoods>
|
public class OGoodsServiceImpl extends ServiceImpl<OGoodsMapper, OGoods>
|
||||||
implements OGoodsService{
|
implements OGoodsService{
|
||||||
|
private final OGoodsMapper goodsMapper;
|
||||||
|
@Override
|
||||||
|
public List<GoodsSpecListVo> searchGoodsSpec(String keyword) {
|
||||||
|
return goodsMapper.searchGoodsSpec(keyword);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OGoods> selectGoodsList(OGoods goods) {
|
||||||
|
List<OGoods> list = goodsMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OGoods selectGoodsById(Long id) {
|
||||||
|
return goodsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertGoods(OGoods goods) {
|
||||||
|
return goodsMapper.insert(goods);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateGoods(OGoods goods) {
|
||||||
|
return goodsMapper.updateById(goods);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteGoodsByIds(Long[] ids) {
|
||||||
|
return goodsMapper.deleteBatchIds(Arrays.stream(ids).toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,17 @@ public class ORefundServiceImpl extends ServiceImpl<ORefundMapper, ORefund>
|
||||||
public ResultVo<Integer> taoRefundMessage(String refundId) {
|
public ResultVo<Integer> taoRefundMessage(String refundId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ORefund> selectList(ORefund refund) {
|
||||||
|
List<ORefund> list = mapper.selectList(new LambdaQueryWrapper<>());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ORefund selectById(Long id) {
|
||||||
|
return mapper.selectById(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
package com.qihang.oms.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class GoodsSpecListVo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private Long goodsId;
|
||||||
|
|
||||||
|
/** 商品名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 商品编号 */
|
||||||
|
private String number;
|
||||||
|
private String specNum;
|
||||||
|
private String colorValue;
|
||||||
|
/** 商品图片地址 */
|
||||||
|
private String colorImage;
|
||||||
|
private String sizeValue;
|
||||||
|
private String styleValue;
|
||||||
|
private BigDecimal purPrice;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getGoodsId() {
|
||||||
|
return goodsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsId(Long goodsId) {
|
||||||
|
this.goodsId = goodsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumber(String number) {
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpecNum() {
|
||||||
|
return specNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpecNum(String specNum) {
|
||||||
|
this.specNum = specNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColorValue() {
|
||||||
|
return colorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColorValue(String colorValue) {
|
||||||
|
this.colorValue = colorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColorImage() {
|
||||||
|
return colorImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColorImage(String colorImage) {
|
||||||
|
this.colorImage = colorImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSizeValue() {
|
||||||
|
return sizeValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSizeValue(String sizeValue) {
|
||||||
|
this.sizeValue = sizeValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStyleValue() {
|
||||||
|
return styleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStyleValue(String styleValue) {
|
||||||
|
this.styleValue = styleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPurPrice() {
|
||||||
|
return purPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPurPrice(BigDecimal purPrice) {
|
||||||
|
this.purPrice = purPrice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -43,6 +43,18 @@
|
||||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
<resultMap type="com.qihang.oms.vo.GoodsSpecListVo" id="GoodsSpecListVoResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="goodsId" column="goods_id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="number" column="number" />
|
||||||
|
<result property="specNum" column="spec_num" />
|
||||||
|
<result property="colorValue" column="color_value" />
|
||||||
|
<result property="colorImage" column="color_image" />
|
||||||
|
<result property="sizeValue" column="size_value" />
|
||||||
|
<result property="styleValue" column="style_value" />
|
||||||
|
<result property="purPrice" column="pur_price" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id,name,image,
|
id,name,image,
|
||||||
|
|
@ -59,4 +71,20 @@
|
||||||
create_by,create_time,update_by,
|
create_by,create_time,update_by,
|
||||||
update_time
|
update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="searchGoodsSpec" parameterType="String" resultMap="GoodsSpecListVoResult">
|
||||||
|
SELECT spec.id,spec.goods_id,g.number,g.`name`,spec.spec_num,spec.color_value,spec.color_image,spec.size_value,spec.style_value,spec.pur_price
|
||||||
|
FROM `erp_goods_spec` as spec
|
||||||
|
LEFT JOIN erp_goods as g on g.id = spec.goods_id
|
||||||
|
<where>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
and
|
||||||
|
(
|
||||||
|
g.name like concat('%', #{keyword}, '%')
|
||||||
|
or g.number like concat(#{keyword}, '%')
|
||||||
|
or spec.spec_num like concat(#{keyword}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue