From 35d33220697854e622c6e3d39c18ce9ef2537320 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期一, 08 九月 2025 17:02:45 +0800 Subject: [PATCH] 初始化用户行为分析 --- framework/src/main/java/cn/lili/modules/lmk/domain/form/ActionRecordForm.java | 78 ++++++ framework/src/main/java/cn/lili/modules/lmk/service/ActionRecordService.java | 65 +++++ framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActionRecordVO.java | 75 ++++++ framework/src/main/java/cn/lili/modules/lmk/enums/general/UserActionPageEnums.java | 26 ++ framework/src/main/java/cn/lili/modules/lmk/mapper/ActionRecordMapper.java | 34 ++ manager-api/src/main/java/cn/lili/controller/lmk/ActionRecordManagerController.java | 76 ++++++ framework/src/main/java/cn/lili/modules/lmk/domain/query/ActionRecordQuery.java | 22 + buyer-api/src/main/java/cn/lili/controller/lmk/ActionRecordBuyerController.java | 42 +++ framework/src/main/resources/mapper/lmk/ActionRecordMapper.xml | 68 +++++ framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActionRecord.java | 67 +++++ framework/src/main/java/cn/lili/modules/lmk/service/impl/ActionRecordServiceImpl.java | 119 +++++++++ 11 files changed, 672 insertions(+), 0 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/lmk/ActionRecordBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/lmk/ActionRecordBuyerController.java new file mode 100644 index 0000000..377ad4f --- /dev/null +++ b/buyer-api/src/main/java/cn/lili/controller/lmk/ActionRecordBuyerController.java @@ -0,0 +1,42 @@ +package cn.lili.controller.lmk; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import lombok.RequiredArgsConstructor; +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotEmpty; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import cn.lili.modules.lmk.service.ActionRecordService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.ActionRecordForm; +import cn.lili.modules.lmk.domain.query.ActionRecordQuery; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + * 鐢ㄦ埛琛屼负璁板綍 鍓嶇鎺у埗鍣� + * + * @author peng + * @since 2025-09-08 + */ +@Validated +@RequiredArgsConstructor +@Api(value = "鐢ㄦ埛琛屼负璁板綍", tags = "鐢ㄦ埛琛屼负璁板綍绠$悊") +@RestController +@RequestMapping("/buyer/lmk/action-record") +public class ActionRecordBuyerController { + + private final ActionRecordService actionRecordService; + + @PostMapping + @ApiOperation(value = "娣诲姞", notes = "娣诲姞") + public Result add(@RequestBody @Validated(Add.class) ActionRecordForm form) { + return actionRecordService.add(form); + } + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActionRecord.java b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActionRecord.java new file mode 100644 index 0000000..194c0e3 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/entity/ActionRecord.java @@ -0,0 +1,67 @@ +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-09-08 + */ +@Data +@TableName("lmk_action_record") +public class ActionRecord extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @TableField("user_id") + /** 鐢ㄦ埛id */ + private Long userId; + + @TableField("session_id") + /** 椤甸潰浼氳瘽id */ + private String sessionId; + + @TableField("action_type") + /** 琛屼负绫诲瀷 */ + private String actionType; + + @TableField("start_time") + /** 瑙﹀彂鏃堕棿 */ + private LocalDateTime startTime; + + @TableField("join_type") + /** 杩涘叆椤甸潰鏂瑰紡 */ + private String joinType; + + @TableField("previous_session_id") + /** 涓婁竴涓〉闈㈢殑浼氳瘽id */ + private String previousSessionId; + + @TableField("share_id") + /** 鍒嗕韩id */ + private Long shareId; + + @TableField("page_code") + /** 椤甸潰缂栫爜 */ + private String pageCode; + + @TableField("page_params") + /** 椤甸潰璇︽儏鍙傛暟(json鏍煎紡) */ + private String pageParams; + + @TableField("page_type") + /** 椤甸潰绫诲瀷 */ + private String pageType; + + @TableField("page_status") + /** 鐢ㄦ埛鍦ㄩ〉闈㈢姸鎬� */ + private String pageStatus; + + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/form/ActionRecordForm.java b/framework/src/main/java/cn/lili/modules/lmk/domain/form/ActionRecordForm.java new file mode 100644 index 0000000..0206733 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/form/ActionRecordForm.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.ActionRecord; +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-09-08 + */ +@Data +@ApiModel(value = "ActionRecord琛ㄥ崟", description = "鐢ㄦ埛琛屼负璁板綍琛ㄥ崟") +public class ActionRecordForm extends AbsForm { + + @NotNull(message = "鐢ㄦ埛id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + @NotBlank(message = "椤甸潰浼氳瘽id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("椤甸潰浼氳瘽id") + private String sessionId; + + @NotBlank(message = "琛屼负绫诲瀷涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("琛屼负绫诲瀷") + private String actionType; + + @NotNull(message = "瑙﹀彂鏃堕棿涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("瑙﹀彂鏃堕棿") + private Date startTime; + + @NotBlank(message = "杩涘叆椤甸潰鏂瑰紡涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("杩涘叆椤甸潰鏂瑰紡") + private String joinType; + + @NotBlank(message = "涓婁竴涓〉闈㈢殑浼氳瘽id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("涓婁竴涓〉闈㈢殑浼氳瘽id") + private String previousSessionId; + + @NotNull(message = "鍒嗕韩id涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("鍒嗕韩id") + private Long shareId; + + @NotBlank(message = "椤甸潰缂栫爜涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("椤甸潰缂栫爜") + private String pageCode; + + @NotBlank(message = "椤甸潰璇︽儏鍙傛暟(json鏍煎紡)涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("椤甸潰璇︽儏鍙傛暟(json鏍煎紡)") + private String pageParams; + + @NotBlank(message = "椤甸潰绫诲瀷涓嶈兘涓虹┖", groups = {Add.class, Update.class}) + @ApiModelProperty("椤甸潰绫诲瀷") + private String pageType; + + @NotBlank(message = "鐢ㄦ埛鍦ㄩ〉闈㈢姸鎬佷笉鑳戒负绌�", groups = {Add.class, Update.class}) + @ApiModelProperty("鐢ㄦ埛鍦ㄩ〉闈㈢姸鎬�") + private String pageStatus; + + public static ActionRecord getEntityByForm(@NonNull ActionRecordForm form, ActionRecord entity) { + if(entity == null) { + entity = new ActionRecord(); + } + BeanUtils.copyProperties(form, entity); + return entity; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/query/ActionRecordQuery.java b/framework/src/main/java/cn/lili/modules/lmk/domain/query/ActionRecordQuery.java new file mode 100644 index 0000000..48427c8 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/query/ActionRecordQuery.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-09-08 + */ +@Data +@ApiModel(value = "ActionRecord鏌ヨ鍙傛暟", description = "鐢ㄦ埛琛屼负璁板綍鏌ヨ鍙傛暟") +public class ActionRecordQuery extends AbsQuery { +} + diff --git a/framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActionRecordVO.java b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActionRecordVO.java new file mode 100644 index 0000000..1235f7d --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/domain/vo/ActionRecordVO.java @@ -0,0 +1,75 @@ +package cn.lili.modules.lmk.domain.vo; + +import cn.lili.base.AbsVo; +import cn.lili.modules.lmk.domain.entity.ActionRecord; +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-09-08 + */ +@Data +@ApiModel(value = "鐢ㄦ埛琛屼负璁板綍鍝嶅簲鏁版嵁", description = "鐢ㄦ埛琛屼负璁板綍鍝嶅簲鏁版嵁") +public class ActionRecordVO extends AbsVo { + + /** 鐢ㄦ埛id */ + @ApiModelProperty("鐢ㄦ埛id") + private Long userId; + + /** 椤甸潰浼氳瘽id */ + @ApiModelProperty("椤甸潰浼氳瘽id") + private String sessionId; + + /** 琛屼负绫诲瀷 */ + @ApiModelProperty("琛屼负绫诲瀷") + private String actionType; + + /** 瑙﹀彂鏃堕棿 */ + @ApiModelProperty("瑙﹀彂鏃堕棿") + private Date startTime; + + /** 杩涘叆椤甸潰鏂瑰紡 */ + @ApiModelProperty("杩涘叆椤甸潰鏂瑰紡") + private String joinType; + + /** 涓婁竴涓〉闈㈢殑浼氳瘽id */ + @ApiModelProperty("涓婁竴涓〉闈㈢殑浼氳瘽id") + private String previousSessionId; + + /** 鍒嗕韩id */ + @ApiModelProperty("鍒嗕韩id") + private Long shareId; + + /** 椤甸潰缂栫爜 */ + @ApiModelProperty("椤甸潰缂栫爜") + private String pageCode; + + /** 椤甸潰璇︽儏鍙傛暟(json鏍煎紡) */ + @ApiModelProperty("椤甸潰璇︽儏鍙傛暟(json鏍煎紡)") + private String pageParams; + + /** 椤甸潰绫诲瀷 */ + @ApiModelProperty("椤甸潰绫诲瀷") + private String pageType; + + /** 鐢ㄦ埛鍦ㄩ〉闈㈢姸鎬� */ + @ApiModelProperty("鐢ㄦ埛鍦ㄩ〉闈㈢姸鎬�") + private String pageStatus; + + public static ActionRecordVO getVoByEntity(@NonNull ActionRecord entity, ActionRecordVO vo) { + if(vo == null) { + vo = new ActionRecordVO(); + } + BeanUtils.copyProperties(entity, vo); + return vo; + } + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/enums/general/UserActionPageEnums.java b/framework/src/main/java/cn/lili/modules/lmk/enums/general/UserActionPageEnums.java new file mode 100644 index 0000000..dce97e8 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/enums/general/UserActionPageEnums.java @@ -0,0 +1,26 @@ +package cn.lili.modules.lmk.enums.general; + +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public enum UserActionPageEnums { + RECOMMEND_VIDEO("棣栭〉鎺ㄨ崘瑙嗛"), + HEALTH_VIDEO("澶у仴搴疯棰�"), + KITCHEN_VIDEO("绁炲帹瑙嗛"), + RECOMMEND_VIDEO_GOODS("瑙嗛鎺ㄨ崘鍟嗗搧椤甸潰"), + RECOMMEND_VIDEO_LEFT_GOODS("宸︽粦鎺ㄨ崘鍟嗗搧"), + RECOMMEND_VIDEO_RIGHT_VIDEO("鍙虫粦瑙嗛椤甸潰"), + ACTIVITY("娲诲姩"), + SHOPPING_SQUARE("鍟嗗搧骞垮満"), + GOODS_DETAILS("鍟嗗搧璇︽儏椤甸潰"); + private final String des; + + public UserActionPageEnums select(String name){ + for (UserActionPageEnums value : UserActionPageEnums.values()) { + if (value.name().equals(name)) { + return value; + } + } + return null; + } +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/mapper/ActionRecordMapper.java b/framework/src/main/java/cn/lili/modules/lmk/mapper/ActionRecordMapper.java new file mode 100644 index 0000000..c73915c --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/mapper/ActionRecordMapper.java @@ -0,0 +1,34 @@ +package cn.lili.modules.lmk.mapper; + +import cn.lili.modules.lmk.domain.entity.ActionRecord; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.lili.modules.lmk.domain.vo.ActionRecordVO; +import cn.lili.modules.lmk.domain.form.ActionRecordForm; +import cn.lili.modules.lmk.domain.query.ActionRecordQuery; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 鐢ㄦ埛琛屼负璁板綍 Mapper 鎺ュ彛 + * + * @author peng + * @since 2025-09-08 + */ +@Mapper +public interface ActionRecordMapper extends BaseMapper<ActionRecord> { + + /** + * id鏌ユ壘鐢ㄦ埛琛屼负璁板綍 + * @param id + * @return + */ + ActionRecordVO getById(String id); + + /** + * 鍒嗛〉 + */ + IPage getPage(IPage page, @Param("query") ActionRecordQuery query); + +} diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/ActionRecordService.java b/framework/src/main/java/cn/lili/modules/lmk/service/ActionRecordService.java new file mode 100644 index 0000000..3eabb20 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/ActionRecordService.java @@ -0,0 +1,65 @@ +package cn.lili.modules.lmk.service; + +import cn.lili.modules.lmk.domain.entity.ActionRecord; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.ActionRecordForm; +import cn.lili.modules.lmk.domain.query.ActionRecordQuery; +import java.util.List; + +/** + * 鐢ㄦ埛琛屼负璁板綍 鏈嶅姟绫� + * + * @author peng + * @since 2025-09-08 + */ +public interface ActionRecordService extends IService<ActionRecord> { + + /** + * 娣诲姞 + * @param form + * @return + */ + Result add(ActionRecordForm form); + + /** + * 淇敼 + * @param form + * @return + */ + Result update(ActionRecordForm form); + + /** + * 鎵归噺鍒犻櫎 + * @param ids + * @return + */ + Result remove(List<String> ids); + + /** + * id鍒犻櫎 + * @param id + * @return + */ + Result removeById(String id); + + /** + * 鍒嗛〉鏌ヨ + * @param query + * @return + */ + Result page(ActionRecordQuery 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/ActionRecordServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActionRecordServiceImpl.java new file mode 100644 index 0000000..63d2836 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/ActionRecordServiceImpl.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.ActionRecord; +import cn.lili.modules.lmk.mapper.ActionRecordMapper; +import cn.lili.modules.lmk.service.ActionRecordService; +import cn.lili.base.Result; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.lili.modules.lmk.domain.form.ActionRecordForm; +import cn.lili.modules.lmk.domain.vo.ActionRecordVO; +import cn.lili.modules.lmk.domain.query.ActionRecordQuery; +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-09-08 + */ +@Service +@RequiredArgsConstructor +public class ActionRecordServiceImpl extends ServiceImpl<ActionRecordMapper, ActionRecord> implements ActionRecordService { + + private final ActionRecordMapper actionRecordMapper; + + /** + * 娣诲姞 + * @param form + * @return + */ + @Override + public Result add(ActionRecordForm form) { + ActionRecord entity = ActionRecordForm.getEntityByForm(form, null); + baseMapper.insert(entity); + return Result.ok("娣诲姞鎴愬姛"); + } + + /** + * 淇敼 + * @param form + * @return + */ + @Override + public Result update(ActionRecordForm form) { + ActionRecord 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(ActionRecordQuery query) { + IPage<ActionRecordVO> page = PageUtil.getPage(query, ActionRecordVO.class); + baseMapper.getPage(page, query); + return Result.ok().data(page.getRecords()).total(page.getTotal()); + } + + /** + * 鏍规嵁id鏌ユ壘 + * @param id + * @return + */ + @Override + public Result detail(String id) { + ActionRecordVO vo = baseMapper.getById(id); + Assert.notNull(vo, "璁板綍涓嶅瓨鍦�"); + return Result.ok().data(vo); + } + + /** + * 鍒楄〃 + * @return + */ + @Override + public Result all() { + List<ActionRecord> entities = baseMapper.selectList(null); + List<ActionRecordVO> vos = entities.stream() + .map(entity -> ActionRecordVO.getVoByEntity(entity, null)) + .collect(Collectors.toList()); + return Result.ok().data(vos); + } +} diff --git a/framework/src/main/resources/mapper/lmk/ActionRecordMapper.xml b/framework/src/main/resources/mapper/lmk/ActionRecordMapper.xml new file mode 100644 index 0000000..19b542e --- /dev/null +++ b/framework/src/main/resources/mapper/lmk/ActionRecordMapper.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.ActionRecordMapper"> + + <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 --> + <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.ActionRecordVO"> + <id column="id" property="id"/> + <result column="user_id" property="userId" /> + <result column="session_id" property="sessionId" /> + <result column="action_type" property="actionType" /> + <result column="start_time" property="startTime" /> + <result column="join_type" property="joinType" /> + <result column="previous_session_id" property="previousSessionId" /> + <result column="share_id" property="shareId" /> + <result column="page_code" property="pageCode" /> + <result column="page_params" property="pageParams" /> + <result column="page_type" property="pageType" /> + <result column="page_status" property="pageStatus" /> + </resultMap> + + + + + + + + <select id="getById" resultMap="BaseResultMap"> + SELECT + LAR.user_id, + LAR.session_id, + LAR.action_type, + LAR.start_time, + LAR.join_type, + LAR.previous_session_id, + LAR.share_id, + LAR.page_code, + LAR.page_params, + LAR.page_type, + LAR.page_status, + LAR.id + FROM + lmk_action_record LAR + WHERE + LAR.id = #{id} AND LAR.delete_flag = 0 + </select> + + + <select id="getPage" resultMap="BaseResultMap"> + SELECT + LAR.user_id, + LAR.session_id, + LAR.action_type, + LAR.start_time, + LAR.join_type, + LAR.previous_session_id, + LAR.share_id, + LAR.page_code, + LAR.page_params, + LAR.page_type, + LAR.page_status, + LAR.id + FROM + lmk_action_record LAR + WHERE + LAR.delete_flag = 0 + </select> + +</mapper> diff --git a/manager-api/src/main/java/cn/lili/controller/lmk/ActionRecordManagerController.java b/manager-api/src/main/java/cn/lili/controller/lmk/ActionRecordManagerController.java new file mode 100644 index 0000000..22d40df --- /dev/null +++ b/manager-api/src/main/java/cn/lili/controller/lmk/ActionRecordManagerController.java @@ -0,0 +1,76 @@ +package cn.lili.controller.lmk; + +import cn.lili.group.Update; +import cn.lili.group.Add; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import lombok.RequiredArgsConstructor; +import java.util.List; +import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotEmpty; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import cn.lili.modules.lmk.service.ActionRecordService; +import cn.lili.base.Result; +import cn.lili.modules.lmk.domain.form.ActionRecordForm; +import cn.lili.modules.lmk.domain.query.ActionRecordQuery; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +/** + * 鐢ㄦ埛琛屼负璁板綍 鍓嶇鎺у埗鍣� + * + * @author peng + * @since 2025-09-08 + */ +@Validated +@RequiredArgsConstructor +@Api(value = "鐢ㄦ埛琛屼负璁板綍", tags = "鐢ㄦ埛琛屼负璁板綍绠$悊") +@RestController +@RequestMapping("/manager/lmk/action-record") +public class ActionRecordManagerController { + + private final ActionRecordService actionRecordService; + + @PostMapping + @ApiOperation(value = "娣诲姞", notes = "娣诲姞") + public Result add(@RequestBody @Validated(Add.class) ActionRecordForm form) { + return actionRecordService.add(form); + } + + @PutMapping + @ApiOperation(value = "淇敼", notes = "淇敼") + public Result update(@RequestBody @Validated(Update.class) ActionRecordForm form) { + return actionRecordService.update(form); + } + + @DeleteMapping("/{id}") + @ApiOperation(value = "ID鍒犻櫎", notes = "ID鍒犻櫎") + public Result removeById(@PathVariable("id") String id) { + return actionRecordService.removeById(id); + } + + @DeleteMapping("/batch") + @ApiOperation(value = "鎵归噺鍒犻櫎", notes = "鎵归噺鍒犻櫎") + public Result remove(@RequestBody @NotEmpty(message = "璇烽�夋嫨鏁版嵁") List<String> ids) { + return actionRecordService.remove(ids); + } + + @GetMapping("/page") + @ApiOperation(value = "鍒嗛〉", notes = "鍒嗛〉") + public Result page(ActionRecordQuery query) { + return actionRecordService.page(query); + } + + @GetMapping("/{id}") + @ApiOperation(value = "璇︽儏", notes = "璇︽儏") + public Result detail(@PathVariable("id") String id) { + return actionRecordService.detail(id); + } + + @GetMapping("/list") + @ApiOperation(value = "鍒楄〃", notes = "鍒楄〃") + public Result list() { + return actionRecordService.all(); + } +} -- Gitblit v1.8.0