张延森 3 yıl önce
ebeveyn
işleme
b5ab22ea2f

+ 2
- 2
bin/service.sh Dosyayı Görüntüle

@@ -30,13 +30,13 @@ stop() {
30 30
     echo ""
31 31
     echo "Stoping service ..."
32 32
 
33
-    PID=`ps -ef|grep marketing-v|grep -v grep|awk '{print $2}'`
33
+    PID=`ps -ef|grep shigongli-|grep -v grep|awk '{print $2}'`
34 34
     if [[ "$PID" != "" ]]; then
35 35
         kill -9 $PID
36 36
     fi
37 37
 
38 38
     # 这个延迟不能去掉
39
-    sleep 5s
39
+    sleep 1s
40 40
     echo "Service is stoped"
41 41
     echo ""
42 42
 }

+ 5
- 0
src/main/java/com/yunzhi/shigongli/common/Constants.java Dosyayı Görüntüle

@@ -46,6 +46,7 @@ public class Constants {
46 46
     public final static String TARGET_SHOP = "shop";                    // 商铺
47 47
     public final static String TARGET_SHOP_PACKAGE = "shop_package";    // 商铺套餐
48 48
     public final static String TARGET_TOURIST = "tourist";              // 景点
49
+    public final static String TARGET_NOTE = "note";                    // 笔记
49 50
 
50 51
     // 商品套餐类型
51 52
     public final static String PACKAGE_NORMAL = "normal";           // 普通套餐
@@ -78,4 +79,8 @@ public class Constants {
78 79
     // 公众号设置
79 80
     public final static String MP_SETTING_MINIAPP_POSTER = "miniapp_poster";            // 客服消息小程序封面
80 81
     public final static String MP_SETTING_HOTEL_CHECK_IN_TPL = "hotel_check_in_tpl";    // 房源入住提醒模板ID
82
+
83
+    // 笔记分类
84
+    public final static String NOTE_TYPE_IMAGE = "image";   // 图片
85
+    public final static String NOTE_TYPE_VIDEO = "video";   // 视频
81 86
 }

+ 2
- 1
src/main/java/com/yunzhi/shigongli/common/ExcelUtils.java Dosyayı Görüntüle

@@ -19,7 +19,8 @@ public class ExcelUtils {
19 19
     public static void flush(HttpServletResponse response, Class dataClass, List data, String fileName) throws IOException {
20 20
         response.setContentType("application/vnd.ms-excel");
21 21
         response.setCharacterEncoding("utf-8");
22
-        response.setHeader("Content-disposition", "attachment;filename="+StringUtils.urlEncode(fileName)+".xlsx");
22
+        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
23
+        response.setHeader("Content-Disposition", "attachment;filename="+StringUtils.urlEncode(fileName)+".xlsx");
23 24
 
24 25
         EasyExcel.write(response.getOutputStream(), dataClass).sheet("sheet1").doWrite(data);
25 26
     }

+ 226
- 0
src/main/java/com/yunzhi/shigongli/controller/TaNoteController.java Dosyayı Görüntüle

@@ -0,0 +1,226 @@
1
+package com.yunzhi.shigongli.controller;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.yunzhi.shigongli.common.BaseController;
6
+import com.yunzhi.shigongli.common.Constants;
7
+import com.yunzhi.shigongli.common.ResponseBean;
8
+import com.yunzhi.shigongli.entity.TaImage;
9
+import com.yunzhi.shigongli.entity.TaNote;
10
+import com.yunzhi.shigongli.entity.TaNoteResource;
11
+import com.yunzhi.shigongli.service.ITaImageService;
12
+import com.yunzhi.shigongli.service.ITaNoteResourceService;
13
+import com.yunzhi.shigongli.service.ITaNoteService;
14
+import com.yunzhi.shigongli.vo.NoteVO;
15
+import io.swagger.annotations.Api;
16
+import io.swagger.annotations.ApiOperation;
17
+import io.swagger.annotations.ApiParam;
18
+import org.slf4j.Logger;
19
+import org.slf4j.LoggerFactory;
20
+import org.springframework.beans.BeanUtils;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.web.bind.annotation.*;
23
+
24
+import java.time.LocalDateTime;
25
+import java.util.List;
26
+
27
+/**
28
+ * <p>
29
+    * 笔记 前端控制器
30
+    * </p>
31
+ *
32
+ * @author yansen
33
+ * @since 2021-08-17
34
+ */
35
+
36
+@Api(tags = "笔记")
37
+@RestController
38
+@RequestMapping("/")
39
+public class TaNoteController extends BaseController {
40
+
41
+    private final Logger logger = LoggerFactory.getLogger(TaNoteController.class);
42
+
43
+    @Autowired
44
+    public ITaNoteService iTaNoteService;
45
+
46
+    @Autowired
47
+    public ITaImageService iTaImageService;
48
+
49
+    @Autowired
50
+    public ITaNoteResourceService iTaNoteResourceService;
51
+
52
+
53
+    /**
54
+     * 分页查询列表
55
+     * @param pageNum
56
+     * @param pageSize
57
+     * @return
58
+     */
59
+    @RequestMapping(value="/admin/note",method= RequestMethod.GET)
60
+    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = TaNote.class)
61
+    public ResponseBean taPvList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
62
+                                 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
63
+                                 @ApiParam("笔记类型") @RequestParam(value ="noteType", required = false) String noteType,
64
+                                 @ApiParam("简介") @RequestParam(value ="summary", required = false) String summary) throws Exception{
65
+
66
+		    IPage<TaNote> pg = new Page<>(pageNum, pageSize);
67
+
68
+            IPage<TaNote> result = iTaNoteService.getPageBy(pg, noteType, summary);
69
+            return ResponseBean.success(result);
70
+    }
71
+
72
+    /**
73
+     * 保存对象
74
+     * @param noteVO 实体对象
75
+     * @return
76
+     */
77
+    @RequestMapping(value="/admin/note",method= RequestMethod.POST)
78
+    @ApiOperation(value="保存笔记", notes = "保存笔记", httpMethod = "POST", response = TaNote.class)
79
+    public ResponseBean taPvAdd(@ApiParam("保存内容") @RequestBody NoteVO noteVO) throws Exception{
80
+        if (null == noteVO) {
81
+            return ResponseBean.error("没有找到保存内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
82
+        }
83
+
84
+        if (null == noteVO.getNoteType()) {
85
+            return ResponseBean.error("请设置笔记类型", ResponseBean.ERROR_ILLEGAL_PARAMS);
86
+        }
87
+
88
+        // banner 图集
89
+        List<TaImage> imageList = noteVO.getImageList();
90
+        if ((null == imageList || imageList.size() == 0) && Constants.NOTE_TYPE_IMAGE.equals(noteVO.getNoteType())) {
91
+            return ResponseBean.error("请上传 banner 图片", ResponseBean.ERROR_ILLEGAL_PARAMS);
92
+        }
93
+
94
+        // 关联地点
95
+        List<TaNoteResource> resourceList = noteVO.getResourceList();
96
+        if (null == resourceList || resourceList.size() == 0) {
97
+            // 暂时不处理
98
+        }
99
+
100
+        LocalDateTime now = LocalDateTime.now();
101
+        noteVO.setCreateDate(now);
102
+        if (null == noteVO.getStatus()) {
103
+            noteVO.setStatus(Constants.STATUS_NORMAL);
104
+        }
105
+
106
+        TaNote taNote = new TaNote();
107
+        BeanUtils.copyProperties(noteVO, taNote);
108
+
109
+        if (iTaNoteService.save(taNote)) {
110
+            noteVO.setNoteId(taNote.getNoteId());
111
+
112
+            // banner 图集
113
+            if (Constants.NOTE_TYPE_IMAGE.equals(noteVO.getNoteType())) {
114
+                for (TaImage image : imageList) {
115
+                    image.setCreateDate(now);
116
+                    image.setImageType("banner");
117
+                }
118
+                iTaImageService.updateImages(Constants.TARGET_NOTE, taNote.getNoteId(), imageList);
119
+            }
120
+
121
+            // 关联地点
122
+            if (null != resourceList && resourceList.size() > 0) {
123
+                iTaNoteResourceService.updateResource(taNote.getNoteId(), resourceList);
124
+            }
125
+
126
+            return ResponseBean.success(noteVO);
127
+        } else {
128
+            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
129
+        }
130
+    }
131
+
132
+    /**
133
+     * 根据id删除对象
134
+     * @param id  实体ID
135
+     */
136
+    @RequestMapping(value="/admin/note", method= RequestMethod.DELETE)
137
+    @ApiOperation(value="删除笔记", notes = "删除笔记", httpMethod = "DELETE", response = ResponseBean.class)
138
+    public ResponseBean taPvDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
139
+        if(iTaNoteService.removeLogicById(id)){
140
+            return ResponseBean.success("success");
141
+        }else {
142
+            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
143
+        }
144
+    }
145
+
146
+    /**
147
+     * 修改对象
148
+     * @param id  实体ID
149
+     * @param noteVO 实体对象
150
+     * @return
151
+     */
152
+    @RequestMapping(value="/taPv/{id}",method= RequestMethod.PUT)
153
+    @ApiOperation(value="更新笔记", notes = "更新笔记", httpMethod = "PUT", response = ResponseBean.class)
154
+    public ResponseBean taPvUpdate(@ApiParam("对象ID") @PathVariable String id,
155
+                                   @ApiParam("更新内容") @RequestBody NoteVO noteVO) throws Exception {
156
+
157
+        TaNote taNote = iTaNoteService.getById(id);
158
+        if (null == taNote || Constants.STATUS_DELETED == taNote.getStatus()) {
159
+            return ResponseBean.error("没有找到更新内容", ResponseBean.ERROR_UNAVAILABLE);
160
+        }
161
+
162
+
163
+        if (null == noteVO.getNoteType()) {
164
+            return ResponseBean.error("请设置笔记类型", ResponseBean.ERROR_ILLEGAL_PARAMS);
165
+        }
166
+
167
+        // banner 图集
168
+        List<TaImage> imageList = noteVO.getImageList();
169
+        if ((null == imageList || imageList.size() == 0) && Constants.NOTE_TYPE_IMAGE.equals(noteVO.getNoteType())) {
170
+            return ResponseBean.error("请上传 banner 图片", ResponseBean.ERROR_ILLEGAL_PARAMS);
171
+        }
172
+
173
+        // 关联地点
174
+        List<TaNoteResource> resourceList = noteVO.getResourceList();
175
+        if (null == resourceList || resourceList.size() == 0) {
176
+            // 暂时不处理
177
+        }
178
+
179
+        LocalDateTime now = LocalDateTime.now();
180
+        BeanUtils.copyProperties(noteVO, taNote);
181
+        taNote.setNoteId(id);
182
+
183
+        if (iTaNoteService.updateById(taNote)) {
184
+
185
+            // banner 图集
186
+            if (Constants.NOTE_TYPE_IMAGE.equals(noteVO.getNoteType())) {
187
+                for (TaImage image : imageList) {
188
+                    image.setCreateDate(now);
189
+                    image.setImageType("banner");
190
+                }
191
+                iTaImageService.updateImages(Constants.TARGET_NOTE, taNote.getNoteId(), imageList);
192
+            }
193
+
194
+            // 关联地点
195
+            if (null != resourceList && resourceList.size() > 0) {
196
+                iTaNoteResourceService.updateResource(taNote.getNoteId(), resourceList);
197
+            }
198
+
199
+            return ResponseBean.success(noteVO);
200
+        } else {
201
+            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
202
+        }
203
+    }
204
+
205
+    /**
206
+     * 根据id查询对象
207
+     * @param id  实体ID
208
+     */
209
+    @RequestMapping(value="/admin/note/{id}",method= RequestMethod.GET)
210
+    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
211
+    public ResponseBean taPvGet(@ApiParam("对象ID") @PathVariable String id) throws Exception {
212
+        TaNote taNote = iTaNoteService.getById(id);
213
+        if (null == taNote || Constants.STATUS_DELETED == taNote.getStatus()) {
214
+            return ResponseBean.error("没有找到更新内容", ResponseBean.ERROR_UNAVAILABLE);
215
+        }
216
+
217
+        NoteVO noteVO = new NoteVO();
218
+        BeanUtils.copyProperties(taNote, noteVO);
219
+
220
+
221
+        noteVO.setImageList(iTaImageService.getListBy(Constants.TARGET_NOTE, id));
222
+        noteVO.setResourceList(iTaNoteResourceService.getListBy(id));
223
+
224
+        return ResponseBean.success(noteVO);
225
+    }
226
+}

+ 25
- 0
src/main/java/com/yunzhi/shigongli/controller/TaResourceController.java Dosyayı Görüntüle

@@ -1,8 +1,10 @@
1 1
 package com.yunzhi.shigongli.controller;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 6
 import com.yunzhi.shigongli.common.BaseController;
7
+import com.yunzhi.shigongli.common.Constants;
6 8
 import com.yunzhi.shigongli.common.ResponseBean;
7 9
 import com.yunzhi.shigongli.common.StringUtils;
8 10
 import com.yunzhi.shigongli.entity.TaResource;
@@ -74,4 +76,27 @@ public class TaResourceController extends BaseController {
74 76
 
75 77
         return ResponseBean.success(resourceListVO);
76 78
     }
79
+
80
+    /**
81
+     * 资源字典
82
+     * @param pageNum
83
+     * @param pageSize
84
+     * @param targetName
85
+     * @return
86
+     * @throws Exception
87
+     */
88
+    @GetMapping("/admin/resource/dict")
89
+    @ApiOperation(value="获取资源字典", notes = "获取资源字典", httpMethod = "GET", response = ResponseBean.class)
90
+    public ResponseBean getDict(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
91
+                                @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
92
+                                @ApiParam("资源名称") @RequestParam(value = "targetName", required = false) String targetName) throws Exception {
93
+        IPage<TaResource> pg = new Page<>(pageNum, pageSize);
94
+        QueryWrapper<TaResource> queryWrapper = new QueryWrapper<>();
95
+        queryWrapper.eq("status", Constants.STATUS_NORMAL);
96
+        queryWrapper.like(!StringUtils.isEmpty(targetName), "target_name", "%"+targetName+"%");
97
+        queryWrapper.orderByDesc("weight");
98
+        queryWrapper.orderByDesc("create_date");
99
+
100
+        return ResponseBean.success(iTaResourceService.page(pg, queryWrapper));
101
+    }
77 102
 }

+ 65
- 0
src/main/java/com/yunzhi/shigongli/entity/TaNote.java Dosyayı Görüntüle

@@ -0,0 +1,65 @@
1
+package com.yunzhi.shigongli.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 笔记表
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-08-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TaNote对象", description="笔记表")
26
+public class TaNote implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "笔记ID")
31
+    @TableId(value = "note_id", type = IdType.UUID)
32
+    private String noteId;
33
+
34
+    @ApiModelProperty(value = "标题")
35
+    private String title;
36
+
37
+    @ApiModelProperty(value = "简介")
38
+    private String summary;
39
+
40
+    @ApiModelProperty(value = "笔记类型;image图片,video视频")
41
+    private String noteType;
42
+
43
+    @ApiModelProperty(value = "封面")
44
+    private String poster;
45
+
46
+    @ApiModelProperty(value = "视频地址")
47
+    private String videoUrl;
48
+
49
+    @ApiModelProperty(value = "PV")
50
+    private Integer pvNum;
51
+
52
+    @ApiModelProperty(value = "UV")
53
+    private Integer uvNum;
54
+
55
+    @ApiModelProperty(value = "权重")
56
+    private Integer weight;
57
+
58
+    @ApiModelProperty(value = "状态")
59
+    private Integer status;
60
+
61
+    @ApiModelProperty(value = "创建时间")
62
+    private LocalDateTime createDate;
63
+
64
+
65
+}

+ 39
- 0
src/main/java/com/yunzhi/shigongli/entity/TaNoteResource.java Dosyayı Görüntüle

@@ -0,0 +1,39 @@
1
+package com.yunzhi.shigongli.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 笔记相关资源
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-08-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TaNoteResource对象", description="笔记相关资源")
26
+public class TaNoteResource implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "序号")
31
+    @TableId(value = "serial_no", type = IdType.AUTO)
32
+    private Integer serialNo;
33
+
34
+    @ApiModelProperty(value = "笔记ID")
35
+    private String noteId;
36
+
37
+    @ApiModelProperty(value = "资源序号")
38
+    private String resourceNo;
39
+}

+ 50
- 0
src/main/java/com/yunzhi/shigongli/entity/TaShare.java Dosyayı Görüntüle

@@ -0,0 +1,50 @@
1
+package com.yunzhi.shigongli.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 分享表
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-08-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TaShare对象", description="分享表")
26
+public class TaShare implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "分享ID")
31
+    @TableId(value = "share_id", type = IdType.AUTO)
32
+    private Integer shareId;
33
+
34
+    @ApiModelProperty(value = "人员ID")
35
+    private String personId;
36
+
37
+    @ApiModelProperty(value = "资源类型")
38
+    private String targetType;
39
+
40
+    @ApiModelProperty(value = "资源ID")
41
+    private String targetId;
42
+
43
+    @ApiModelProperty(value = "分享地址")
44
+    private String shareUrl;
45
+
46
+    @ApiModelProperty(value = "访问时间")
47
+    private LocalDateTime createDate;
48
+
49
+
50
+}

+ 44
- 0
src/main/java/com/yunzhi/shigongli/entity/TaShareOpen.java Dosyayı Görüntüle

@@ -0,0 +1,44 @@
1
+package com.yunzhi.shigongli.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 分享打开
17
+ * </p>
18
+ *
19
+ * @author yansen
20
+ * @since 2021-08-17
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@ApiModel(value="TaShareOpen对象", description="分享打开")
26
+public class TaShareOpen implements Serializable {
27
+
28
+    private static final long serialVersionUID = 1L;
29
+
30
+    @ApiModelProperty(value = "序号")
31
+    @TableId(value = "serial_no", type = IdType.AUTO)
32
+    private Integer serialNo;
33
+
34
+    @ApiModelProperty(value = "分享ID")
35
+    private Integer shareId;
36
+
37
+    @ApiModelProperty(value = "人员ID")
38
+    private String personId;
39
+
40
+    @ApiModelProperty(value = "访问时间")
41
+    private LocalDateTime createDate;
42
+
43
+
44
+}

+ 9
- 0
src/main/java/com/yunzhi/shigongli/entity/TaShopPackage.java Dosyayı Görüntüle

@@ -81,4 +81,13 @@ public class TaShopPackage implements Serializable {
81 81
     @ApiModelProperty(value = "是否收藏")
82 82
     @TableField(exist = false)
83 83
     private Integer isSaved;
84
+
85
+    @ApiModelProperty(value = "网站名称")
86
+    private String siteName;
87
+
88
+    @ApiModelProperty(value = "外链地址")
89
+    private String link;
90
+
91
+    @ApiModelProperty(value = "网站内容类型")
92
+    private String sitePackageType;
84 93
 }

+ 21
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaNoteMapper.java Dosyayı Görüntüle

@@ -0,0 +1,21 @@
1
+package com.yunzhi.shigongli.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.yunzhi.shigongli.entity.TaNote;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+/**
10
+ * <p>
11
+ * 笔记 Mapper 接口
12
+ * </p>
13
+ *
14
+ * @author yansen
15
+ * @since 2021-08-17
16
+ */
17
+@Mapper
18
+public interface TaNoteMapper extends BaseMapper<TaNote> {
19
+
20
+    IPage<TaNote> getPageBy(IPage<TaNote> pg, @Param("noteType") String noteType, @Param("summary") String summary);
21
+}

+ 18
- 0
src/main/java/com/yunzhi/shigongli/mapper/TaNoteResourceMapper.java Dosyayı Görüntüle

@@ -0,0 +1,18 @@
1
+package com.yunzhi.shigongli.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.yunzhi.shigongli.entity.TaNoteResource;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ * 笔记资源 Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author yansen
13
+ * @since 2021-08-17
14
+ */
15
+@Mapper
16
+public interface TaNoteResourceMapper extends BaseMapper<TaNoteResource> {
17
+
18
+}

+ 20
- 0
src/main/java/com/yunzhi/shigongli/service/ITaNoteResourceService.java Dosyayı Görüntüle

@@ -0,0 +1,20 @@
1
+package com.yunzhi.shigongli.service;
2
+
3
+import com.yunzhi.shigongli.entity.TaNoteResource;
4
+
5
+import java.util.List;
6
+
7
+
8
+/**
9
+ * <p>
10
+ * 笔记资源 服务类
11
+ * </p>
12
+ *
13
+ * @author yansen
14
+ * @since 2021-08-17
15
+ */
16
+public interface ITaNoteResourceService extends IBaseService<TaNoteResource> {
17
+    boolean updateResource(String noteId, List<TaNoteResource> resourceList) throws Exception;
18
+
19
+    List<TaNoteResource> getListBy(String noteId);
20
+}

+ 19
- 0
src/main/java/com/yunzhi/shigongli/service/ITaNoteService.java Dosyayı Görüntüle

@@ -0,0 +1,19 @@
1
+package com.yunzhi.shigongli.service;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.yunzhi.shigongli.entity.TaNote;
5
+import com.yunzhi.shigongli.vo.NoteVO;
6
+
7
+
8
+/**
9
+ * <p>
10
+ * 笔记 服务类
11
+ * </p>
12
+ *
13
+ * @author yansen
14
+ * @since 2021-08-17
15
+ */
16
+public interface ITaNoteService extends IBaseService<TaNote> {
17
+    IPage<TaNote> getPageBy(IPage<TaNote> pg, String noteType, String summary);
18
+
19
+}

+ 46
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaNoteResourceServiceImpl.java Dosyayı Görüntüle

@@ -0,0 +1,46 @@
1
+package com.yunzhi.shigongli.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.yunzhi.shigongli.entity.TaNote;
5
+import com.yunzhi.shigongli.entity.TaNoteResource;
6
+import com.yunzhi.shigongli.mapper.TaNoteResourceMapper;
7
+import com.yunzhi.shigongli.service.ITaNoteResourceService;
8
+import org.springframework.stereotype.Service;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ * 笔记资源 服务实现类
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2021-08-17
19
+ */
20
+@Service
21
+public class TaNoteResourceServiceImpl extends BaseServiceImpl<TaNoteResourceMapper, TaNoteResource> implements ITaNoteResourceService {
22
+
23
+    @Override
24
+    public boolean updateResource(String noteId, List<TaNoteResource> resourceList) throws Exception {
25
+        // 先删除原来的
26
+        QueryWrapper<TaNoteResource> queryWrapper = new QueryWrapper<>();
27
+        queryWrapper.eq("note_id", noteId);
28
+        remove(queryWrapper);
29
+
30
+        // 再插入
31
+        for (TaNoteResource noteResource : resourceList) {
32
+            noteResource.setNoteId(noteId);
33
+            noteResource.setSerialNo(null);
34
+        }
35
+
36
+        return saveBatch(resourceList);
37
+    }
38
+
39
+    @Override
40
+    public List<TaNoteResource> getListBy(String noteId) {
41
+        QueryWrapper<TaNoteResource> queryWrapper = new QueryWrapper<>();
42
+        queryWrapper.eq("note_id", noteId);
43
+
44
+        return list(queryWrapper);
45
+    }
46
+}

+ 25
- 0
src/main/java/com/yunzhi/shigongli/service/impl/TaNoteServiceImpl.java Dosyayı Görüntüle

@@ -0,0 +1,25 @@
1
+package com.yunzhi.shigongli.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.yunzhi.shigongli.entity.TaNote;
5
+import com.yunzhi.shigongli.mapper.TaNoteMapper;
6
+import com.yunzhi.shigongli.service.ITaNoteService;
7
+import com.yunzhi.shigongli.vo.NoteVO;
8
+import org.springframework.stereotype.Service;
9
+
10
+/**
11
+ * <p>
12
+ * 笔记 服务实现类
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2021-08-17
17
+ */
18
+@Service
19
+public class TaNoteServiceImpl extends BaseServiceImpl<TaNoteMapper, TaNote> implements ITaNoteService {
20
+
21
+    @Override
22
+    public IPage<TaNote> getPageBy(IPage<TaNote> pg, String noteType, String summary) {
23
+        return baseMapper.getPageBy(pg, noteType, summary);
24
+    }
25
+}

+ 54
- 0
src/main/java/com/yunzhi/shigongli/vo/NoteVO.java Dosyayı Görüntüle

@@ -0,0 +1,54 @@
1
+package com.yunzhi.shigongli.vo;
2
+
3
+import com.yunzhi.shigongli.entity.TaImage;
4
+import com.yunzhi.shigongli.entity.TaNoteResource;
5
+import io.swagger.annotations.ApiModel;
6
+import io.swagger.annotations.ApiModelProperty;
7
+import lombok.Data;
8
+
9
+import java.time.LocalDateTime;
10
+import java.util.List;
11
+
12
+@ApiModel(description = "笔记内容")
13
+@Data
14
+public class NoteVO {
15
+
16
+    @ApiModelProperty(value = "笔记ID")
17
+    private String noteId;
18
+
19
+    @ApiModelProperty(value = "标题")
20
+    private String title;
21
+
22
+    @ApiModelProperty(value = "简介")
23
+    private String summary;
24
+
25
+    @ApiModelProperty(value = "笔记类型;image图片,video视频")
26
+    private String noteType;
27
+
28
+    @ApiModelProperty(value = "封面")
29
+    private String poster;
30
+
31
+    @ApiModelProperty(value = "视频地址")
32
+    private String videoUrl;
33
+
34
+    @ApiModelProperty(value = "PV")
35
+    private Integer pvNum;
36
+
37
+    @ApiModelProperty(value = "UV")
38
+    private Integer uvNum;
39
+
40
+    @ApiModelProperty(value = "权重")
41
+    private Integer weight;
42
+
43
+    @ApiModelProperty(value = "状态")
44
+    private Integer status;
45
+
46
+    @ApiModelProperty(value = "创建时间")
47
+    private LocalDateTime createDate;
48
+
49
+    @ApiModelProperty(value = "图片列表")
50
+    private List<TaImage> imageList;
51
+
52
+    @ApiModelProperty(value = "笔记资源")
53
+    private List<TaNoteResource> resourceList;
54
+}

+ 1
- 1
src/main/java/com/yunzhi/shigongli/vo/ShopOrderVO.java Dosyayı Görüntüle

@@ -17,7 +17,7 @@ public class ShopOrderVO {
17 17
     @ApiModelProperty(value = "店铺ID")
18 18
     private String shopId;
19 19
 
20
-    @ExcelProperty(value = "民宿名称", index = 0)
20
+    @ExcelProperty(value = "店铺名称", index = 0)
21 21
     @ColumnWidth(30)
22 22
     @ApiModelProperty(value = "店铺名称")
23 23
     private String shopName;

+ 11
- 0
src/main/java/com/yunzhi/shigongli/vo/ShopPackageVO.java Dosyayı Görüntüle

@@ -128,4 +128,15 @@ public class ShopPackageVO {
128 128
     @ApiModelProperty(value = "类别")
129 129
     private List<TaTargetDietMark> dietMarkList;
130 130
 
131
+    @ExcelIgnore
132
+    @ApiModelProperty(value = "网站名称")
133
+    private String siteName;
134
+
135
+    @ExcelIgnore
136
+    @ApiModelProperty(value = "外链地址")
137
+    private String link;
138
+
139
+    @ExcelIgnore
140
+    @ApiModelProperty(value = "网站内容类型")
141
+    private String sitePackageType;
131 142
 }

+ 22
- 0
src/main/resources/mapper/TaNoteMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.shigongli.mapper.TaNoteMapper">
4
+
5
+    <select id="getPageBy" resultType="com.yunzhi.shigongli.entity.TaNote">
6
+        SELECT
7
+            *
8
+        FROM
9
+            ta_note t
10
+        WHERE
11
+            t.`status` > - 1
12
+          <if test="noteType != null and noteType != ''">
13
+              AND t.note_type = #{noteType}
14
+          </if>
15
+            <if test="summary != null and summary != ''">
16
+                AND t.summary LIKE CONCAT( '%', #{summary}, '%' )
17
+            </if>
18
+        ORDER BY
19
+            t.weight DESC,
20
+            t.create_date DESC
21
+    </select>
22
+</mapper>

+ 5
- 0
src/main/resources/mapper/TaNoteResourceMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.shigongli.mapper.TaNoteResourceMapper">
4
+
5
+</mapper>