张延森 4 years ago
parent
commit
7f1e7755b0

+ 6
- 0
src/main/java/com/shigongli/controller/CommController.java View File

3
 import com.shigongli.common.BaseController;
3
 import com.shigongli.common.BaseController;
4
 import com.shigongli.common.OSSUtils;
4
 import com.shigongli.common.OSSUtils;
5
 import com.shigongli.common.ResponseBean;
5
 import com.shigongli.common.ResponseBean;
6
+import io.swagger.annotations.Api;
6
 import io.swagger.annotations.ApiOperation;
7
 import io.swagger.annotations.ApiOperation;
7
 import org.springframework.beans.factory.annotation.Autowired;
8
 import org.springframework.beans.factory.annotation.Autowired;
8
 import org.springframework.web.bind.annotation.PostMapping;
9
 import org.springframework.web.bind.annotation.PostMapping;
10
+import org.springframework.web.bind.annotation.RequestMapping;
9
 import org.springframework.web.bind.annotation.RequestParam;
11
 import org.springframework.web.bind.annotation.RequestParam;
12
+import org.springframework.web.bind.annotation.RestController;
10
 import org.springframework.web.multipart.MultipartFile;
13
 import org.springframework.web.multipart.MultipartFile;
11
 
14
 
12
 import java.io.IOException;
15
 import java.io.IOException;
13
 
16
 
17
+@Api(tags = "通用")
18
+@RestController
19
+@RequestMapping("/")
14
 public class CommController extends BaseController {
20
 public class CommController extends BaseController {
15
 
21
 
16
     @Autowired
22
     @Autowired

+ 77
- 63
src/main/java/com/shigongli/controller/TaMetaImageController.java View File

4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.shigongli.common.BaseController;
6
 import com.shigongli.common.BaseController;
7
+import com.shigongli.common.OSSUtils;
7
 import com.shigongli.common.ResponseBean;
8
 import com.shigongli.common.ResponseBean;
8
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiOperation;
19
 import com.shigongli.service.ITaMetaImageService;
20
 import com.shigongli.service.ITaMetaImageService;
20
 import com.shigongli.entity.TaMetaImage;
21
 import com.shigongli.entity.TaMetaImage;
21
 import org.springframework.web.bind.annotation.RestController;
22
 import org.springframework.web.bind.annotation.RestController;
23
+import org.springframework.web.multipart.MultipartFile;
24
+
25
+import java.io.IOException;
22
 
26
 
23
 /**
27
 /**
24
  * <p>
28
  * <p>
39
     @Autowired
43
     @Autowired
40
     public ITaMetaImageService iTaMetaImageService;
44
     public ITaMetaImageService iTaMetaImageService;
41
 
45
 
46
+    @Autowired
47
+    OSSUtils ossUtils;
42
 
48
 
43
-    /**
44
-     * 分页查询列表
45
-     * @param pageNum
46
-     * @param pageSize
47
-     * @return
48
-     */
49
-    @RequestMapping(value="/taMetaImage",method= RequestMethod.GET)
50
-    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean taMetaImageList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
-
54
-		    IPage<TaMetaImage> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaMetaImage> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
57
-
58
-            IPage<TaMetaImage> result = iTaMetaImageService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
60
-    }
61
 
49
 
50
+//    /**
51
+//     * 分页查询列表
52
+//     * @param pageNum
53
+//     * @param pageSize
54
+//     * @return
55
+//     */
56
+//    @RequestMapping(value="/taMetaImage",method= RequestMethod.GET)
57
+//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
58
+//    public ResponseBean taMetaImageList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
59
+//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
60
+//
61
+//		    IPage<TaMetaImage> pg = new Page<>(pageNum, pageSize);
62
+//            QueryWrapper<TaMetaImage> queryWrapper = new QueryWrapper<>();
63
+//            queryWrapper.orderByDesc("create_date");
64
+//
65
+//            IPage<TaMetaImage> result = iTaMetaImageService.page(pg, queryWrapper);
66
+//            return ResponseBean.success(result);
67
+//    }
68
+//
62
     /**
69
     /**
63
      * 保存对象
70
      * 保存对象
64
      * @param taMetaImage 实体对象
71
      * @param taMetaImage 实体对象
65
      * @return
72
      * @return
66
      */
73
      */
67
-    @RequestMapping(value="/taMetaImage",method= RequestMethod.POST)
74
+    @RequestMapping(value="/mp/taMetaImage",method= RequestMethod.POST)
68
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
75
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean taMetaImageAdd(@ApiParam("保存内容") @RequestBody TaMetaImage taMetaImage) throws Exception{
70
-
71
-        if (iTaMetaImageService.save(taMetaImage)){
72
-            return ResponseBean.success(taMetaImage);
73
-        }else {
74
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
-        }
76
-    }
76
+    public ResponseBean taMetaImageAdd(@RequestParam("file") MultipartFile multipartFile) throws Exception{
77
 
77
 
78
-    /**
79
-     * 根据id删除对象
80
-     * @param id  实体ID
81
-     */
82
-    @RequestMapping(value="/taMetaImage/{id}", method= RequestMethod.DELETE)
83
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taMetaImageDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaMetaImageService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
-        }
90
-    }
78
+        try {
79
+            String image = ossUtils.putObject(multipartFile, "/shigongli/images/");
91
 
80
 
92
-    /**
93
-     * 修改对象
94
-     * @param id  实体ID
95
-     * @param taMetaImage 实体对象
96
-     * @return
97
-     */
98
-    @RequestMapping(value="/taMetaImage/{id}",method= RequestMethod.PUT)
99
-    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taMetaImageUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody TaMetaImage taMetaImage) throws Exception{
81
+            TaMetaImage taMetaImage = new TaMetaImage();
82
+            taMetaImage.setImage(image);
102
 
83
 
103
-        if (iTaMetaImageService.updateById(taMetaImage)){
104
-            return ResponseBean.success(iTaMetaImageService.getById(id));
105
-        }else {
106
-            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
84
+            iTaMetaImageService.save(taMetaImage);
85
+            return ResponseBean.success(taMetaImage);
86
+        } catch (IOException e) {
87
+            return ResponseBean.error("上传图片失败: " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
107
         }
88
         }
108
-    }
109
 
89
 
110
-    /**
111
-     * 根据id查询对象
112
-     * @param id  实体ID
113
-     */
114
-    @RequestMapping(value="/taMetaImage/{id}",method= RequestMethod.GET)
115
-    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taMetaImageGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTaMetaImageService.getById(id));
118
     }
90
     }
91
+//
92
+//    /**
93
+//     * 根据id删除对象
94
+//     * @param id  实体ID
95
+//     */
96
+//    @RequestMapping(value="/taMetaImage/{id}", method= RequestMethod.DELETE)
97
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
98
+//    public ResponseBean taMetaImageDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
99
+//        if(iTaMetaImageService.removeById(id)){
100
+//            return ResponseBean.success("success");
101
+//        }else {
102
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
103
+//        }
104
+//    }
105
+//
106
+//    /**
107
+//     * 修改对象
108
+//     * @param id  实体ID
109
+//     * @param taMetaImage 实体对象
110
+//     * @return
111
+//     */
112
+//    @RequestMapping(value="/taMetaImage/{id}",method= RequestMethod.PUT)
113
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
114
+//    public ResponseBean taMetaImageUpdate(@ApiParam("对象ID") @PathVariable Integer id,
115
+//                                        @ApiParam("更新内容") @RequestBody TaMetaImage taMetaImage) throws Exception{
116
+//
117
+//        if (iTaMetaImageService.updateById(taMetaImage)){
118
+//            return ResponseBean.success(iTaMetaImageService.getById(id));
119
+//        }else {
120
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
121
+//        }
122
+//    }
123
+//
124
+//    /**
125
+//     * 根据id查询对象
126
+//     * @param id  实体ID
127
+//     */
128
+//    @RequestMapping(value="/taMetaImage/{id}",method= RequestMethod.GET)
129
+//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
130
+//    public ResponseBean taMetaImageGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
131
+//        return ResponseBean.success(iTaMetaImageService.getById(id));
132
+//    }
119
 }
133
 }

+ 69
- 48
src/main/java/com/shigongli/controller/TaMetaImageTagController.java View File

20
 import com.shigongli.entity.TaMetaImageTag;
20
 import com.shigongli.entity.TaMetaImageTag;
21
 import org.springframework.web.bind.annotation.RestController;
21
 import org.springframework.web.bind.annotation.RestController;
22
 
22
 
23
+import java.util.ArrayList;
24
+import java.util.List;
25
+import java.util.Map;
26
+
23
 /**
27
 /**
24
  * <p>
28
  * <p>
25
     * 图片标签 前端控制器
29
     * 图片标签 前端控制器
49
     @RequestMapping(value="/taMetaImageTag",method= RequestMethod.GET)
53
     @RequestMapping(value="/taMetaImageTag",method= RequestMethod.GET)
50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
54
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     public ResponseBean taMetaImageTagList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
55
     public ResponseBean taMetaImageTagList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
56
+                                           @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
57
+                                           @ApiParam("标签ID") @RequestParam(value ="tagId") String tagId) throws Exception{
53
 
58
 
54
 		    IPage<TaMetaImageTag> pg = new Page<>(pageNum, pageSize);
59
 		    IPage<TaMetaImageTag> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaMetaImageTag> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
57
 
60
 
58
-            IPage<TaMetaImageTag> result = iTaMetaImageTagService.page(pg, queryWrapper);
61
+            IPage<TaMetaImageTag> result = iTaMetaImageTagService.pagedBy(pg, tagId);
59
             return ResponseBean.success(result);
62
             return ResponseBean.success(result);
60
     }
63
     }
61
 
64
 
66
      */
69
      */
67
     @RequestMapping(value="/taMetaImageTag",method= RequestMethod.POST)
70
     @RequestMapping(value="/taMetaImageTag",method= RequestMethod.POST)
68
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
71
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
-    public ResponseBean taMetaImageTagAdd(@ApiParam("保存内容") @RequestBody TaMetaImageTag taMetaImageTag) throws Exception{
72
+    public ResponseBean taMetaImageTagAdd(@ApiParam("保存内容") @RequestBody List<Map<String, String>> datas) throws Exception{
73
+        List<String> tagIds = new ArrayList<>();
74
+        List<TaMetaImageTag> taMetaImageTags = new ArrayList<>();
70
 
75
 
71
-        if (iTaMetaImageTagService.save(taMetaImageTag)){
72
-            return ResponseBean.success(taMetaImageTag);
73
-        }else {
74
-            return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
75
-        }
76
-    }
76
+        for (Map<String, String> item: datas) {
77
+            String tagId = item.get("tagId");
78
+            String imageId = item.get("imageId");
77
 
79
 
78
-    /**
79
-     * 根据id删除对象
80
-     * @param id  实体ID
81
-     */
82
-    @RequestMapping(value="/taMetaImageTag/{id}", method= RequestMethod.DELETE)
83
-    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taMetaImageTagDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaMetaImageTagService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
89
-        }
90
-    }
80
+            TaMetaImageTag taMetaImageTag = new TaMetaImageTag();
81
+            taMetaImageTag.setImageId(imageId);
82
+            taMetaImageTag.setTagId(tagId);
83
+            taMetaImageTags.add(taMetaImageTag);
91
 
84
 
92
-    /**
93
-     * 修改对象
94
-     * @param id  实体ID
95
-     * @param taMetaImageTag 实体对象
96
-     * @return
97
-     */
98
-    @RequestMapping(value="/taMetaImageTag/{id}",method= RequestMethod.PUT)
99
-    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taMetaImageTagUpdate(@ApiParam("对象ID") @PathVariable Integer id,
101
-                                        @ApiParam("更新内容") @RequestBody TaMetaImageTag taMetaImageTag) throws Exception{
102
-
103
-        if (iTaMetaImageTagService.updateById(taMetaImageTag)){
104
-            return ResponseBean.success(iTaMetaImageTagService.getById(id));
105
-        }else {
106
-            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
85
+            if (!tagIds.contains(tagId)) {
86
+                tagIds.add(tagId);
87
+            }
107
         }
88
         }
108
-    }
109
 
89
 
110
-    /**
111
-     * 根据id查询对象
112
-     * @param id  实体ID
113
-     */
114
-    @RequestMapping(value="/taMetaImageTag/{id}",method= RequestMethod.GET)
115
-    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taMetaImageTagGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
117
-        return ResponseBean.success(iTaMetaImageTagService.getById(id));
90
+        // 先清除所有数据
91
+        iTaMetaImageTagService.removeAllBy(tagIds);
92
+
93
+        // 再保存所有
94
+        iTaMetaImageTagService.saveBatch(taMetaImageTags);
95
+
96
+        return ResponseBean.success("ok");
118
     }
97
     }
98
+
99
+//    /**
100
+//     * 根据id删除对象
101
+//     * @param id  实体ID
102
+//     */
103
+//    @RequestMapping(value="/taMetaImageTag/{id}", method= RequestMethod.DELETE)
104
+//    @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
105
+//    public ResponseBean taMetaImageTagDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
106
+//        if(iTaMetaImageTagService.removeById(id)){
107
+//            return ResponseBean.success("success");
108
+//        }else {
109
+//            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
110
+//        }
111
+//    }
112
+//
113
+//    /**
114
+//     * 修改对象
115
+//     * @param id  实体ID
116
+//     * @param taMetaImageTag 实体对象
117
+//     * @return
118
+//     */
119
+//    @RequestMapping(value="/taMetaImageTag/{id}",method= RequestMethod.PUT)
120
+//    @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
121
+//    public ResponseBean taMetaImageTagUpdate(@ApiParam("对象ID") @PathVariable Integer id,
122
+//                                        @ApiParam("更新内容") @RequestBody TaMetaImageTag taMetaImageTag) throws Exception{
123
+//
124
+//        if (iTaMetaImageTagService.updateById(taMetaImageTag)){
125
+//            return ResponseBean.success(iTaMetaImageTagService.getById(id));
126
+//        }else {
127
+//            return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
128
+//        }
129
+//    }
130
+//
131
+//    /**
132
+//     * 根据id查询对象
133
+//     * @param id  实体ID
134
+//     */
135
+//    @RequestMapping(value="/taMetaImageTag/{id}",method= RequestMethod.GET)
136
+//    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
137
+//    public ResponseBean taMetaImageTagGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
138
+//        return ResponseBean.success(iTaMetaImageTagService.getById(id));
139
+//    }
119
 }
140
 }

+ 1
- 1
src/main/java/com/shigongli/entity/TaMateTag.java View File

27
     private static final long serialVersionUID = 1L;
27
     private static final long serialVersionUID = 1L;
28
 
28
 
29
     @ApiModelProperty(value = "ID")
29
     @ApiModelProperty(value = "ID")
30
-    @TableId(value = "tag_id", type = IdType.INPUT)
30
+    @TableId(value = "tag_id", type = IdType.UUID)
31
     private String tagId;
31
     private String tagId;
32
 
32
 
33
     @ApiModelProperty(value = "标签")
33
     @ApiModelProperty(value = "标签")

+ 1
- 1
src/main/java/com/shigongli/entity/TaMetaImage.java View File

27
     private static final long serialVersionUID = 1L;
27
     private static final long serialVersionUID = 1L;
28
 
28
 
29
     @ApiModelProperty(value = "图片id")
29
     @ApiModelProperty(value = "图片id")
30
-    @TableId(value = "image_id", type = IdType.INPUT)
30
+    @TableId(value = "image_id", type = IdType.UUID)
31
     private String imageId;
31
     private String imageId;
32
 
32
 
33
     @ApiModelProperty(value = "图片地址")
33
     @ApiModelProperty(value = "图片地址")

+ 2
- 0
src/main/java/com/shigongli/entity/TaMetaImageTag.java View File

35
     @ApiModelProperty(value = "标签ID")
35
     @ApiModelProperty(value = "标签ID")
36
     private String tagId;
36
     private String tagId;
37
 
37
 
38
+    private String tagName;
38
 
39
 
40
+    private String image;
39
 }
41
 }

+ 4
- 0
src/main/java/com/shigongli/mapper/TaMetaImageTagMapper.java View File

3
 import com.shigongli.entity.TaMetaImageTag;
3
 import com.shigongli.entity.TaMetaImageTag;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
6
 
9
 
7
 /**
10
 /**
8
  * <p>
11
  * <p>
15
 @Mapper
18
 @Mapper
16
 public interface TaMetaImageTagMapper extends BaseMapper<TaMetaImageTag> {
19
 public interface TaMetaImageTagMapper extends BaseMapper<TaMetaImageTag> {
17
 
20
 
21
+    int removeAllBy(@Param("tagIds") List<String> tagIds);
18
 }
22
 }

+ 6
- 0
src/main/java/com/shigongli/service/ITaMetaImageTagService.java View File

1
 package com.shigongli.service;
1
 package com.shigongli.service;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.shigongli.entity.TaMetaImageTag;
4
 import com.shigongli.entity.TaMetaImageTag;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.baomidou.mybatisplus.extension.service.IService;
5
 
6
 
7
+import java.util.List;
8
+
6
 /**
9
 /**
7
  * <p>
10
  * <p>
8
  * 图片标签 服务类
11
  * 图片标签 服务类
13
  */
16
  */
14
 public interface ITaMetaImageTagService extends IService<TaMetaImageTag> {
17
 public interface ITaMetaImageTagService extends IService<TaMetaImageTag> {
15
 
18
 
19
+    void removeAllBy(List<String> tagIds);
20
+
21
+    IPage<TaMetaImageTag> pagedBy(IPage<TaMetaImageTag> pg, String tagId);
16
 }
22
 }

+ 20
- 0
src/main/java/com/shigongli/service/impl/TaMetaImageTagServiceImpl.java View File

1
 package com.shigongli.service.impl;
1
 package com.shigongli.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.shigongli.entity.TaMetaImageTag;
4
 import com.shigongli.entity.TaMetaImageTag;
4
 import com.shigongli.mapper.TaMetaImageTagMapper;
5
 import com.shigongli.mapper.TaMetaImageTagMapper;
5
 import com.shigongli.service.ITaMetaImageTagService;
6
 import com.shigongli.service.ITaMetaImageTagService;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
9
 import org.springframework.stereotype.Service;
8
 
10
 
11
+import java.util.List;
12
+
9
 /**
13
 /**
10
  * <p>
14
  * <p>
11
  * 图片标签 服务实现类
15
  * 图片标签 服务实现类
17
 @Service
21
 @Service
18
 public class TaMetaImageTagServiceImpl extends ServiceImpl<TaMetaImageTagMapper, TaMetaImageTag> implements ITaMetaImageTagService {
22
 public class TaMetaImageTagServiceImpl extends ServiceImpl<TaMetaImageTagMapper, TaMetaImageTag> implements ITaMetaImageTagService {
19
 
23
 
24
+    @Autowired
25
+    TaMetaImageTagMapper taMetaImageTagMapper;
26
+
27
+    @Override
28
+    public void removeAllBy(List<String> tagIds) {
29
+        if (tagIds == null || tagIds.size() < 1) {
30
+            return;
31
+        }
32
+
33
+        taMetaImageTagMapper.removeAllBy(tagIds);
34
+    }
35
+
36
+    @Override
37
+    public IPage<TaMetaImageTag> pagedBy(IPage<TaMetaImageTag> pg, String tagId) {
38
+        return null;
39
+    }
20
 }
40
 }

+ 7
- 0
src/main/resources/mapper/TaMetaImageTagMapper.xml View File

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.shigongli.mapper.TaMetaImageTagMapper">
3
 <mapper namespace="com.shigongli.mapper.TaMetaImageTagMapper">
4
 
4
 
5
+    <delete id="removeAllBy">
6
+        delete from ta_meta_image_tag
7
+        where tag_id in	WHERE id IN
8
+        <foreach collection="tagIds" item="id" index="index" open="(" close=")" separator=",">
9
+            #{id}
10
+        </foreach>
11
+    </delete>
5
 </mapper>
12
 </mapper>