From c20103684b358ecf733b600bd592cf093d5e076d Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期五, 15 八月 2025 15:28:01 +0800 Subject: [PATCH] 抽奖活动 --- manager-api/src/main/java/cn/lili/controller/lmk/PrizeActivityController.java | 47 +++++++++++++++++++++++ framework/src/main/java/cn/lili/modules/lmk/domain/entity/PrizeActivity.java | 8 ++- framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml | 6 +++ framework/src/main/java/cn/lili/modules/lmk/domain/query/PrizeActivityQuery.java | 15 +++++++ framework/src/main/java/cn/lili/modules/lmk/domain/form/PrizeActivityForm.java | 7 +++ 5 files changed, 80 insertions(+), 3 deletions(-) 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 index 4476df2..c7f4bae 100644 --- 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 @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.Date; + import lombok.Data; /** @@ -29,11 +31,11 @@ @TableField("begin_time") /** 娲诲姩寮�濮嬫椂闂� */ - private LocalDateTime beginTime; + private Date beginTime; @TableField("end_time") /** 娲诲姩缁撴潫鏃堕棿 */ - private LocalDateTime endTime; + private Date endTime; @TableField("max_prize") /** 姣忔棩鏈�澶ф娊濂栦笂闄� */ @@ -52,7 +54,7 @@ private String activityCover; @TableField("enable_status") - /** 鏄惁寮�鍚椿鍔� */ + /** 鏄惁寮�鍚椿鍔� */ private String enableStatus; 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 index 55df9b1..741dc5b 100644 --- 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 @@ -4,9 +4,12 @@ import cn.lili.group.Add; import cn.lili.base.AbsForm; import cn.lili.modules.lmk.domain.entity.PrizeActivity; +import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.beans.BeanUtils; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; + +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.lang.NonNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -33,10 +36,14 @@ @NotNull(message = "娲诲姩寮�濮嬫椂闂翠笉鑳戒负绌�", groups = {Add.class, Update.class}) @ApiModelProperty("娲诲姩寮�濮嬫椂闂�") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date beginTime; @NotNull(message = "娲诲姩缁撴潫鏃堕棿涓嶈兘涓虹┖", groups = {Add.class, Update.class}) @ApiModelProperty("娲诲姩缁撴潫鏃堕棿") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; @NotNull(message = "姣忔棩鏈�澶ф娊濂栦笂闄愪笉鑳戒负绌�", groups = {Add.class, Update.class}) 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 index 8e930f0..22b9557 100644 --- 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 @@ -1,7 +1,12 @@ package cn.lili.modules.lmk.domain.query; import cn.lili.base.AbsQuery; + +import java.util.Date; import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.lang.NonNull; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @@ -18,5 +23,15 @@ @Data @ApiModel(value = "PrizeActivity鏌ヨ鍙傛暟", description = "鎶藉娲诲姩鏌ヨ鍙傛暟") public class PrizeActivityQuery extends AbsQuery { + + public String activityName; + + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + public Date beginTime; + + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + public Date endTime; } diff --git a/framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml b/framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml index f590d0f..d6b1535 100644 --- a/framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml +++ b/framework/src/main/resources/mapper/lmk/PrizeActivityMapper.xml @@ -57,6 +57,12 @@ lmk_prize_activity LPA WHERE LPA.delete_flag = 0 + <if test="query.activityName != null and query.activityName !=''"> + AND LPA.activity_name LIKE CONCAT('%',#{query.ctivityName},'%') + </if> + <if test="query.beginTime != null">AND LPA.begin_time >= #{query.beginTime}</if> + <if test="query.endTime != null">AND LPA.end_time <= #{query.endTime}</if> + </select> </mapper> diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/PrizeActivityController.java b/manager-api/src/main/java/cn/lili/controller/lmk/PrizeActivityController.java new file mode 100644 index 0000000..55c599c --- /dev/null +++ b/manager-api/src/main/java/cn/lili/controller/lmk/PrizeActivityController.java @@ -0,0 +1,47 @@ +package cn.lili.controller.lmk; + + +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.PrizeActivityForm; +import cn.lili.modules.lmk.domain.query.PrizeActivityQuery; +import cn.lili.modules.lmk.service.PrizeActivityService; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * lmk-shop-java + * 鎶藉娲诲姩 + * + * @author : zxl + * @date : 2025-08-14 16:27 + **/ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/manager/lmk/activity-prize") +public class PrizeActivityController { + + private final PrizeActivityService prizeActivityService; + + @GetMapping + public Result getPage(PrizeActivityQuery query){ + return prizeActivityService.page(query); + } + @GetMapping("/{id}") + public Result detail(@PathVariable("id") String id){ + return prizeActivityService.detail(id); + } + @PutMapping + public Result edit(@RequestBody PrizeActivityForm form){ + return prizeActivityService.update(form); + } + @PostMapping + public Result add(@RequestBody PrizeActivityForm form){ + return prizeActivityService.add(form); + } + @DeleteMapping("/{id}") + public Result del(@PathVariable("id") String id){ + return prizeActivityService.removeById(id); + } +} -- Gitblit v1.8.0