Browse Source

价格表-添加字段

liyafei 2 ngày trước cách đây
mục cha
commit
358a3644dd

+ 6 - 2
alien-entity/src/main/java/shop/alien/entity/store/StoreProductItem.java

@@ -29,7 +29,7 @@ public class StoreProductItem implements Serializable {
     private Long id;
 
     @ApiModelProperty(value = "父id")
-    @TableField("pid")
+    @TableField(value = "pid", fill = FieldFill.INSERT)
     private Long pid;
 
     @ApiModelProperty(value = "门店id")
@@ -76,10 +76,14 @@ public class StoreProductItem implements Serializable {
     @TableField("usage_rule")
     private String usageRule;
 
-    @ApiModelProperty(value = "状态:0禁用,1启用")
+    @ApiModelProperty(value = "状态:0-待审核 1-审核通过 2-审核拒绝")
     @TableField("status")
     private Integer status;
 
+    @ApiModelProperty(value = "拒绝原因")
+    @TableField("rejection_reason")
+    private String rejectionReason;
+
     @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
     @TableField("delete_flag")
     @TableLogic

+ 37 - 0
alien-entity/src/main/resources/mapper/StoreProductItemMapper.xml

@@ -0,0 +1,37 @@
+<?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="shop.alien.mapper.StoreProductItemMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="shop.alien.entity.store.StoreProductItem">
+        <id column="id" property="id" />
+        <result column="pid" property="pid" />
+        <result column="store_id" property="storeId" />
+        <result column="prod_name" property="prodName" />
+        <result column="prod_type" property="prodType" />
+        <result column="images" property="images" />
+        <result column="image_content" property="imageContent" />
+        <result column="detail_content" property="detailContent" />
+        <result column="extra_note" property="extraNote" />
+        <result column="need_reserve" property="needReserve" />
+        <result column="reserve_rule" property="reserveRule" />
+        <result column="people_limit" property="peopleLimit" />
+        <result column="usage_rule" property="usageRule" />
+        <result column="status" property="status" />
+        <result column="rejection_reason" property="rejectionReason" />
+        <result column="delete_flag" property="deleteFlag" />
+        <result column="created_user_id" property="createdUserId" />
+        <result column="updated_user_id" property="updatedUserId" />
+        <result column="created_time" property="createdTime" />
+        <result column="updated_time" property="updatedTime" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, pid, store_id, prod_name, prod_type, images, image_content, detail_content, 
+        extra_note, need_reserve, reserve_rule, people_limit, usage_rule, status, 
+        rejection_reason, delete_flag, created_user_id, updated_user_id, created_time, updated_time
+    </sql>
+
+</mapper>
+

+ 66 - 64
alien-store/src/main/java/shop/alien/store/config/MyBatisFieldHandler.java

@@ -1,64 +1,66 @@
-package shop.alien.store.config;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.reflection.MetaObject;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-import shop.alien.util.common.JwtUtil;
-
-import java.util.Date;
-import java.util.Objects;
-
-/**
- * Mybatis日期填充
- *
- * @author ssk
- * @version 1.0
- * @date 2024/12/6 10:19
- */
-@Component
-@Slf4j
-public class MyBatisFieldHandler implements MetaObjectHandler {
-
-    /**
-     * insert操作时填充方法
-     *
-     * @param metaObject 元对象
-     */
-    @Override
-    public void insertFill(MetaObject metaObject) {
-        log.info("=================================insertFill=========================================");
-        System.out.println(metaObject.getOriginalObject());
-        //字段为实体类名, 不是表字段名
-        this.setFieldValByName("createdTime", new Date(), metaObject);
-        this.setFieldValByName("updatedTime", new Date(), metaObject);
-        if (JwtUtil.hasToken()) {
-            this.setFieldValByName("createdUserId", Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getInteger("userId"), metaObject);
-            this.setFieldValByName("updatedUserId", Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getInteger("userId"), metaObject);
-        } else {
-            this.setFieldValByName("createdUserId", 0, metaObject);
-            this.setFieldValByName("updatedUserId", 0, metaObject);
-        }
-    }
-
-    /**
-     * update操作时填充方法
-     *
-     * @param metaObject 元对象
-     */
-    @Override
-    public void updateFill(MetaObject metaObject) {
-        log.info("=================================updateFill=========================================");
-        //字段为实体类名, 不是表字段名
-        this.setFieldValByName("updatedTime", new Date(), metaObject);
-        if (JwtUtil.hasToken()) {
-            this.setFieldValByName("updatedUserId", Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getInteger("userId"), metaObject);
-        } else {
-            this.setFieldValByName("updatedUserId", 0, metaObject);
-        }
-    }
-}
+package shop.alien.store.config;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.reflection.MetaObject;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import shop.alien.util.common.JwtUtil;
+
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * Mybatis日期填充
+ *
+ * @author ssk
+ * @version 1.0
+ * @date 2024/12/6 10:19
+ */
+@Component
+@Slf4j
+public class MyBatisFieldHandler implements MetaObjectHandler {
+
+    /**
+     * insert操作时填充方法
+     *
+     * @param metaObject 元对象
+     */
+    @Override
+    public void insertFill(MetaObject metaObject) {
+        log.info("=================================insertFill=========================================");
+        System.out.println(metaObject.getOriginalObject());
+        //字段为实体类名, 不是表字段名
+        this.setFieldValByName("createdTime", new Date(), metaObject);
+        this.setFieldValByName("updatedTime", new Date(), metaObject);
+        // 设置pid默认值为0
+        this.setFieldValByName("pid", 0L, metaObject);
+        if (JwtUtil.hasToken()) {
+            this.setFieldValByName("createdUserId", Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getInteger("userId"), metaObject);
+            this.setFieldValByName("updatedUserId", Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getInteger("userId"), metaObject);
+        } else {
+            this.setFieldValByName("createdUserId", 0, metaObject);
+            this.setFieldValByName("updatedUserId", 0, metaObject);
+        }
+    }
+
+    /**
+     * update操作时填充方法
+     *
+     * @param metaObject 元对象
+     */
+    @Override
+    public void updateFill(MetaObject metaObject) {
+        log.info("=================================updateFill=========================================");
+        //字段为实体类名, 不是表字段名
+        this.setFieldValByName("updatedTime", new Date(), metaObject);
+        if (JwtUtil.hasToken()) {
+            this.setFieldValByName("updatedUserId", Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getInteger("userId"), metaObject);
+        } else {
+            this.setFieldValByName("updatedUserId", 0, metaObject);
+        }
+    }
+}

+ 4 - 2
alien-store/src/main/java/shop/alien/store/controller/StoreProductItemController.java

@@ -81,7 +81,8 @@ public class StoreProductItemController {
             @ApiImplicitParam(name = "prodName", value = "商品名称", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "prodType", value = "商品类型(1酒吧-酒水 2酒吧-餐食 3美食-餐食 4运动健身-单次 5运动健身-多次)", dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "needReserve", value = "是否需要预约(0=否,1=是)", dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "status", value = "状态(0禁用,1启用)", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "status", value = "状态(0-待审核 1-审核通过 2-审核拒绝)", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "rejectionReason", value = "拒绝原因", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "createdTime_Start", value = "创建时间开始(范围查询)", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "createdTime_End", value = "创建时间结束(范围查询)", dataType = "String", paramType = "query")
     })
@@ -105,7 +106,8 @@ public class StoreProductItemController {
             @ApiImplicitParam(name = "prodName", value = "商品名称", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "prodType", value = "商品类型(1酒吧-酒水 2酒吧-餐食 3美食-餐食 4运动健身-单次 5运动健身-多次)", dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "needReserve", value = "是否需要预约(0=否,1=是)", dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "status", value = "状态(0禁用,1启用)", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "status", value = "状态(0-待审核 1-审核通过 2-审核拒绝)", dataType = "Integer", paramType = "query"),
+            @ApiImplicitParam(name = "rejectionReason", value = "拒绝原因", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "createdTime_Start", value = "创建时间开始(范围查询)", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "createdTime_End", value = "创建时间结束(范围查询)", dataType = "String", paramType = "query")
     })