商品订单

master
miaoqingshuai 2026-01-24 16:42:53 +08:00
parent b78ad98b8c
commit 43ee4eedbf
8 changed files with 321 additions and 8 deletions

View File

@ -8,10 +8,8 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.domain.Brand;
import com.ruoyi.web.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*

View File

@ -0,0 +1,34 @@
package com.ruoyi.web.controller;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.domain.Order;
import com.ruoyi.web.service.OrderService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
*
*/
@RestController
@RequestMapping("/mall/order")
public class OrderController extends BaseController {
@Resource
private OrderService orderService;
/**
*
*/
// @PreAuthorize("@ss.hasPermi('product:list')")
@Anonymous
@GetMapping("/list")
public AjaxResult list(Order order) {
return AjaxResult.success(orderService.selectList(order));
}
}

View File

@ -5,19 +5,14 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.file.InvalidExtensionException;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.domain.Product;
import com.ruoyi.web.domain.Store;
import com.ruoyi.web.dto.BatchStoreDTO;
import com.ruoyi.web.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -0,0 +1,52 @@
package com.ruoyi.web.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* mall_order
*/
@Data
public class Order extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Long id;
/**
*
*/
private String orderNo;
/**
* id
*/
private Integer storeId;
/**
*
*/
private BigDecimal payAmount;
/**
* : 0-,1-,2-,3-,4-退
*/
private Integer payStatus;
/**
* id
*/
private Integer productId;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date payTime;
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.web.mapper;
import com.ruoyi.web.domain.Order;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface OrderMapper {
List<Order> selectList(Order order);
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.web.service;
import com.ruoyi.web.domain.Order;
import java.util.List;
/**
*
*
*/
public interface OrderService {
List<Order> selectList(Order order);
}

View File

@ -0,0 +1,25 @@
package com.ruoyi.web.service.impl;
import com.ruoyi.web.domain.Order;
import com.ruoyi.web.mapper.OrderMapper;
import com.ruoyi.web.service.OrderService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
*
*/
@Service
public class OrderServiceImpl implements OrderService {
@Resource
private OrderMapper orderMapper;
@Override
public List<Order> selectList(Order order) {
return orderMapper.selectList(order);
}
}

View File

@ -0,0 +1,179 @@
<?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="com.ruoyi.web.mapper.OrderMapper">
<resultMap type="Order" id="MallOrderResult">
<id property="id" column="id"/>
<result property="orderNo" column="order_no"/>
<result property="storeId" column="store_id"/>
<result property="payAmount" column="pay_amount"/>
<result property="payTime" column="pay_time"/>
<result property="payStatus" column="pay_status"/>
<result property="productId" column="product_id"/>
<result property="storeId" column="store_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectCommodityVo">
select id,
order_no,
store_id,
pay_amount,
pay_time,
pay_status,
product_id,
create_by,
create_time,
update_by,
update_time
from mall_order
</sql>
<select id="selectList" parameterType="Order" resultMap="MallOrderResult">
<include refid="selectCommodityVo"/>
where del_flag = '0'
</select>
<select id="checkProductCodeUnique" resultType="com.ruoyi.web.domain.Product">
<include refid="selectCommodityVo"/>
where product_bar_code=#{productBarCode} and del_flag = '0' and store_id = #{storeId}
<if test="id != null">
AND id != #{id}
</if>
limit 1
</select>
<insert id="insertProductStore" parameterType="Product">
insert into mall_product_store (
<if test="productCode != null and productCode != ''">product_code,</if>
<if test="productName != null and productName != ''">product_name,</if>
<if test="productDesc != null and productDesc != ''">product_desc,</if>
<if test="mainImage != null and mainImage != ''">main_image,</if>
<if test="storePrice != null and storePrice != ''">store_price,</if>
<if test="costPrice != null and costPrice != ''">cost_price,</if>
<if test="originalPrice != null and originalPrice != ''">original_price,</if>
<if test="storeId != null and storeId != ''">store_id,</if>
<if test="stockQuantity != null and stockQuantity != ''">stock_quantity,</if>
<if test="soldQuantity != null and soldQuantity != ''">sold_quantity,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="shelfCode != null and shelfCode != ''">shelf_code,</if>
<if test="productBarCode != null and productBarCode != ''">product_bar_code,</if>
<if test="shelfLife != null and shelfLife != ''">shelf_life,</if>
<if test="productionDate != null and productionDate != ''">production_date,</if>
<if test="approaching != null">approaching,</if>
create_time
)values(
<if test="productCode != null and productCode != ''">#{productCode},</if>
<if test="productName != null and productName != ''">#{productName},</if>
<if test="productDesc != null and productDesc != ''">#{productDesc},</if>
<if test="mainImage != null and mainImage != ''">#{mainImage},</if>
<if test="storePrice != null and storePrice != ''">#{storePrice},</if>
<if test="costPrice != null and costPrice != ''">#{costPrice},</if>
<if test="originalPrice != null and originalPrice != ''">#{originalPrice},</if>
<if test="storeId != null and storeId != ''">#{storeId},</if>
<if test="stockQuantity != null and stockQuantity != ''">#{stockQuantity},</if>
<if test="soldQuantity != null and soldQuantity != ''">#{soldQuantity},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="shelfCode != null and shelfCode != ''">#{shelfCode},</if>
<if test="productBarCode != null and productBarCode != ''">#{productBarCode},</if>
<if test="shelfLife != null and shelfLife != ''">#{shelfLife},</if>
<if test="productionDate != null and productionDate != ''">#{productionDate},</if>
<if test="approaching != null">#{approaching},</if>
sysdate()
)
</insert>
<update id="updateProduct">
update mall_product_store
<set>
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="productDesc != null and productDesc != ''">product_desc = #{productDesc},</if>
<if test="mainImage != null and mainImage != ''">main_image = #{mainImage},</if>
<if test="storePrice != null and storePrice != ''">store_price = #{storePrice},</if>
<if test="costPrice != null and costPrice != ''">cost_price = #{costPrice},</if>
<if test="stockQuantity != null and stockQuantity != ''">stock_quantity = #{stockQuantity},</if>
<if test="soldQuantity != null and soldQuantity != ''">sold_quantity = #{soldQuantity},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="shelfCode != null and shelfCode != ''">shelf_code = #{shelfCode},</if>
<if test="productBarCode != null and productBarCode != ''">product_bar_code = #{productBarCode},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="shelfLife != null">shelf_life = #{shelfLife},</if>
<if test="productionDate != null and productionDate != ''">production_date = #{productionDate},</if>
<if test="approaching != null">approaching = #{approaching},</if>
<if test="productBrand != null and productBrand != ''">product_brand = #{productBrand},</if>
<if test="classifcation != null and classifcation != ''">classifcation = #{classifcation},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<update id="updateProductBarCode">
update mall_product_store
<set>
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="productDesc != null and productDesc != ''">product_desc = #{productDesc},</if>
<if test="mainImage != null and mainImage != ''">main_image = #{mainImage},</if>
<if test="storePrice != null and storePrice != ''">store_price = #{storePrice},</if>
<if test="costPrice != null and costPrice != ''">cost_price = #{costPrice},</if>
<if test="stockQuantity != null and stockQuantity != ''">stock_quantity = #{stockQuantity},</if>
<if test="soldQuantity != null and soldQuantity != ''">sold_quantity = #{soldQuantity},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="shelfCode != null and shelfCode != ''">shelf_code = #{shelfCode},</if>
<if test="productBarCode != null and productBarCode != ''">product_bar_code = #{productBarCode},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="shelfLife != null">shelf_life = #{shelfLife},</if>
<if test="productionDate != null and productionDate != ''">production_date = #{productionDate},</if>
<if test="approaching != null">approaching = #{approaching},</if>
<if test="productBrand != null and productBrand != ''">product_brand = #{productBrand},</if>
<if test="classifcation != null and classifcation != ''">classifcation = #{classifcation},</if>
update_time = sysdate()
</set>
where product_bar_code = #{productBarCode}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete
from sys_config
where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
<delete id="deleteProductById">
update mall_product_store
set del_flag = '2'
where id = #{id}
</delete>
<delete id="batchProductById">
UPDATE mall_product_store
SET del_flag = 2
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>