From 6f059454437172bbfb5901041e680382e21076f2 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期四, 14 八月 2025 09:43:46 +0800 Subject: [PATCH] 抽奖功能基础类 --- framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml | 62 + framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeDrawServiceImpl.java | 119 ++ framework/src/main/java/cn/lili/modules/lmk/service/PrizeDrawService.java | 65 + framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeRecordVO.java | 75 + framework/src/main/resources/mapper/lmk/PrizeDrawMapper.xml | 56 + framework/src/main/java/cn/lili/modules/lmk/service/PrizeActivityService.java | 65 + framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java | 119 ++ framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeNumberServiceImpl.java | 119 ++ framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeDrawForm.java | 62 + framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeRecord.java | 66 + framework/src/main/java/cn/lili/modules/Demo_1.java | 121 ++ framework/src/main/java/cn/lili/modules/lmk/service/ActivityRefPrizeService.java | 65 + framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActivityRefPrizeVO.java | 61 + framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeNumberMapper.java | 34 framework/src/main/resources/mapper/lmk/PrizeRecordMapper.xml | 68 + framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeDraw.java | 50 + framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeActivityMapper.java | 34 framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java | 119 ++ framework/src/main/resources/mapper/lmk/ActivityRefPrizeMapper.xml | 56 + framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeActivityQuery.java | 22 framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeActivity.java | 59 + framework/src/main/resources/mapper/lmk/PrizeNumberMapper.xml | 47 + framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeNumberQuery.java | 22 framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeRecordServiceImpl.java | 119 ++ framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeNumber.java | 38 framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeDrawVO.java | 59 + framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeDrawMapper.java | 34 framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeNumberVO.java | 47 + framework/src/main/java/cn/lili/modules/lmk/mapper/ActivityRefPrizeMapper.java | 34 framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeDrawQuery.java | 22 framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeActivityVO.java | 67 + framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeNumberForm.java | 50 + framework/src/main/java/cn/lili/modules/lmk/service/PrizeRecordService.java | 65 + framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeRecordQuery.java | 22 framework/src/main/java/cn/lili/modules/lmk/domain/form/ActivityRefPrizeForm.java | 64 + framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeRecordForm.java | 78 + framework/src/main/java/cn/lili/modules/lmk/domain/query/ActivityRefPrizeQuery.java | 22 framework/src/main/java/cn/lili/modules/lmk/service/PrizeNumberService.java | 65 + framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeRecordMapper.java | 34 framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeActivityForm.java | 70 + framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActivityRefPrize.java | 51 + 41 files changed, 2,507 insertions(+), 0 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/Demo_1.java b/framework/src/main/java/cn/lili/modules/Demo_1.java new file mode 100644 index 0000000..36f55fb --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/Demo_1.java @@ -0,0 +1,121 @@ +package cn.lili.modules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.*; + +public class Demo_1 { + + // 濂栧搧绫� + static class Prize { + private String name; // 濂栧搧鍚嶇О + private double probability; // 涓姒傜巼(0-1涔嬮棿) + + public Prize(String name, double probability) { + this.name = name; + this.probability = probability; + } + + public String getName() { + return name; + } + + public double getProbability() { + return probability; + } + } + + // 鎶藉绯荤粺绫� + public static class LotterySystem { + private List<Prize> prizes; + private List<Double> probabilityIntervals; + private Random random; + + public LotterySystem(List<Prize> prizes) { + // 楠岃瘉姒傜巼鎬诲拰鏄惁涓�1 + double totalProbability = 0; + for (Prize prize : prizes) { + totalProbability += prize.getProbability(); + } + + // 濡傛灉鎬诲拰涓嶆槸1锛岃繘琛屽綊涓�鍖栧鐞� + if (Math.abs(totalProbability - 1.0) > 0.0001) { + List<Prize> normalizedPrizes = new ArrayList<>(); + for (Prize prize : prizes) { + normalizedPrizes.add(new Prize( + prize.getName(), + prize.getProbability() / totalProbability + )); + } + this.prizes = normalizedPrizes; + } else { + this.prizes = prizes; + } + + // 鍒濆鍖栨鐜囧尯闂� + initProbabilityIntervals(); + this.random = new Random(); + } + + // 鍒濆鍖栨鐜囧尯闂� + private void initProbabilityIntervals() { + probabilityIntervals = new ArrayList<>(); + double current = 0; + + for (Prize prize : prizes) { + current += prize.getProbability(); + probabilityIntervals.add(current); + } + } + + // 鎵ц鎶藉 + public String draw() { + // 鐢熸垚0-1涔嬮棿鐨勯殢鏈烘暟 + double randomValue = random.nextDouble(); + + // 鏌ユ壘闅忔満鏁拌惤鍦ㄥ摢涓尯闂� + for (int i = 0; i < probabilityIntervals.size(); i++) { + if (randomValue < probabilityIntervals.get(i)) { + return prizes.get(i).getName(); + } + } + + // 鐞嗚涓婁笉浼氳蛋鍒拌繖閲� + return "鏈腑濂�"; + } + + // 娴嬭瘯鎶藉绯荤粺 + public static void main(String[] args) { + // 鍒涘缓5涓鍝侊紝璁剧疆涓嶅悓鐨勪腑濂栨鐜� + List<Prize> prizes = new ArrayList<>(); + prizes.add(new Prize("涓�绛夊", 0.01)); // 1%姒傜巼 + prizes.add(new Prize("浜岀瓑濂�", 0.05)); // 5%姒傜巼 + prizes.add(new Prize("涓夌瓑濂�", 0.1)); // 10%姒傜巼 + prizes.add(new Prize("鍥涚瓑濂�", 0.2)); // 20%姒傜巼 + prizes.add(new Prize("浜旂瓑濂�", 0.64)); // 64%姒傜巼 + + // 鍒涘缓鎶藉绯荤粺 + LotterySystem lottery = new LotterySystem(prizes); + + // 娴嬭瘯10000娆℃娊濂栵紝鏌ョ湅姒傜巼鍒嗗竷 + Map<String, Integer> result = new HashMap<>(); + int totalDraws = 100000; + + for (int i = 0; i < totalDraws; i++) { + String prizeName = lottery.draw(); + result.put(prizeName, result.getOrDefault(prizeName, 0) + 1); + } + + // 杈撳嚭缁撴灉 + System.out.println("鎶藉" + totalDraws + "娆$殑缁撴灉锛�"); + for (Map.Entry<String, Integer> entry : result.entrySet()) { + double percentage = (entry.getValue() * 100.0) / totalDraws; + System.out.printf("%s: %d娆� (%.2f%%)\n", + entry.getKey(), entry.getValue(), percentage); + } + } + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActivityRefPrize.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActivityRefPrize.java new file mode 100644 index 0000000..f67cfcf --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActivityRefPrize.java @@ -0,0 +1,51 @@ +package cn.lili.modules.lmk.domain.entity; + +import cn.lili.mybatis.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import lombok.Data; + +/** + * 娲诲姩濂栧搧鍏宠仈琛� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@TableName("lmk_activity_ref_prize") +public class ActivityRefPrize extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("prize_activity_id") + /** 鎶藉娲诲姩id */ + private Long prizeActivityId; + + @TableField("prize_id") + /** 濂栧搧id */ + private Long prizeId; + + @TableField("prize_content") + /** 濂栧搧鍐呭 */ + private String prizeContent; + + @TableField("prize_num") + /** 濂栧搧鏁伴噺 */ + private Integer prizeNum; + + @TableField("prize_probability") + /** 涓皢姒傜巼 */ + private BigDecimal prizeProbability; + + @TableField("version") + /** 涔愯閿� */ + private Integer version; + + @TableField("remain_num") + /** 鍓╀綑鏁伴噺 */ + private Integer remainNum; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeActivity.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeActivity.java new file mode 100644 index 0000000..4476df2 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeActivity.java @@ -0,0 +1,59 @@ +package cn.lili.modules.lmk.domain.entity; + +import cn.lili.mybatis.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Data; + +/** + * 鎶藉娲诲姩 + * + * @author peng + * @since 2025-08-14 + */ +@Data +@TableName("lmk_prize_activity") +public class PrizeActivity extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("activity_name") + /** 娲诲姩鍚嶇О */ + private String activityName; + + @TableField("activity_des") + /** 娲诲姩鎻忚堪 */ + private String activityDes; + + @TableField("begin_time") + /** 娲诲姩寮�濮嬫椂闂� */ + private LocalDateTime beginTime; + + @TableField("end_time") + /** 娲诲姩缁撴潫鏃堕棿 */ + private LocalDateTime endTime; + + @TableField("max_prize") + /** 姣忔棩鏈�澶ф娊濂栦笂闄� */ + private Integer maxPrize; + + @TableField("prize_num") + /** 鍒濆鍖栨娊濂栨鏁� */ + private Integer prizeNum; + + @TableField("activity_img") + /** 娲诲姩鍥剧墖 */ + private String activityImg; + + @TableField("activity_cover") + /** 娲诲姩灏侀潰 */ + private String activityCover; + + @TableField("enable_status") + /** 鏄惁寮�鍚椿鍔� */ + private String enableStatus; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeDraw.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeDraw.java new file mode 100644 index 0000000..795b0bc --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeDraw.java @@ -0,0 +1,50 @@ +package cn.lili.modules.lmk.domain.entity; + +import cn.lili.mybatis.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import lombok.Data; + +/** + * 鎶藉娲诲姩濂栧搧 + * + * @author peng + * @since 2025-08-14 + */ +@Data +@TableName("lmk_prize_draw") +public class PrizeDraw extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("prize_name") + /** 濂栧搧鍚嶇О */ + private String prizeName; + + @TableField("prize_type") + /** 濂栧搧绫诲瀷 */ + private String prizeType; + + @TableField("coupon_id") + /** 浼樻儬鍗穒d */ + private Long couponId; + + @TableField("prize_content") + /** 濂栧搧鍐呭 */ + private String prizeContent; + + @TableField("prize_cover") + /** 濂栧搧灏侀潰 */ + private String prizeCover; + + @TableField("prize_des") + /** 濂栧搧鎻忚堪 */ + private String prizeDes; + + @TableField("prize_img") + /** 濂栧搧鍥剧墖 */ + private String prizeImg; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeNumber.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeNumber.java new file mode 100644 index 0000000..0098664 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeNumber.java @@ -0,0 +1,38 @@ +package cn.lili.modules.lmk.domain.entity; + +import cn.lili.mybatis.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import lombok.Data; + +/** + * 鑾峰彇鎶藉娆℃暟璁板綍琛� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@TableName("lmk_prize_number") +public class PrizeNumber extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("user_id") + /** 鐢ㄦ埛id */ + private Long userId; + + @TableField("activity_prize_id") + /** 鎶藉娲诲姩id */ + private Long activityPrizeId; + + @TableField("user_action") + /** 鐢ㄦ埛琛屼负 */ + private String userAction; + + @TableField("use_status") + /** 浣跨敤鐘舵�� */ + private String useStatus; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeRecord.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeRecord.java new file mode 100644 index 0000000..21fe4e4 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeRecord.java @@ -0,0 +1,66 @@ +package cn.lili.modules.lmk.domain.entity; + +import cn.lili.mybatis.BaseEntity; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import lombok.Data; + +/** + * 鐢ㄦ埛鎶藉璁板綍琛� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@TableName("lmk_prize_record") +public class PrizeRecord extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("user_id") + /** 鐢ㄦ埛id */ + private Long userId; + + @TableField("nick_name") + /** 鐢ㄦ埛鏄电О */ + private String nickName; + + @TableField("prize_activity_id") + /** 娲诲姩id */ + private Long prizeActivityId; + + @TableField("prize_activity_name") + /** 娲诲姩鍚嶇О */ + private String prizeActivityName; + + @TableField("prize_activity_cover") + /** 娲诲姩灏侀潰 */ + private String prizeActivityCover; + + @TableField("prize_status") + /** 涓鐘舵�� */ + private String prizeStatus; + + @TableField("prize_content") + /** 涓鍐呭 */ + private String prizeContent; + + @TableField("prize_id") + /** 濂栧搧id */ + private Long prizeId; + + @TableField("prize_img") + /** 濂栧搧灏侀潰 */ + private String prizeImg; + + @TableField("prize_num_id") + /** 鎶藉娆℃暟琛╥d */ + private Long prizeNumId; + + @TableField("activity_prize_ref_id") + /** 娲诲姩濂栧搧鍏宠仈琛╥d */ + private Long activityPrizeRefId; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/ActivityRefPrizeForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/ActivityRefPrizeForm.java new file mode 100644 index 0000000..50bd893 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/ActivityRefPrizeForm.java @@ -0,0 +1,64 @@ +package cn.lili.modules.lmk.domain.form; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import cn.lili.base.AbsForm; +import cn.lili.modules.lmk.domain.entity.ActivityRefPrize; +import org.springframework.beans.BeanUtils; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.lang.NonNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 娲诲姩濂栧搧鍏宠仈琛ㄨ〃鍗� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "ActivityRefPrize琛ㄥ崟", description = "娲诲姩濂栧搧鍏宠仈琛ㄨ〃鍗�") +public class ActivityRefPrizeForm extends AbsForm { + + @NotNull(message = "鎶藉娲诲姩id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鎶藉娲诲姩id") + private Long prizeActivityId; + + @NotNull(message = "濂栧搧id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧id") + private Long prizeId; + + @NotBlank(message = "濂栧搧鍐呭涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧鍐呭") + private String prizeContent; + + @NotNull(message = "濂栧搧鏁伴噺涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧鏁伴噺") + private Integer prizeNum; + + @NotNull(message = "涓皢姒傜巼涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("涓皢姒傜巼") + private BigDecimal prizeProbability; + + @NotNull(message = "涔愯閿佷笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("涔愯閿�") + private Integer version; + + @NotNull(message = "鍓╀綑鏁伴噺涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鍓╀綑鏁伴噺") + private Integer remainNum; + + public static ActivityRefPrize getEntityByForm(@NonNull ActivityRefPrizeForm form, ActivityRefPrize entity) { + if(entity == null) { + entity = new ActivityRefPrize(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeActivityForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeActivityForm.java new file mode 100644 index 0000000..55df9b1 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeActivityForm.java @@ -0,0 +1,70 @@ +package cn.lili.modules.lmk.domain.form; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import cn.lili.base.AbsForm; +import cn.lili.modules.lmk.domain.entity.PrizeActivity; +import org.springframework.beans.BeanUtils; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.lang.NonNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鎶藉娲诲姩琛ㄥ崟 + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeActivity琛ㄥ崟", description = "鎶藉娲诲姩琛ㄥ崟") +public class PrizeActivityForm extends AbsForm { + + @NotBlank(message = "娲诲姩鍚嶇О涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩鍚嶇О") + private String activityName; + + @NotBlank(message = "娲诲姩鎻忚堪涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩鎻忚堪") + private String activityDes; + + @NotNull(message = "娲诲姩寮�濮嬫椂闂翠笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩寮�濮嬫椂闂�") + private Date beginTime; + + @NotNull(message = "娲诲姩缁撴潫鏃堕棿涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩缁撴潫鏃堕棿") + private Date endTime; + + @NotNull(message = "姣忔棩鏈�澶ф娊濂栦笂闄愪笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("姣忔棩鏈�澶ф娊濂栦笂闄�") + private Integer maxPrize; + + @NotNull(message = "鍒濆鍖栨娊濂栨鏁颁笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("鍒濆鍖栨娊濂栨鏁�") + private Integer prizeNum; + + @NotBlank(message = "娲诲姩鍥剧墖涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩鍥剧墖") + private String activityImg; + + @NotBlank(message = "娲诲姩灏侀潰涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩灏侀潰") + private String activityCover; + + @NotBlank(message = "鏄惁寮�鍚椿鍔ㄤ笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("鏄惁寮�鍚椿鍔�") + private String enableStatus; + + public static PrizeActivity getEntityByForm(@NonNull PrizeActivityForm form, PrizeActivity entity) { + if(entity == null) { + entity = new PrizeActivity(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeDrawForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeDrawForm.java new file mode 100644 index 0000000..2d2e83c --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeDrawForm.java @@ -0,0 +1,62 @@ +package cn.lili.modules.lmk.domain.form; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import cn.lili.base.AbsForm; +import cn.lili.modules.lmk.domain.entity.PrizeDraw; +import org.springframework.beans.BeanUtils; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.lang.NonNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鎶藉娲诲姩濂栧搧琛ㄥ崟 + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeDraw琛ㄥ崟", description = "鎶藉娲诲姩濂栧搧琛ㄥ崟") +public class PrizeDrawForm extends AbsForm { + + @NotBlank(message = "濂栧搧鍚嶇О涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧鍚嶇О") + private String prizeName; + + @NotBlank(message = "濂栧搧绫诲瀷涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧绫诲瀷") + private String prizeType; + + @NotNull(message = "浼樻儬鍗穒d涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("浼樻儬鍗穒d") + private Long couponId; + + @NotBlank(message = "濂栧搧鍐呭涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧鍐呭") + private String prizeContent; + + @NotBlank(message = "濂栧搧灏侀潰涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧灏侀潰") + private String prizeCover; + + @NotBlank(message = "濂栧搧鎻忚堪涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧鎻忚堪") + private String prizeDes; + + @NotBlank(message = "濂栧搧鍥剧墖涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧鍥剧墖") + private String prizeImg; + + public static PrizeDraw getEntityByForm(@NonNull PrizeDrawForm form, PrizeDraw entity) { + if(entity == null) { + entity = new PrizeDraw(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeNumberForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeNumberForm.java new file mode 100644 index 0000000..5f96a42 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeNumberForm.java @@ -0,0 +1,50 @@ +package cn.lili.modules.lmk.domain.form; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import cn.lili.base.AbsForm; +import cn.lili.modules.lmk.domain.entity.PrizeNumber; +import org.springframework.beans.BeanUtils; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.lang.NonNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鑾峰彇鎶藉娆℃暟璁板綍琛ㄨ〃鍗� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeNumber琛ㄥ崟", description = "鑾峰彇鎶藉娆℃暟璁板綍琛ㄨ〃鍗�") +public class PrizeNumberForm extends AbsForm { + + @NotNull(message = "鐢ㄦ埛id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + @NotNull(message = "鎶藉娲诲姩id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鎶藉娲诲姩id") + private Long activityPrizeId; + + @NotBlank(message = "鐢ㄦ埛琛屼负涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鐢ㄦ埛琛屼负") + private String userAction; + + @NotBlank(message = "浣跨敤鐘舵�佷笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("浣跨敤鐘舵��") + private String useStatus; + + public static PrizeNumber getEntityByForm(@NonNull PrizeNumberForm form, PrizeNumber entity) { + if(entity == null) { + entity = new PrizeNumber(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeRecordForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeRecordForm.java new file mode 100644 index 0000000..b364910 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeRecordForm.java @@ -0,0 +1,78 @@ +package cn.lili.modules.lmk.domain.form; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import cn.lili.base.AbsForm; +import cn.lili.modules.lmk.domain.entity.PrizeRecord; +import org.springframework.beans.BeanUtils; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import org.springframework.lang.NonNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鐢ㄦ埛鎶藉璁板綍琛ㄨ〃鍗� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeRecord琛ㄥ崟", description = "鐢ㄦ埛鎶藉璁板綍琛ㄨ〃鍗�") +public class PrizeRecordForm extends AbsForm { + + @NotNull(message = "鐢ㄦ埛id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + @NotBlank(message = "鐢ㄦ埛鏄电О涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鐢ㄦ埛鏄电О") + private String nickName; + + @NotNull(message = "娲诲姩id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩id") + private Long prizeActivityId; + + @NotBlank(message = "娲诲姩鍚嶇О涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩鍚嶇О") + private String prizeActivityName; + + @NotBlank(message = "娲诲姩灏侀潰涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩灏侀潰") + private String prizeActivityCover; + + @NotBlank(message = "涓鐘舵�佷笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("涓鐘舵��") + private String prizeStatus; + + @NotBlank(message = "涓鍐呭涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("涓鍐呭") + private String prizeContent; + + @NotNull(message = "濂栧搧id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧id") + private Long prizeId; + + @NotBlank(message = "濂栧搧灏侀潰涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("濂栧搧灏侀潰") + private String prizeImg; + + @NotNull(message = "鎶藉娆℃暟琛╥d涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鎶藉娆℃暟琛╥d") + private Long prizeNumId; + + @NotNull(message = "娲诲姩濂栧搧鍏宠仈琛╥d涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("娲诲姩濂栧搧鍏宠仈琛╥d") + private Long activityPrizeRefId; + + public static PrizeRecord getEntityByForm(@NonNull PrizeRecordForm form, PrizeRecord entity) { + if(entity == null) { + entity = new PrizeRecord(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/ActivityRefPrizeQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/ActivityRefPrizeQuery.java new file mode 100644 index 0000000..62f733a --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/ActivityRefPrizeQuery.java @@ -0,0 +1,22 @@ +package cn.lili.modules.lmk.domain.query; + +import cn.lili.base.AbsQuery; +import java.util.List; +import org.springframework.lang.NonNull; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 娲诲姩濂栧搧鍏宠仈琛ㄦ煡璇� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "ActivityRefPrize鏌ヨ鍙傛暟", description = "娲诲姩濂栧搧鍏宠仈琛ㄦ煡璇㈠弬鏁�") +public class ActivityRefPrizeQuery extends AbsQuery { +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeActivityQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeActivityQuery.java new file mode 100644 index 0000000..8e930f0 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeActivityQuery.java @@ -0,0 +1,22 @@ +package cn.lili.modules.lmk.domain.query; + +import cn.lili.base.AbsQuery; +import java.util.List; +import org.springframework.lang.NonNull; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 鎶藉娲诲姩鏌ヨ + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeActivity鏌ヨ鍙傛暟", description = "鎶藉娲诲姩鏌ヨ鍙傛暟") +public class PrizeActivityQuery extends AbsQuery { +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeDrawQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeDrawQuery.java new file mode 100644 index 0000000..7c996b2 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeDrawQuery.java @@ -0,0 +1,22 @@ +package cn.lili.modules.lmk.domain.query; + +import cn.lili.base.AbsQuery; +import java.util.List; +import org.springframework.lang.NonNull; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 鎶藉娲诲姩濂栧搧鏌ヨ + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeDraw鏌ヨ鍙傛暟", description = "鎶藉娲诲姩濂栧搧鏌ヨ鍙傛暟") +public class PrizeDrawQuery extends AbsQuery { +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeNumberQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeNumberQuery.java new file mode 100644 index 0000000..5cc5c3c --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeNumberQuery.java @@ -0,0 +1,22 @@ +package cn.lili.modules.lmk.domain.query; + +import cn.lili.base.AbsQuery; +import java.util.List; +import org.springframework.lang.NonNull; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 鑾峰彇鎶藉娆℃暟璁板綍琛ㄦ煡璇� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeNumber鏌ヨ鍙傛暟", description = "鑾峰彇鎶藉娆℃暟璁板綍琛ㄦ煡璇㈠弬鏁�") +public class PrizeNumberQuery extends AbsQuery { +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeRecordQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeRecordQuery.java new file mode 100644 index 0000000..e05030d --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeRecordQuery.java @@ -0,0 +1,22 @@ +package cn.lili.modules.lmk.domain.query; + +import cn.lili.base.AbsQuery; +import java.util.List; +import org.springframework.lang.NonNull; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 鐢ㄦ埛鎶藉璁板綍琛ㄦ煡璇� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "PrizeRecord鏌ヨ鍙傛暟", description = "鐢ㄦ埛鎶藉璁板綍琛ㄦ煡璇㈠弬鏁�") +public class PrizeRecordQuery extends AbsQuery { +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActivityRefPrizeVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActivityRefPrizeVO.java new file mode 100644 index 0000000..5e12626 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActivityRefPrizeVO.java @@ -0,0 +1,61 @@ +package cn.lili.modules.lmk.domain.vo; + +import cn.lili.base.AbsVo; +import cn.lili.modules.lmk.domain.entity.ActivityRefPrize; + +import java.math.BigDecimal; +import java.util.List; +import org.springframework.lang.NonNull; +import org.springframework.beans.BeanUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 娲诲姩濂栧搧鍏宠仈琛ㄥ睍绀� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "娲诲姩濂栧搧鍏宠仈琛ㄥ搷搴旀暟鎹�", description = "娲诲姩濂栧搧鍏宠仈琛ㄥ搷搴旀暟鎹�") +public class ActivityRefPrizeVO extends AbsVo { + + /** 鎶藉娲诲姩id */ + @ApiModelProperty("鎶藉娲诲姩id") + private Long prizeActivityId; + + /** 濂栧搧id */ + @ApiModelProperty("濂栧搧id") + private Long prizeId; + + /** 濂栧搧鍐呭 */ + @ApiModelProperty("濂栧搧鍐呭") + private String prizeContent; + + /** 濂栧搧鏁伴噺 */ + @ApiModelProperty("濂栧搧鏁伴噺") + private Integer prizeNum; + + /** 涓皢姒傜巼 */ + @ApiModelProperty("涓皢姒傜巼") + private BigDecimal prizeProbability; + + /** 涔愯閿� */ + @ApiModelProperty("涔愯閿�") + private Integer version; + + /** 鍓╀綑鏁伴噺 */ + @ApiModelProperty("鍓╀綑鏁伴噺") + private Integer remainNum; + + public static ActivityRefPrizeVO getVoByEntity(@NonNull ActivityRefPrize entity, ActivityRefPrizeVO vo) { + if(vo == null) { + vo = new ActivityRefPrizeVO(); + } + BeanUtils.copyProperties(entity, vo); + return vo; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeActivityVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeActivityVO.java new file mode 100644 index 0000000..909c628 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeActivityVO.java @@ -0,0 +1,67 @@ +package cn.lili.modules.lmk.domain.vo; + +import cn.lili.base.AbsVo; +import cn.lili.modules.lmk.domain.entity.PrizeActivity; +import java.util.List; +import org.springframework.lang.NonNull; +import org.springframework.beans.BeanUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鎶藉娲诲姩灞曠ず + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "鎶藉娲诲姩鍝嶅簲鏁版嵁", description = "鎶藉娲诲姩鍝嶅簲鏁版嵁") +public class PrizeActivityVO extends AbsVo { + + /** 娲诲姩鍚嶇О */ + @ApiModelProperty("娲诲姩鍚嶇О") + private String activityName; + + /** 娲诲姩鎻忚堪 */ + @ApiModelProperty("娲诲姩鎻忚堪") + private String activityDes; + + /** 娲诲姩寮�濮嬫椂闂� */ + @ApiModelProperty("娲诲姩寮�濮嬫椂闂�") + private Date beginTime; + + /** 娲诲姩缁撴潫鏃堕棿 */ + @ApiModelProperty("娲诲姩缁撴潫鏃堕棿") + private Date endTime; + + /** 姣忔棩鏈�澶ф娊濂栦笂闄� */ + @ApiModelProperty("姣忔棩鏈�澶ф娊濂栦笂闄�") + private Integer maxPrize; + + /** 鍒濆鍖栨娊濂栨鏁� */ + @ApiModelProperty("鍒濆鍖栨娊濂栨鏁�") + private Integer prizeNum; + + /** 娲诲姩鍥剧墖 */ + @ApiModelProperty("娲诲姩鍥剧墖") + private String activityImg; + + /** 娲诲姩灏侀潰 */ + @ApiModelProperty("娲诲姩灏侀潰") + private String activityCover; + + /** 鏄惁寮�鍚椿鍔� */ + @ApiModelProperty("鏄惁寮�鍚椿鍔�") + private String enableStatus; + + public static PrizeActivityVO getVoByEntity(@NonNull PrizeActivity entity, PrizeActivityVO vo) { + if(vo == null) { + vo = new PrizeActivityVO(); + } + BeanUtils.copyProperties(entity, vo); + return vo; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeDrawVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeDrawVO.java new file mode 100644 index 0000000..d1308fe --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeDrawVO.java @@ -0,0 +1,59 @@ +package cn.lili.modules.lmk.domain.vo; + +import cn.lili.base.AbsVo; +import cn.lili.modules.lmk.domain.entity.PrizeDraw; +import java.util.List; +import org.springframework.lang.NonNull; +import org.springframework.beans.BeanUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鎶藉娲诲姩濂栧搧灞曠ず + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "鎶藉娲诲姩濂栧搧鍝嶅簲鏁版嵁", description = "鎶藉娲诲姩濂栧搧鍝嶅簲鏁版嵁") +public class PrizeDrawVO extends AbsVo { + + /** 濂栧搧鍚嶇О */ + @ApiModelProperty("濂栧搧鍚嶇О") + private String prizeName; + + /** 濂栧搧绫诲瀷 */ + @ApiModelProperty("濂栧搧绫诲瀷") + private String prizeType; + + /** 浼樻儬鍗穒d */ + @ApiModelProperty("浼樻儬鍗穒d") + private Long couponId; + + /** 濂栧搧鍐呭 */ + @ApiModelProperty("濂栧搧鍐呭") + private String prizeContent; + + /** 濂栧搧灏侀潰 */ + @ApiModelProperty("濂栧搧灏侀潰") + private String prizeCover; + + /** 濂栧搧鎻忚堪 */ + @ApiModelProperty("濂栧搧鎻忚堪") + private String prizeDes; + + /** 濂栧搧鍥剧墖 */ + @ApiModelProperty("濂栧搧鍥剧墖") + private String prizeImg; + + public static PrizeDrawVO getVoByEntity(@NonNull PrizeDraw entity, PrizeDrawVO vo) { + if(vo == null) { + vo = new PrizeDrawVO(); + } + BeanUtils.copyProperties(entity, vo); + return vo; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeNumberVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeNumberVO.java new file mode 100644 index 0000000..a433f01 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeNumberVO.java @@ -0,0 +1,47 @@ +package cn.lili.modules.lmk.domain.vo; + +import cn.lili.base.AbsVo; +import cn.lili.modules.lmk.domain.entity.PrizeNumber; +import java.util.List; +import org.springframework.lang.NonNull; +import org.springframework.beans.BeanUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鑾峰彇鎶藉娆℃暟璁板綍琛ㄥ睍绀� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "鑾峰彇鎶藉娆℃暟璁板綍琛ㄥ搷搴旀暟鎹�", description = "鑾峰彇鎶藉娆℃暟璁板綍琛ㄥ搷搴旀暟鎹�") +public class PrizeNumberVO extends AbsVo { + + /** 鐢ㄦ埛id */ + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + /** 鎶藉娲诲姩id */ + @ApiModelProperty("鎶藉娲诲姩id") + private Long activityPrizeId; + + /** 鐢ㄦ埛琛屼负 */ + @ApiModelProperty("鐢ㄦ埛琛屼负") + private String userAction; + + /** 浣跨敤鐘舵�� */ + @ApiModelProperty("浣跨敤鐘舵��") + private String useStatus; + + public static PrizeNumberVO getVoByEntity(@NonNull PrizeNumber entity, PrizeNumberVO vo) { + if(vo == null) { + vo = new PrizeNumberVO(); + } + BeanUtils.copyProperties(entity, vo); + return vo; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeRecordVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeRecordVO.java new file mode 100644 index 0000000..1515289 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/PrizeRecordVO.java @@ -0,0 +1,75 @@ +package cn.lili.modules.lmk.domain.vo; + +import cn.lili.base.AbsVo; +import cn.lili.modules.lmk.domain.entity.PrizeRecord; +import java.util.List; +import org.springframework.lang.NonNull; +import org.springframework.beans.BeanUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * 鐢ㄦ埛鎶藉璁板綍琛ㄥ睍绀� + * + * @author peng + * @since 2025-08-14 + */ +@Data +@ApiModel(value = "鐢ㄦ埛鎶藉璁板綍琛ㄥ搷搴旀暟鎹�", description = "鐢ㄦ埛鎶藉璁板綍琛ㄥ搷搴旀暟鎹�") +public class PrizeRecordVO extends AbsVo { + + /** 鐢ㄦ埛id */ + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + /** 鐢ㄦ埛鏄电О */ + @ApiModelProperty("鐢ㄦ埛鏄电О") + private String nickName; + + /** 娲诲姩id */ + @ApiModelProperty("娲诲姩id") + private Long prizeActivityId; + + /** 娲诲姩鍚嶇О */ + @ApiModelProperty("娲诲姩鍚嶇О") + private String prizeActivityName; + + /** 娲诲姩灏侀潰 */ + @ApiModelProperty("娲诲姩灏侀潰") + private String prizeActivityCover; + + /** 涓鐘舵�� */ + @ApiModelProperty("涓鐘舵��") + private String prizeStatus; + + /** 涓鍐呭 */ + @ApiModelProperty("涓鍐呭") + private String prizeContent; + + /** 濂栧搧id */ + @ApiModelProperty("濂栧搧id") + private Long prizeId; + + /** 濂栧搧灏侀潰 */ + @ApiModelProperty("濂栧搧灏侀潰") + private String prizeImg; + + /** 鎶藉娆℃暟琛╥d */ + @ApiModelProperty("鎶藉娆℃暟琛╥d") + private Long prizeNumId; + + /** 娲诲姩濂栧搧鍏宠仈琛╥d */ + @ApiModelProperty("娲诲姩濂栧搧鍏宠仈琛╥d") + private Long activityPrizeRefId; + + public static PrizeRecordVO getVoByEntity(@NonNull PrizeRecord entity, PrizeRecordVO vo) { + if(vo == null) { + vo = new PrizeRecordVO(); + } + BeanUtils.copyProperties(entity, vo); + return vo; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/ActivityRefPrizeMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/ActivityRefPrizeMapper.java new file mode 100644 index 0000000..153f5fd --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/ActivityRefPrizeMapper.java @@ -0,0 +1,34 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.ActivityRefPrize; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.lili.modules.lmk.domain.vo.ActivityRefPrizeVO; +import cn.lili.modules.lmk.domain.form.ActivityRefPrizeForm; +import cn.lili.modules.lmk.domain.query.ActivityRefPrizeQuery; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 娲诲姩濂栧搧鍏宠仈琛� Mapper 鎺ュ彛 + * + * @author peng + * @since 2025-08-14 + */ +@Mapper +public interface ActivityRefPrizeMapper extends BaseMapper<ActivityRefPrize> { + + /** + * id鏌ユ壘娲诲姩濂栧搧鍏宠仈琛� + * @param id + * @return + */ + ActivityRefPrizeVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") ActivityRefPrizeQuery query); + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeActivityMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeActivityMapper.java new file mode 100644 index 0000000..fbf5942 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeActivityMapper.java @@ -0,0 +1,34 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.PrizeActivity; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.lili.modules.lmk.domain.vo.PrizeActivityVO; +import cn.lili.modules.lmk.domain.form.PrizeActivityForm; +import cn.lili.modules.lmk.domain.query.PrizeActivityQuery; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 鎶藉娲诲姩 Mapper 鎺ュ彛 + * + * @author peng + * @since 2025-08-14 + */ +@Mapper +public interface PrizeActivityMapper extends BaseMapper<PrizeActivity> { + + /** + * id鏌ユ壘鎶藉娲诲姩 + * @param id + * @return + */ + PrizeActivityVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") PrizeActivityQuery query); + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeDrawMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeDrawMapper.java new file mode 100644 index 0000000..ca071ea --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeDrawMapper.java @@ -0,0 +1,34 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.PrizeDraw; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.lili.modules.lmk.domain.vo.PrizeDrawVO; +import cn.lili.modules.lmk.domain.form.PrizeDrawForm; +import cn.lili.modules.lmk.domain.query.PrizeDrawQuery; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 鎶藉娲诲姩濂栧搧 Mapper 鎺ュ彛 + * + * @author peng + * @since 2025-08-14 + */ +@Mapper +public interface PrizeDrawMapper extends BaseMapper<PrizeDraw> { + + /** + * id鏌ユ壘鎶藉娲诲姩濂栧搧 + * @param id + * @return + */ + PrizeDrawVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") PrizeDrawQuery query); + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeNumberMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeNumberMapper.java new file mode 100644 index 0000000..0008c43 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeNumberMapper.java @@ -0,0 +1,34 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.PrizeNumber; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.lili.modules.lmk.domain.vo.PrizeNumberVO; +import cn.lili.modules.lmk.domain.form.PrizeNumberForm; +import cn.lili.modules.lmk.domain.query.PrizeNumberQuery; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 鑾峰彇鎶藉娆℃暟璁板綍琛� Mapper 鎺ュ彛 + * + * @author peng + * @since 2025-08-14 + */ +@Mapper +public interface PrizeNumberMapper extends BaseMapper<PrizeNumber> { + + /** + * id鏌ユ壘鑾峰彇鎶藉娆℃暟璁板綍琛� + * @param id + * @return + */ + PrizeNumberVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") PrizeNumberQuery query); + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeRecordMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeRecordMapper.java new file mode 100644 index 0000000..ece74a1 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/PrizeRecordMapper.java @@ -0,0 +1,34 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.PrizeRecord; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.lili.modules.lmk.domain.vo.PrizeRecordVO; +import cn.lili.modules.lmk.domain.form.PrizeRecordForm; +import cn.lili.modules.lmk.domain.query.PrizeRecordQuery; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 鐢ㄦ埛鎶藉璁板綍琛� Mapper 鎺ュ彛 + * + * @author peng + * @since 2025-08-14 + */ +@Mapper +public interface PrizeRecordMapper extends BaseMapper<PrizeRecord> { + + /** + * id鏌ユ壘鐢ㄦ埛鎶藉璁板綍琛� + * @param id + * @return + */ + PrizeRecordVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") PrizeRecordQuery query); + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/ActivityRefPrizeService.java b/framework/src/main/java/cn/lili/modules/lmk/service/ActivityRefPrizeService.java new file mode 100644 index 0000000..1516fed --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/ActivityRefPrizeService.java @@ -0,0 +1,65 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.modules.lmk.domain.entity.ActivityRefPrize; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.ActivityRefPrizeForm; +import cn.lili.modules.lmk.domain.query.ActivityRefPrizeQuery; +import java.util.List; + +/** + * 娲诲姩濂栧搧鍏宠仈琛� 鏈嶅姟绫� + * + * @author peng + * @since 2025-08-14 + */ +public interface ActivityRefPrizeService extends IService<ActivityRefPrize> { + + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(ActivityRefPrizeForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(ActivityRefPrizeForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(ActivityRefPrizeQuery query); + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + Result detail(String id); + + /** + * 鍒楄〃 + * @return + */ + Result all(); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/PrizeActivityService.java b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeActivityService.java new file mode 100644 index 0000000..378d96a --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeActivityService.java @@ -0,0 +1,65 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.modules.lmk.domain.entity.PrizeActivity; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.PrizeActivityForm; +import cn.lili.modules.lmk.domain.query.PrizeActivityQuery; +import java.util.List; + +/** + * 鎶藉娲诲姩 鏈嶅姟绫� + * + * @author peng + * @since 2025-08-14 + */ +public interface PrizeActivityService extends IService<PrizeActivity> { + + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(PrizeActivityForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(PrizeActivityForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(PrizeActivityQuery query); + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + Result detail(String id); + + /** + * 鍒楄〃 + * @return + */ + Result all(); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/PrizeDrawService.java b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeDrawService.java new file mode 100644 index 0000000..eda1c76 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeDrawService.java @@ -0,0 +1,65 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.modules.lmk.domain.entity.PrizeDraw; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.PrizeDrawForm; +import cn.lili.modules.lmk.domain.query.PrizeDrawQuery; +import java.util.List; + +/** + * 鎶藉娲诲姩濂栧搧 鏈嶅姟绫� + * + * @author peng + * @since 2025-08-14 + */ +public interface PrizeDrawService extends IService<PrizeDraw> { + + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(PrizeDrawForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(PrizeDrawForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(PrizeDrawQuery query); + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + Result detail(String id); + + /** + * 鍒楄〃 + * @return + */ + Result all(); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/PrizeNumberService.java b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeNumberService.java new file mode 100644 index 0000000..df99740 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeNumberService.java @@ -0,0 +1,65 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.modules.lmk.domain.entity.PrizeNumber; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.PrizeNumberForm; +import cn.lili.modules.lmk.domain.query.PrizeNumberQuery; +import java.util.List; + +/** + * 鑾峰彇鎶藉娆℃暟璁板綍琛� 鏈嶅姟绫� + * + * @author peng + * @since 2025-08-14 + */ +public interface PrizeNumberService extends IService<PrizeNumber> { + + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(PrizeNumberForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(PrizeNumberForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(PrizeNumberQuery query); + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + Result detail(String id); + + /** + * 鍒楄〃 + * @return + */ + Result all(); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/PrizeRecordService.java b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeRecordService.java new file mode 100644 index 0000000..a57d4b0 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/PrizeRecordService.java @@ -0,0 +1,65 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.modules.lmk.domain.entity.PrizeRecord; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.PrizeRecordForm; +import cn.lili.modules.lmk.domain.query.PrizeRecordQuery; +import java.util.List; + +/** + * 鐢ㄦ埛鎶藉璁板綍琛� 鏈嶅姟绫� + * + * @author peng + * @since 2025-08-14 + */ +public interface PrizeRecordService extends IService<PrizeRecord> { + + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(PrizeRecordForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(PrizeRecordForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(PrizeRecordQuery query); + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + Result detail(String id); + + /** + * 鍒楄〃 + * @return + */ + Result all(); +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java new file mode 100644 index 0000000..27abbd0 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActivityRefPrizeServiceImpl.java @@ -0,0 +1,119 @@ +package cn.lili.modules.lmk.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.lili.modules.lmk.domain.entity.ActivityRefPrize; +import cn.lili.modules.lmk.mapper.ActivityRefPrizeMapper; +import cn.lili.modules.lmk.service.ActivityRefPrizeService; +import cn.lili.base.Result; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.lili.modules.lmk.domain.form.ActivityRefPrizeForm; +import cn.lili.modules.lmk.domain.vo.ActivityRefPrizeVO; +import cn.lili.modules.lmk.domain.query.ActivityRefPrizeQuery; +import org.springframework.stereotype.Service; +import lombok.RequiredArgsConstructor; +import cn.lili.utils.PageUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 娲诲姩濂栧搧鍏宠仈琛� 鏈嶅姟瀹炵幇绫� + * + * @author peng + * @since 2025-08-14 + */ +@Service +@RequiredArgsConstructor +public class ActivityRefPrizeServiceImpl extends ServiceImpl<ActivityRefPrizeMapper, ActivityRefPrize> implements ActivityRefPrizeService { + + private final ActivityRefPrizeMapper activityRefPrizeMapper; + + /** + * 娣诲姞 + * @param form + * @return + */ + @Override + public Result add(ActivityRefPrizeForm form) { + ActivityRefPrize entity = ActivityRefPrizeForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * @param form + * @return + */ + @Override + public Result update(ActivityRefPrizeForm form) { + ActivityRefPrize entity = baseMapper.selectById(form.getId()); + + // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + BeanUtils.copyProperties(form, entity); + baseMapper.updateById(entity); + return Result.ok("淇敼鎴愬姛"); + } + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + @Override + public Result remove(List<String> ids) { + baseMapper.deleteBatchIds(ids); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * id鍒犻櫎 + * @param id + * @return + */ + @Override + public Result removeById(String id) { + baseMapper.deleteById(id); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + @Override + public Result page(ActivityRefPrizeQuery query) { + IPage<ActivityRefPrizeVO> page = PageUtil.getPage(query, ActivityRefPrizeVO.class); + baseMapper.getPage(page, query); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + @Override + public Result detail(String id) { + ActivityRefPrizeVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + /** + * 鍒楄〃 + * @return + */ + @Override + public Result all() { + List<ActivityRefPrize> entities = baseMapper.selectList(null); + List<ActivityRefPrizeVO> vos = entities.stream() + .map(entity -> ActivityRefPrizeVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java new file mode 100644 index 0000000..619d1eb --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeActivityServiceImpl.java @@ -0,0 +1,119 @@ +package cn.lili.modules.lmk.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.lili.modules.lmk.domain.entity.PrizeActivity; +import cn.lili.modules.lmk.mapper.PrizeActivityMapper; +import cn.lili.modules.lmk.service.PrizeActivityService; +import cn.lili.base.Result; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.lili.modules.lmk.domain.form.PrizeActivityForm; +import cn.lili.modules.lmk.domain.vo.PrizeActivityVO; +import cn.lili.modules.lmk.domain.query.PrizeActivityQuery; +import org.springframework.stereotype.Service; +import lombok.RequiredArgsConstructor; +import cn.lili.utils.PageUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 鎶藉娲诲姩 鏈嶅姟瀹炵幇绫� + * + * @author peng + * @since 2025-08-14 + */ +@Service +@RequiredArgsConstructor +public class PrizeActivityServiceImpl extends ServiceImpl<PrizeActivityMapper, PrizeActivity> implements PrizeActivityService { + + private final PrizeActivityMapper prizeActivityMapper; + + /** + * 娣诲姞 + * @param form + * @return + */ + @Override + public Result add(PrizeActivityForm form) { + PrizeActivity entity = PrizeActivityForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * @param form + * @return + */ + @Override + public Result update(PrizeActivityForm form) { + PrizeActivity entity = baseMapper.selectById(form.getId()); + + // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + BeanUtils.copyProperties(form, entity); + baseMapper.updateById(entity); + return Result.ok("淇敼鎴愬姛"); + } + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + @Override + public Result remove(List<String> ids) { + baseMapper.deleteBatchIds(ids); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * id鍒犻櫎 + * @param id + * @return + */ + @Override + public Result removeById(String id) { + baseMapper.deleteById(id); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + @Override + public Result page(PrizeActivityQuery query) { + IPage<PrizeActivityVO> page = PageUtil.getPage(query, PrizeActivityVO.class); + baseMapper.getPage(page, query); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + @Override + public Result detail(String id) { + PrizeActivityVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + /** + * 鍒楄〃 + * @return + */ + @Override + public Result all() { + List<PrizeActivity> entities = baseMapper.selectList(null); + List<PrizeActivityVO> vos = entities.stream() + .map(entity -> PrizeActivityVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeDrawServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeDrawServiceImpl.java new file mode 100644 index 0000000..e2936a7 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeDrawServiceImpl.java @@ -0,0 +1,119 @@ +package cn.lili.modules.lmk.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.lili.modules.lmk.domain.entity.PrizeDraw; +import cn.lili.modules.lmk.mapper.PrizeDrawMapper; +import cn.lili.modules.lmk.service.PrizeDrawService; +import cn.lili.base.Result; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.lili.modules.lmk.domain.form.PrizeDrawForm; +import cn.lili.modules.lmk.domain.vo.PrizeDrawVO; +import cn.lili.modules.lmk.domain.query.PrizeDrawQuery; +import org.springframework.stereotype.Service; +import lombok.RequiredArgsConstructor; +import cn.lili.utils.PageUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 鎶藉娲诲姩濂栧搧 鏈嶅姟瀹炵幇绫� + * + * @author peng + * @since 2025-08-14 + */ +@Service +@RequiredArgsConstructor +public class PrizeDrawServiceImpl extends ServiceImpl<PrizeDrawMapper, PrizeDraw> implements PrizeDrawService { + + private final PrizeDrawMapper prizeDrawMapper; + + /** + * 娣诲姞 + * @param form + * @return + */ + @Override + public Result add(PrizeDrawForm form) { + PrizeDraw entity = PrizeDrawForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * @param form + * @return + */ + @Override + public Result update(PrizeDrawForm form) { + PrizeDraw entity = baseMapper.selectById(form.getId()); + + // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + BeanUtils.copyProperties(form, entity); + baseMapper.updateById(entity); + return Result.ok("淇敼鎴愬姛"); + } + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + @Override + public Result remove(List<String> ids) { + baseMapper.deleteBatchIds(ids); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * id鍒犻櫎 + * @param id + * @return + */ + @Override + public Result removeById(String id) { + baseMapper.deleteById(id); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + @Override + public Result page(PrizeDrawQuery query) { + IPage<PrizeDrawVO> page = PageUtil.getPage(query, PrizeDrawVO.class); + baseMapper.getPage(page, query); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + @Override + public Result detail(String id) { + PrizeDrawVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + /** + * 鍒楄〃 + * @return + */ + @Override + public Result all() { + List<PrizeDraw> entities = baseMapper.selectList(null); + List<PrizeDrawVO> vos = entities.stream() + .map(entity -> PrizeDrawVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeNumberServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeNumberServiceImpl.java new file mode 100644 index 0000000..9f6a435 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeNumberServiceImpl.java @@ -0,0 +1,119 @@ +package cn.lili.modules.lmk.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.lili.modules.lmk.domain.entity.PrizeNumber; +import cn.lili.modules.lmk.mapper.PrizeNumberMapper; +import cn.lili.modules.lmk.service.PrizeNumberService; +import cn.lili.base.Result; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.lili.modules.lmk.domain.form.PrizeNumberForm; +import cn.lili.modules.lmk.domain.vo.PrizeNumberVO; +import cn.lili.modules.lmk.domain.query.PrizeNumberQuery; +import org.springframework.stereotype.Service; +import lombok.RequiredArgsConstructor; +import cn.lili.utils.PageUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 鑾峰彇鎶藉娆℃暟璁板綍琛� 鏈嶅姟瀹炵幇绫� + * + * @author peng + * @since 2025-08-14 + */ +@Service +@RequiredArgsConstructor +public class PrizeNumberServiceImpl extends ServiceImpl<PrizeNumberMapper, PrizeNumber> implements PrizeNumberService { + + private final PrizeNumberMapper prizeNumberMapper; + + /** + * 娣诲姞 + * @param form + * @return + */ + @Override + public Result add(PrizeNumberForm form) { + PrizeNumber entity = PrizeNumberForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * @param form + * @return + */ + @Override + public Result update(PrizeNumberForm form) { + PrizeNumber entity = baseMapper.selectById(form.getId()); + + // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + BeanUtils.copyProperties(form, entity); + baseMapper.updateById(entity); + return Result.ok("淇敼鎴愬姛"); + } + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + @Override + public Result remove(List<String> ids) { + baseMapper.deleteBatchIds(ids); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * id鍒犻櫎 + * @param id + * @return + */ + @Override + public Result removeById(String id) { + baseMapper.deleteById(id); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + @Override + public Result page(PrizeNumberQuery query) { + IPage<PrizeNumberVO> page = PageUtil.getPage(query, PrizeNumberVO.class); + baseMapper.getPage(page, query); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + @Override + public Result detail(String id) { + PrizeNumberVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + /** + * 鍒楄〃 + * @return + */ + @Override + public Result all() { + List<PrizeNumber> entities = baseMapper.selectList(null); + List<PrizeNumberVO> vos = entities.stream() + .map(entity -> PrizeNumberVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeRecordServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeRecordServiceImpl.java new file mode 100644 index 0000000..6fed40e --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/PrizeRecordServiceImpl.java @@ -0,0 +1,119 @@ +package cn.lili.modules.lmk.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import cn.lili.modules.lmk.domain.entity.PrizeRecord; +import cn.lili.modules.lmk.mapper.PrizeRecordMapper; +import cn.lili.modules.lmk.service.PrizeRecordService; +import cn.lili.base.Result; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.lili.modules.lmk.domain.form.PrizeRecordForm; +import cn.lili.modules.lmk.domain.vo.PrizeRecordVO; +import cn.lili.modules.lmk.domain.query.PrizeRecordQuery; +import org.springframework.stereotype.Service; +import lombok.RequiredArgsConstructor; +import cn.lili.utils.PageUtil; +import org.springframework.beans.BeanUtils; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 鐢ㄦ埛鎶藉璁板綍琛� 鏈嶅姟瀹炵幇绫� + * + * @author peng + * @since 2025-08-14 + */ +@Service +@RequiredArgsConstructor +public class PrizeRecordServiceImpl extends ServiceImpl<PrizeRecordMapper, PrizeRecord> implements PrizeRecordService { + + private final PrizeRecordMapper prizeRecordMapper; + + /** + * 娣诲姞 + * @param form + * @return + */ + @Override + public Result add(PrizeRecordForm form) { + PrizeRecord entity = PrizeRecordForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * @param form + * @return + */ + @Override + public Result update(PrizeRecordForm form) { + PrizeRecord entity = baseMapper.selectById(form.getId()); + + // 涓虹┖鎶汭llegalArgumentException锛屽仛鍏ㄥ眬寮傚父澶勭悊 + Assert.notNull(entity, "璁板綍涓嶅瓨鍦�"); + BeanUtils.copyProperties(form, entity); + baseMapper.updateById(entity); + return Result.ok("淇敼鎴愬姛"); + } + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + @Override + public Result remove(List<String> ids) { + baseMapper.deleteBatchIds(ids); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * id鍒犻櫎 + * @param id + * @return + */ + @Override + public Result removeById(String id) { + baseMapper.deleteById(id); + return Result.ok("鍒犻櫎鎴愬姛"); + } + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + @Override + public Result page(PrizeRecordQuery query) { + IPage<PrizeRecordVO> page = PageUtil.getPage(query, PrizeRecordVO.class); + baseMapper.getPage(page, query); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + @Override + public Result detail(String id) { + PrizeRecordVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + /** + * 鍒楄〃 + * @return + */ + @Override + public Result all() { + List<PrizeRecord> entities = baseMapper.selectList(null); + List<PrizeRecordVO> vos = entities.stream() + .map(entity -> PrizeRecordVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } +} diff --git a/framework/src/main/resources/mapper/lmk/ActivityRefPrizeMapper.xml b/framework/src/main/resources/mapper/lmk/ActivityRefPrizeMapper.xml new file mode 100644 index 0000000..28aa0c4 --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/ActivityRefPrizeMapper.xml @@ -0,0 +1,56 @@ +<?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="cn.lili.modules.lmk.mapper.ActivityRefPrizeMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.ActivityRefPrizeVO"> + <id column="id" property="id"/> + <result column="prize_activity_id" property="prizeActivityId" /> + <result column="prize_id" property="prizeId" /> + <result column="prize_content" property="prizeContent" /> + <result column="prize_num" property="prizeNum" /> + <result column="prize_probability" property="prizeProbability" /> + <result column="version" property="version" /> + <result column="remain_num" property="remainNum" /> + </resultMap> + + + + + + + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LARP.prize_activity_id, + LARP.prize_id, + LARP.prize_content, + LARP.prize_num, + LARP.prize_probability, + LARP.version, + LARP.remain_num, + LARP.id + FROM + lmk_activity_ref_prize LARP + WHERE + LARP.id = #{id} AND LARP.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LARP.prize_activity_id, + LARP.prize_id, + LARP.prize_content, + LARP.prize_num, + LARP.prize_probability, + LARP.version, + LARP.remain_num, + LARP.id + FROM + lmk_activity_ref_prize LARP + WHERE + LARP.delete_flag = 0 + </select> + +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml b/framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml new file mode 100644 index 0000000..f590d0f --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml @@ -0,0 +1,62 @@ +<?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="cn.lili.modules.lmk.mapper.PrizeActivityMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.PrizeActivityVO"> + <id column="id" property="id"/> + <result column="activity_name" property="activityName" /> + <result column="activity_des" property="activityDes" /> + <result column="begin_time" property="beginTime" /> + <result column="end_time" property="endTime" /> + <result column="max_prize" property="maxPrize" /> + <result column="prize_num" property="prizeNum" /> + <result column="activity_img" property="activityImg" /> + <result column="activity_cover" property="activityCover" /> + <result column="enable_status" property="enableStatus" /> + </resultMap> + + + + + + + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LPA.activity_name, + LPA.activity_des, + LPA.begin_time, + LPA.end_time, + LPA.max_prize, + LPA.prize_num, + LPA.activity_img, + LPA.activity_cover, + LPA.enable_status, + LPA.id + FROM + lmk_prize_activity LPA + WHERE + LPA.id = #{id} AND LPA.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LPA.activity_name, + LPA.activity_des, + LPA.begin_time, + LPA.end_time, + LPA.max_prize, + LPA.prize_num, + LPA.activity_img, + LPA.activity_cover, + LPA.enable_status, + LPA.id + FROM + lmk_prize_activity LPA + WHERE + LPA.delete_flag = 0 + </select> + +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/PrizeDrawMapper.xml b/framework/src/main/resources/mapper/lmk/PrizeDrawMapper.xml new file mode 100644 index 0000000..b6363b6 --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/PrizeDrawMapper.xml @@ -0,0 +1,56 @@ +<?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="cn.lili.modules.lmk.mapper.PrizeDrawMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.PrizeDrawVO"> + <id column="id" property="id"/> + <result column="prize_name" property="prizeName" /> + <result column="prize_type" property="prizeType" /> + <result column="coupon_id" property="couponId" /> + <result column="prize_content" property="prizeContent" /> + <result column="prize_cover" property="prizeCover" /> + <result column="prize_des" property="prizeDes" /> + <result column="prize_img" property="prizeImg" /> + </resultMap> + + + + + + + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LPD.prize_name, + LPD.prize_type, + LPD.coupon_id, + LPD.prize_content, + LPD.prize_cover, + LPD.prize_des, + LPD.prize_img, + LPD.id + FROM + lmk_prize_draw LPD + WHERE + LPD.id = #{id} AND LPD.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LPD.prize_name, + LPD.prize_type, + LPD.coupon_id, + LPD.prize_content, + LPD.prize_cover, + LPD.prize_des, + LPD.prize_img, + LPD.id + FROM + lmk_prize_draw LPD + WHERE + LPD.delete_flag = 0 + </select> + +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/PrizeNumberMapper.xml b/framework/src/main/resources/mapper/lmk/PrizeNumberMapper.xml new file mode 100644 index 0000000..3fa66a3 --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/PrizeNumberMapper.xml @@ -0,0 +1,47 @@ +<?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="cn.lili.modules.lmk.mapper.PrizeNumberMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.PrizeNumberVO"> + <id column="id" property="id"/> + <result column="user_id" property="userId" /> + <result column="activity_prize_id" property="activityPrizeId" /> + <result column="user_action" property="userAction" /> + <result column="use_status" property="useStatus" /> + </resultMap> + + + + + + + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LPN.user_id, + LPN.activity_prize_id, + LPN.user_action, + LPN.use_status, + LPN.id + FROM + lmk_prize_number LPN + WHERE + LPN.id = #{id} AND LPN.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LPN.user_id, + LPN.activity_prize_id, + LPN.user_action, + LPN.use_status, + LPN.id + FROM + lmk_prize_number LPN + WHERE + LPN.delete_flag = 0 + </select> + +</mapper> diff --git a/framework/src/main/resources/mapper/lmk/PrizeRecordMapper.xml b/framework/src/main/resources/mapper/lmk/PrizeRecordMapper.xml new file mode 100644 index 0000000..31aed99 --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/PrizeRecordMapper.xml @@ -0,0 +1,68 @@ +<?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="cn.lili.modules.lmk.mapper.PrizeRecordMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.PrizeRecordVO"> + <id column="id" property="id"/> + <result column="user_id" property="userId" /> + <result column="nick_name" property="nickName" /> + <result column="prize_activity_id" property="prizeActivityId" /> + <result column="prize_activity_name" property="prizeActivityName" /> + <result column="prize_activity_cover" property="prizeActivityCover" /> + <result column="prize_status" property="prizeStatus" /> + <result column="prize_content" property="prizeContent" /> + <result column="prize_id" property="prizeId" /> + <result column="prize_img" property="prizeImg" /> + <result column="prize_num_id" property="prizeNumId" /> + <result column="activity_prize_ref_id" property="activityPrizeRefId" /> + </resultMap> + + + + + + + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LPR.user_id, + LPR.nick_name, + LPR.prize_activity_id, + LPR.prize_activity_name, + LPR.prize_activity_cover, + LPR.prize_status, + LPR.prize_content, + LPR.prize_id, + LPR.prize_img, + LPR.prize_num_id, + LPR.activity_prize_ref_id, + LPR.id + FROM + lmk_prize_record LPR + WHERE + LPR.id = #{id} AND LPR.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LPR.user_id, + LPR.nick_name, + LPR.prize_activity_id, + LPR.prize_activity_name, + LPR.prize_activity_cover, + LPR.prize_status, + LPR.prize_content, + LPR.prize_id, + LPR.prize_img, + LPR.prize_num_id, + LPR.activity_prize_ref_id, + LPR.id + FROM + lmk_prize_record LPR + WHERE + LPR.delete_flag = 0 + </select> + +</mapper> -- Gitblit v1.8.0