商品订单
parent
43ee4eedbf
commit
613300778f
|
|
@ -28,8 +28,9 @@ public class BrandController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Anonymous
|
@Anonymous
|
||||||
@GetMapping(value = "/getTree/{storeId}")
|
@GetMapping(value = "/getTree/{storeId}")
|
||||||
public AjaxResult getBrandTree(@PathVariable String storeId) {
|
public AjaxResult getBrandTree(@PathVariable String storeId,
|
||||||
return AjaxResult.success(brandService.getBrandTree(storeId));
|
@RequestParam(required = false) String brandName) {
|
||||||
|
return AjaxResult.success(brandService.getBrandTree(storeId,brandName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.web.domain.Classification;
|
import com.ruoyi.web.domain.Classification;
|
||||||
import com.ruoyi.web.service.ClassIficationService;
|
import com.ruoyi.web.service.ClassIficationService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -21,6 +23,8 @@ public class ClassificationController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ClassIficationService classIficationService;
|
private ClassIficationService classIficationService;
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ClassificationController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取商品分类树
|
* 获取商品分类树
|
||||||
*
|
*
|
||||||
|
|
@ -28,8 +32,10 @@ public class ClassificationController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Anonymous
|
@Anonymous
|
||||||
@GetMapping(value = "/getTree/{storeId}")
|
@GetMapping(value = "/getTree/{storeId}")
|
||||||
public AjaxResult getClassIficationTree(@PathVariable String storeId) {
|
public AjaxResult getClassIficationTree(@PathVariable String storeId,
|
||||||
return AjaxResult.success(classIficationService.getIficationTree(storeId));
|
@RequestParam(required = false) String classificationName) {
|
||||||
|
log.info("获取商品分类树" + storeId);
|
||||||
|
return AjaxResult.success(classIficationService.getIficationTree(storeId,classificationName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,14 @@ import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.web.domain.Order;
|
import com.ruoyi.web.domain.Order;
|
||||||
import com.ruoyi.web.service.OrderService;
|
import com.ruoyi.web.service.OrderService;
|
||||||
|
import org.checkerframework.checker.units.qual.A;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,12 +26,13 @@ public class OrderController extends BaseController {
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取商品订单列表
|
* 查询订单列表
|
||||||
*/
|
*/
|
||||||
// @PreAuthorize("@ss.hasPermi('product:list')")
|
// @PreAuthorize("@ss.hasPermi('mall:order:list')")
|
||||||
@Anonymous
|
@Anonymous
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public AjaxResult list(Order order) {
|
public AjaxResult list(Order order) {
|
||||||
return AjaxResult.success(orderService.selectList(order));
|
return AjaxResult.success( orderService.selectOrderList(order));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -42,6 +42,7 @@ public class ProductStoreController extends BaseController {
|
||||||
return AjaxResult.success(productService.selectList(product));
|
return AjaxResult.success(productService.selectList(product));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除商品
|
* 批量删除商品
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品订单记录表 mall_order
|
* 商品订单记录表 mall_order
|
||||||
|
|
@ -39,14 +40,14 @@ public class Order extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private Integer payStatus;
|
private Integer payStatus;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品id
|
|
||||||
*/
|
|
||||||
private Integer productId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付时间
|
* 支付时间
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date payTime;
|
private Date payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单商品明细列表
|
||||||
|
*/
|
||||||
|
private List<OrderItem> orderItems;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.ruoyi.web.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单商品明细对象 mall_order_item
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderItem extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品ID
|
||||||
|
*/
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称(快照)
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品编号(快照)
|
||||||
|
*/
|
||||||
|
private String productNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品图片(快照)
|
||||||
|
*/
|
||||||
|
private String mainImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格
|
||||||
|
*/
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价(快照)
|
||||||
|
*/
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 购买数量
|
||||||
|
*/
|
||||||
|
private Integer quantity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小计金额
|
||||||
|
*/
|
||||||
|
private BigDecimal subtotal;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
public interface ClassIficationMapper {
|
public interface ClassIficationMapper {
|
||||||
|
|
||||||
|
|
||||||
List<Classification> selectRootBrands(String storeId);
|
List<Classification> selectRootBrands(@Param("storeId") String storeId);
|
||||||
|
|
||||||
|
|
||||||
List<Classification> selectByParentId(@Param("parentId") Long parentId);
|
List<Classification> selectByParentId(@Param("parentId") Long parentId);
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,6 @@ import java.util.List;
|
||||||
public interface OrderMapper {
|
public interface OrderMapper {
|
||||||
|
|
||||||
|
|
||||||
List<Order> selectList(Order order);
|
|
||||||
|
List<Order> selectOrderList(Order order);
|
||||||
}
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
||||||
public interface BrandService {
|
public interface BrandService {
|
||||||
|
|
||||||
// 获取品牌树(一级品牌包含子品牌)
|
// 获取品牌树(一级品牌包含子品牌)
|
||||||
List<Brand> getBrandTree(String storeId);
|
List<Brand> getBrandTree(String storeId,String brandName);
|
||||||
|
|
||||||
// 添加品牌
|
// 添加品牌
|
||||||
int addBrand(Brand brand);
|
int addBrand(Brand brand);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
||||||
|
|
||||||
public interface ClassIficationService {
|
public interface ClassIficationService {
|
||||||
|
|
||||||
List<Classification> getIficationTree(String storeId);
|
List<Classification> getIficationTree(String storeId,String classificationName);
|
||||||
|
|
||||||
int addClassification(Classification classification);
|
int addClassification(Classification classification);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface OrderService {
|
public interface OrderService {
|
||||||
|
|
||||||
List<Order> selectList(Order order);
|
|
||||||
|
List<Order> selectOrderList(Order order);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class BrandServiceImpl implements BrandService {
|
public class BrandServiceImpl implements BrandService {
|
||||||
|
|
@ -23,13 +24,41 @@ public class BrandServiceImpl implements BrandService {
|
||||||
private BrandMapper brandMapper;
|
private BrandMapper brandMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Brand> getBrandTree(String storeId) {
|
public List<Brand> getBrandTree(String storeId, String brandName) {
|
||||||
|
|
||||||
List<Brand> rootBrands = brandMapper.selectRootBrands(storeId);
|
List<Brand> rootBrands = brandMapper.selectRootBrands(storeId);
|
||||||
|
|
||||||
return buildTree(rootBrands);
|
List<Brand> brands = buildTree(rootBrands);
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(brandName)) {
|
||||||
|
return brands;
|
||||||
|
}
|
||||||
|
|
||||||
|
return brands.stream()
|
||||||
|
.filter(node -> containsName(node, brandName))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查节点或其子节点是否包含指定名称
|
||||||
|
*/
|
||||||
|
private boolean containsName(Brand node, String targetName) {
|
||||||
|
// 当前节点匹配
|
||||||
|
if (targetName.equals(node.getBrandName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 子节点中是否有匹配的
|
||||||
|
if (node.getChildren() != null) {
|
||||||
|
return node.getChildren().stream()
|
||||||
|
.anyMatch(child -> containsName(child, targetName));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private List<Brand> buildTree(List<Brand> allList) {
|
private List<Brand> buildTree(List<Brand> allList) {
|
||||||
List<Brand> rootList = new ArrayList<>();
|
List<Brand> rootList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ClassIficationServiceImpl implements ClassIficationService {
|
public class ClassIficationServiceImpl implements ClassIficationService {
|
||||||
|
|
@ -22,11 +23,36 @@ public class ClassIficationServiceImpl implements ClassIficationService {
|
||||||
private ClassIficationMapper classIficationMapper;
|
private ClassIficationMapper classIficationMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Classification> getIficationTree(String storeId) {
|
public List<Classification> getIficationTree(String storeId,String classificationName) {
|
||||||
List<Classification> rootBrands = classIficationMapper.selectRootBrands(storeId);
|
List<Classification> rootBrands = classIficationMapper.selectRootBrands(storeId);
|
||||||
|
|
||||||
// 构建树形结构
|
// 构建树形结构
|
||||||
return buildTree(rootBrands);
|
List<Classification> classifications = buildTree(rootBrands);
|
||||||
|
if (StringUtils.isEmpty(classificationName)) {
|
||||||
|
return classifications;
|
||||||
|
}
|
||||||
|
|
||||||
|
return classifications.stream()
|
||||||
|
.filter(node -> containsName(node, classificationName))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查节点或其子节点是否包含指定名称
|
||||||
|
*/
|
||||||
|
private boolean containsName(Classification node, String targetName) {
|
||||||
|
// 当前节点匹配
|
||||||
|
if (targetName.equals(node.getClassificationName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 子节点中是否有匹配的
|
||||||
|
if (node.getChildren() != null) {
|
||||||
|
return node.getChildren().stream()
|
||||||
|
.anyMatch(child -> containsName(child, targetName));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
@Resource
|
@Resource
|
||||||
private OrderMapper orderMapper;
|
private OrderMapper orderMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Order> selectList(Order order) {
|
public List<Order> selectOrderList(Order order) {
|
||||||
return orderMapper.selectList(order);
|
return orderMapper.selectOrderList(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,176 +4,87 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.web.mapper.OrderMapper">
|
<mapper namespace="com.ruoyi.web.mapper.OrderMapper">
|
||||||
|
|
||||||
<resultMap type="Order" id="MallOrderResult">
|
<!-- 基础结果映射 -->
|
||||||
<id property="id" column="id"/>
|
<resultMap type="Order" id="OrderResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
<result property="orderNo" column="order_no"/>
|
<result property="orderNo" column="order_no"/>
|
||||||
<result property="storeId" column="store_id"/>
|
<result property="storeId" column="store_id"/>
|
||||||
<result property="payAmount" column="pay_amount"/>
|
<result property="payAmount" column="pay_amount"/>
|
||||||
<result property="payTime" column="pay_time"/>
|
<result property="payTime" column="pay_time"/>
|
||||||
<result property="payStatus" column="pay_status"/>
|
<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="createTime" column="create_time"/>
|
||||||
<result property="updateBy" column="update_by"/>
|
|
||||||
<result property="updateTime" column="update_time"/>
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectCommodityVo">
|
<!-- 商品明细结果映射 -->
|
||||||
select id,
|
<resultMap type="OrderItem" id="OrderItemResult">
|
||||||
order_no,
|
<result property="id" column="item_id"/>
|
||||||
store_id,
|
<result property="orderId" column="order_id"/>
|
||||||
pay_amount,
|
<result property="productId" column="product_id"/>
|
||||||
pay_time,
|
<result property="productName" column="product_name"/>
|
||||||
pay_status,
|
<result property="productNo" column="product_no"/>
|
||||||
product_id,
|
<result property="mainImage" column="main_image"/>
|
||||||
create_by,
|
<result property="spec" column="spec"/>
|
||||||
create_time,
|
<result property="unitPrice" column="unit_price"/>
|
||||||
update_by,
|
<result property="quantity" column="quantity"/>
|
||||||
update_time
|
<result property="subtotal" column="subtotal"/>
|
||||||
from mall_order
|
<result property="createBy" column="item_create_by"/>
|
||||||
</sql>
|
<result property="createTime" column="item_create_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 包含商品明细的结果映射 -->
|
||||||
|
<resultMap type="Order" id="OrderWithItemsResult" extends="OrderResult">
|
||||||
|
<!-- 一对多关联:使用嵌套结果映射 -->
|
||||||
|
<collection property="orderItems" ofType="OrderItem" resultMap="OrderItemResult"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
<select id="selectOrderList" parameterType="Order" resultMap="OrderWithItemsResult">
|
||||||
where product_bar_code=#{productBarCode} and del_flag = '0' and store_id = #{storeId}
|
SELECT
|
||||||
<if test="id != null">
|
o.id,
|
||||||
AND id != #{id}
|
o.order_no,
|
||||||
|
o.store_id,
|
||||||
|
o.pay_amount,
|
||||||
|
o.pay_time,
|
||||||
|
o.pay_status,
|
||||||
|
o.create_time,
|
||||||
|
o.update_time,
|
||||||
|
o.del_flag,
|
||||||
|
o.create_by,
|
||||||
|
o.update_by,
|
||||||
|
oi.id as item_id,
|
||||||
|
oi.order_id,
|
||||||
|
oi.product_id,
|
||||||
|
oi.product_name,
|
||||||
|
oi.product_no,
|
||||||
|
oi.main_image,
|
||||||
|
oi.spec,
|
||||||
|
oi.unit_price,
|
||||||
|
oi.quantity,
|
||||||
|
oi.subtotal,
|
||||||
|
oi.del_flag as item_del_flag,
|
||||||
|
oi.create_by as item_create_by,
|
||||||
|
oi.create_time as item_create_time
|
||||||
|
FROM mall_order o
|
||||||
|
LEFT JOIN mall_order_item oi ON o.id = oi.order_id AND oi.del_flag = '0'
|
||||||
|
<where>
|
||||||
|
o.del_flag = '0'
|
||||||
|
<if test="orderNo != null and orderNo != ''">
|
||||||
|
AND o.order_no like concat('%', #{orderNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
limit 1
|
<if test="storeId != null">
|
||||||
|
AND o.store_id = #{storeId}
|
||||||
|
</if>
|
||||||
|
<if test="payStatus != null">
|
||||||
|
AND o.pay_status = #{payStatus}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY o.create_time DESC, oi.create_time ASC
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|
@ -62,18 +62,14 @@
|
||||||
<where>
|
<where>
|
||||||
del_flag = '0'
|
del_flag = '0'
|
||||||
<if test="productBarCode != null and productBarCode != ''">
|
<if test="productBarCode != null and productBarCode != ''">
|
||||||
AND product_bar_code = #{productBarCode}
|
AND product_bar_code like concat('%', #{productBarCode}, '%')
|
||||||
</if>
|
|
||||||
<if test="productName != null and productName != ''">
|
|
||||||
AND product_name like concat('%', #{productName}, '%')
|
|
||||||
</if>
|
</if>
|
||||||
<if test="storeId != null">
|
<if test="storeId != null">
|
||||||
AND store_id = #{storeId}
|
AND store_id = #{storeId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="stockQuantity != null">
|
||||||
<!-- 库存大于0条件 -->
|
AND stock_quantity = #{stockQuantity}
|
||||||
AND stock_quantity > 0
|
</if>
|
||||||
|
|
||||||
<if test="status != null and status != '' ">
|
<if test="status != null and status != '' ">
|
||||||
AND status = #{status}
|
AND status = #{status}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue