Bläddra i källkod

feat(items): 添加道具公共属性和赠送限制功能

- 在 Items 实体类中新增 isCommon、giveStopType 和 giveStopTime 字段
- 在 ItemsBo 业务对象中同步添加相关字段定义
- 在 ItemsVo 视图对象中添加对应的返回字段
- 更新 ItemsMapper.xml 中的 SQL 查询语句,包含新字段
- 在更新和插入操作的 XML 映射中添加新字段的处理逻辑
- 在 GiftTypeServiceImpl 删除方法中增加 TODO 注释提醒检查道具使用情况
fugui001 1 vecka sedan
förälder
incheckning
02d8c804d6

+ 4 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/Items.java

@@ -76,4 +76,8 @@ public class Items extends BaseEntity {
 
     private Long itemCount;
 
+    private Long isCommon;
+
+    private Long giveStopType;
+    private String giveStopTime;
 }

+ 4 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/bo/ItemsBo.java

@@ -87,4 +87,8 @@ public class ItemsBo extends BaseEntity {
 
     private Long itemCount;
 
+    private Long isCommon;
+
+    private Long giveStopType;
+    private String giveStopTime;
 }

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/domain/vo/ItemsVo.java

@@ -96,4 +96,9 @@ public class ItemsVo implements Serializable {
 
     private String giftTypeChildName;
 
+    private Long isCommon;
+
+    private Long giveStopType;
+    private String giveStopTime;
+
 }

+ 1 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/GiftTypeServiceImpl.java

@@ -140,6 +140,7 @@ public class GiftTypeServiceImpl implements IGiftTypeService {
                 throw new RuntimeException("存在子级数据,无法删除");
             }
         }
+        //todo 还需要判断 是否有道具在使用这个类型了
         return baseMapper.deleteGiftTypeById(ids) > 0;
     }
 

+ 15 - 5
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/ItemsMapper.xml

@@ -6,17 +6,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectVoPage" resultType="org.dromara.business.domain.vo.ItemsVo">
-        SELECT id, name, item_type,item_desc, created_at, updated_at,item_value,item_json,item_type_code,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count
+        SELECT id, name, item_type,item_desc, created_at, updated_at,item_value,item_json,item_type_code,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count,is_common,give_stop_type,give_stop_time
         FROM items ${ew.customSqlSegment}
     </select>
 
 
     <select id="selectItemsList" resultType="org.dromara.business.domain.vo.ItemsVo">
-        SELECT  id, name, item_type,item_desc, created_at, updated_at,item_value,item_json,item_type_code,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count FROM items  ${ew.customSqlSegment}
+        SELECT  id, name, item_type,item_desc, created_at, updated_at,item_value,item_json,item_type_code,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count,is_common,give_stop_type,give_stop_time FROM items  ${ew.customSqlSegment}
     </select>
 
     <select id="selectVoByIdInfo" resultType="org.dromara.business.domain.vo.ItemsVo">
-        SELECT  id, name, item_type,item_desc, created_at, updated_at,item_value,item_json,item_type_code,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count FROM items WHERE id =  #{id}
+        SELECT  id, name, item_type,item_desc, created_at, updated_at,item_value,item_json,item_type_code,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count,is_common,give_stop_type,give_stop_time FROM items WHERE id =  #{id}
     </select>
 
     <update id="updateItemsById">
@@ -65,12 +65,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="itemCount != null">
                 item_count = #{itemCount},
             </if>
+            <if test="isCommon != null">
+                is_common = #{isCommon},
+            </if>
+            give_stop_type = #{giveStopType},
+            give_stop_time = #{giveStopTime},
             updated_at = NOW()
         </set>
         WHERE id = #{id}
     </update>
 
-
     <insert id="insertItems" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO items
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -91,6 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
             <if test="isGiveAway != null">is_give_away,</if>
             <if test="itemCount != null">item_count,</if>
+            <if test="isCommon != null">is_common,</if>
+            <if test="giveStopType != null">give_stop_type,</if>
+            <if test="giveStopTime != null">give_stop_time,</if>
         </trim>
         <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
             <if test="name != null and name != ''">#{name},</if>
@@ -110,6 +117,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
             <if test="isGiveAway != null">#{isGiveAway},</if>
             <if test="itemCount != null">#{itemCount},</if>
+            <if test="isCommon != null">#{isCommon},</if>
+            <if test="giveStopType != null">#{giveStopType},</if>
+            <if test="giveStopTime != null">#{giveStopTime},</if>
         </trim>
     </insert>
 
@@ -128,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectItemsSelList" resultType="org.dromara.business.domain.vo.ItemsVo">
-        SELECT  id, name, item_type,item_desc, created_at, updated_at,item_value,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count FROM items
+        SELECT  id,is_common,name, item_type,item_desc, created_at, updated_at,item_value,effective_type,expire_time, effective_day, gift_type_parent_id, gift_type_child_id, item_url, is_give_away, item_count,give_stop_type,give_stop_time FROM items
     </select>
 
 </mapper>