动态管理使用枚举类

This commit is contained in:
pserimal
2023-06-15 18:16:07 +08:00
parent 39782aec34
commit 3fb8e439ec
9 changed files with 60 additions and 15 deletions

View File

@@ -0,0 +1,17 @@
package com.cool.store.enums;
/**
* 动态栏目枚举类
*/
public enum ContentSubjectEnum {
HY_CULTURE("沪姨文化"),
PARTNER_SAYS("加盟商说"),
BRAND_NEWS("品牌动态")
;
private String subjectName;
ContentSubjectEnum(String subjectName) {
this.subjectName = subjectName;
}
}

View File

@@ -0,0 +1,16 @@
package com.cool.store.enums;
/**
* 动态类型(图文/视频)
*/
public enum ContentTypeEnum {
VIDEO("视频"),
IMAGE("图文")
;
private String type;
ContentTypeEnum(String type) {
this.type = type;
}
}

View File

@@ -153,10 +153,10 @@
<if test="contentTitle != null and contentTitle != ''">
and content_title like concat('%', #{contentTitle}, '%')
</if>
<if test="subject != null and subject != ''">
<if test="subject != null">
and subject = #{subject}
</if>
<if test="contentType != null and contentType != ''">
<if test="contentType != null">
and content_type = #{contentType}
</if>
<if test="startTime != null and startTime != ''">

View File

@@ -1,5 +1,7 @@
package com.cool.store.dto.content;
import com.cool.store.enums.ContentSubjectEnum;
import com.cool.store.enums.ContentTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -13,10 +15,10 @@ public class ContentAddDto {
private String status;
@ApiModelProperty(value = "栏目code", required = true)
private String subject;
private ContentSubjectEnum subject;
@ApiModelProperty(value = "类型", required = true)
private String contentType;
private ContentTypeEnum contentType;
@ApiModelProperty(value = "封面地址", required = true)
private String cover;

View File

@@ -1,6 +1,8 @@
package com.cool.store.dto.content;
import com.cool.store.common.PageBasicInfo;
import com.cool.store.enums.ContentSubjectEnum;
import com.cool.store.enums.ContentTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -13,10 +15,10 @@ public class ContentQueryListDto extends PageBasicInfo {
private String contentTitle;
@ApiModelProperty("栏目Code")
private String subject;
private ContentSubjectEnum subject;
@ApiModelProperty("类型,默认选中全部时不传值")
private String contentType;
private ContentTypeEnum contentType;
@ApiModelProperty("筛选开始时间")
private String startTime;

View File

@@ -1,5 +1,7 @@
package com.cool.store.dto.content;
import com.cool.store.enums.ContentSubjectEnum;
import com.cool.store.enums.ContentTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,10 +18,10 @@ public class ContentUpdateDto {
private String status;
@ApiModelProperty("栏目code")
private String subject;
private ContentSubjectEnum subject;
@ApiModelProperty("类型")
private String contentType;
private ContentTypeEnum contentType;
@ApiModelProperty("封面地址")
private String cover;

View File

@@ -1,8 +1,10 @@
package com.cool.store.entity;
import com.cool.store.enums.ContentSubjectEnum;
import com.cool.store.enums.ContentTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -25,10 +27,10 @@ public class HyContentInfoDO implements Serializable {
private String contentTitle;
@ApiModelProperty("栏目CODE")
private String subject;
private ContentSubjectEnum subject;
@ApiModelProperty("类型 image-图文 video-视频")
private String contentType;
private ContentTypeEnum contentType;
@ApiModelProperty("封面URL")
private String cover;

View File

@@ -1,5 +1,7 @@
package com.cool.store.vo;
import com.cool.store.enums.ContentSubjectEnum;
import com.cool.store.enums.ContentTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -13,10 +15,10 @@ public class HyContentInfoVO {
private String contentTitle;
@ApiModelProperty("栏目CODE")
private String subject;
private ContentSubjectEnum subject;
@ApiModelProperty("类型 image-图文 video-视频")
private String contentType;
private ContentTypeEnum contentType;
@ApiModelProperty("封面URL")
private String cover;

View File

@@ -32,14 +32,16 @@ public class ContentController {
@PostMapping("/delete")
@ApiOperation("删除动态")
public void deleteContent(@RequestParam(value = "contentId") String contentId) {
public ResponseResult deleteContent(@RequestParam(value = "contentId") String contentId) {
contentService.deleteContent(contentId);
return ResponseResult.success();
}
@PostMapping("/modify")
@ApiOperation("修改动态")
public void updateContent(@RequestBody ContentUpdateDto dto) {
public ResponseResult updateContent(@RequestBody ContentUpdateDto dto) {
contentService.updateContent(dto);
return ResponseResult.success();
}
@PostMapping("/queryContentList")