张延森 4 anos atrás
pai
commit
b0c2006db8

+ 6
- 1
pom.xml Ver arquivo

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.shigongli</groupId>
12 12
 	<artifactId>shigongli</artifactId>
13
-	<version>0.0.1</version>
13
+	<version>0.0.3</version>
14 14
 	<name>shigongli</name>
15 15
 	<description>ShiGongli Service</description>
16 16
 
@@ -36,6 +36,11 @@
36 36
 			</exclusions>
37 37
 		</dependency>
38 38
 
39
+		<dependency>
40
+			<groupId>org.springframework.boot</groupId>
41
+			<artifactId>spring-boot-starter-aop</artifactId>
42
+		</dependency>
43
+
39 44
 		<!--mysql start-->
40 45
 		<dependency>
41 46
 			<groupId>mysql</groupId>

+ 12
- 0
src/main/java/com/shigongli/annotations/ParamNotEmpty.java Ver arquivo

@@ -0,0 +1,12 @@
1
+package com.shigongli.annotations;
2
+
3
+import java.lang.annotation.ElementType;
4
+import java.lang.annotation.Retention;
5
+import java.lang.annotation.RetentionPolicy;
6
+import java.lang.annotation.Target;
7
+
8
+@Target(ElementType.FIELD)
9
+@Retention(RetentionPolicy.RUNTIME)
10
+public @interface ParamNotEmpty {
11
+    String name();
12
+}

+ 6
- 0
src/main/java/com/shigongli/config/BaseConfig.java Ver arquivo

@@ -1,5 +1,6 @@
1 1
 package com.shigongli.config;
2 2
 
3
+import com.shigongli.interceptor.ParamNotEmptyInterceptor;
3 4
 import com.shigongli.interceptor.PermissionInterceptor;
4 5
 import lombok.Data;
5 6
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +17,9 @@ public class BaseConfig implements WebMvcConfigurer {
16 17
     @Autowired
17 18
     private PermissionInterceptor permissionInterceptor;
18 19
 
20
+    @Autowired
21
+    private ParamNotEmptyInterceptor paramNotEmptyInterceptor;
22
+
19 23
     @Autowired
20 24
     private InterceptorConfig interceptorConfig;
21 25
 
@@ -31,5 +35,7 @@ public class BaseConfig implements WebMvcConfigurer {
31 35
                     .addPathPatterns(interceptorConfig.getPermission().getIncludePaths())
32 36
                     .excludePathPatterns(interceptorConfig.getPermission().getExcludePaths());
33 37
         }
38
+
39
+//        registry.addInterceptor(paramNotEmptyInterceptor).addPathPatterns("/**");
34 40
     }
35 41
 }

+ 9
- 1
src/main/java/com/shigongli/controller/TaHouseController.java Ver arquivo

@@ -9,8 +9,10 @@ import com.shigongli.common.ScreenShotUtil;
9 9
 import com.shigongli.common.StringUtils;
10 10
 import com.shigongli.constants.StatusConstant;
11 11
 import com.shigongli.entity.TaPerson;
12
+import com.shigongli.entity.TaShop;
12 13
 import com.shigongli.entity.TaShopKeeper;
13 14
 import com.shigongli.service.ITaShopKeeperService;
15
+import com.shigongli.service.ITaShopService;
14 16
 import io.swagger.annotations.Api;
15 17
 import io.swagger.annotations.ApiOperation;
16 18
 import io.swagger.annotations.ApiParam;
@@ -52,6 +54,9 @@ public class TaHouseController extends BaseController {
52 54
     @Autowired
53 55
     ITaShopKeeperService iTaShopKeeperService;
54 56
 
57
+    @Autowired
58
+    ITaShopService iTaShopService;
59
+
55 60
     @Autowired
56 61
     ScreenShotUtil screenShotUtil;
57 62
 
@@ -185,7 +190,10 @@ public class TaHouseController extends BaseController {
185 190
     @RequestMapping(value="/ma/taHouse/{id}",method= RequestMethod.GET)
186 191
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
187 192
     public ResponseBean houseDetail(@ApiParam("房源ID") @PathVariable String id) throws Exception{
188
-        return ResponseBean.success(iTaHouseService.getById(id));
193
+        TaHouse taHouse = iTaHouseService.getById(id);
194
+        TaShop taShop = iTaShopService.getById(taHouse.getShopId());
195
+        taHouse.setTaShop(taShop);
196
+        return ResponseBean.success(taHouse);
189 197
     }
190 198
 
191 199
     @GetMapping("/ma/taHouse/{id}/share")

+ 8
- 0
src/main/java/com/shigongli/controller/TaMateTagController.java Ver arquivo

@@ -73,6 +73,14 @@ public class TaMateTagController extends BaseController {
73 73
     @RequestMapping(value="/mp/taMateTag",method= RequestMethod.POST)
74 74
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
75 75
     public ResponseBean taMateTagAdd(@ApiParam("保存内容") @RequestBody TaMateTag taMateTag) throws Exception{
76
+        if (StringUtils.isEmpty(taMateTag.getName())) {
77
+            return ResponseBean.error("名称不能为空", ResponseBean.ERROR_MISSING_PARAMS);
78
+        }
79
+
80
+        TaMateTag origin = iTaMateTagService.getByName(taMateTag.getName());
81
+        if (null != origin) {
82
+            return ResponseBean.error("名称重复", ResponseBean.ERROR_MISSING_PARAMS);
83
+        }
76 84
 
77 85
         if (iTaMateTagService.save(taMateTag)){
78 86
             return ResponseBean.success(taMateTag);

+ 19
- 0
src/main/java/com/shigongli/controller/TaMateTagGroupController.java Ver arquivo

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.shigongli.common.BaseController;
7 7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.common.StringUtils;
8 9
 import com.shigongli.constants.StatusConstant;
9 10
 import com.shigongli.entity.TaMateTag;
10 11
 import com.shigongli.service.ITaMateTagService;
@@ -87,6 +88,15 @@ public class TaMateTagGroupController extends BaseController {
87 88
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
88 89
     public ResponseBean taMateTagGroupAdd(@ApiParam("保存内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
89 90
 
91
+        if (StringUtils.isEmpty(taMateTagGroup.getName())) {
92
+            return ResponseBean.error("名称不能为空", ResponseBean.ERROR_MISSING_PARAMS);
93
+        }
94
+
95
+        TaMateTagGroup origin = iTaMateTagGroupService.getByName(taMateTagGroup.getName());
96
+        if (null != origin) {
97
+            return ResponseBean.error("名称重复", ResponseBean.ERROR_MISSING_PARAMS);
98
+        }
99
+
90 100
         if (iTaMateTagGroupService.save(taMateTagGroup)){
91 101
             return ResponseBean.success(taMateTagGroup);
92 102
         }else {
@@ -121,6 +131,15 @@ public class TaMateTagGroupController extends BaseController {
121 131
     public ResponseBean taMateTagGroupUpdate(@ApiParam("对象ID") @PathVariable String id,
122 132
                                         @ApiParam("更新内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
123 133
 
134
+        if (StringUtils.isEmpty(taMateTagGroup.getName())) {
135
+            return ResponseBean.error("名称不能为空", ResponseBean.ERROR_MISSING_PARAMS);
136
+        }
137
+
138
+        TaMateTagGroup origin = iTaMateTagGroupService.getByName(taMateTagGroup.getName());
139
+        if (null != origin && !id.equals(origin.getGroupId())) {
140
+            return ResponseBean.error("名称重复", ResponseBean.ERROR_MISSING_PARAMS);
141
+        }
142
+
124 143
         if (iTaMateTagGroupService.updateById(taMateTagGroup)){
125 144
             return ResponseBean.success(iTaMateTagGroupService.getById(id));
126 145
         }else {

+ 18
- 0
src/main/java/com/shigongli/controller/TaShopController.java Ver arquivo

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.shigongli.common.BaseController;
7 7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.common.StringUtils;
8 9
 import com.shigongli.constants.StatusConstant;
9 10
 import io.swagger.annotations.Api;
10 11
 import io.swagger.annotations.ApiOperation;
@@ -70,6 +71,15 @@ public class TaShopController extends BaseController {
70 71
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
71 72
     public ResponseBean taShopAdd(@ApiParam("保存内容") @RequestBody TaShop taShop) throws Exception{
72 73
 
74
+        if (StringUtils.isEmpty(taShop.getName())) {
75
+            return ResponseBean.error("名称不能为空", ResponseBean.ERROR_MISSING_PARAMS);
76
+        }
77
+
78
+        TaShop origin = iTaShopService.getByName(taShop.getName());
79
+        if (null != origin) {
80
+            return ResponseBean.error("名称重复", ResponseBean.ERROR_MISSING_PARAMS);
81
+        }
82
+
73 83
         if (iTaShopService.save(taShop)){
74 84
             return ResponseBean.success(taShop);
75 85
         }else {
@@ -104,6 +114,14 @@ public class TaShopController extends BaseController {
104 114
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
105 115
     public ResponseBean taShopUpdate(@ApiParam("对象ID") @PathVariable String id,
106 116
                                         @ApiParam("更新内容") @RequestBody TaShop taShop) throws Exception{
117
+        if (StringUtils.isEmpty(taShop.getName())) {
118
+            return ResponseBean.error("名称不能为空", ResponseBean.ERROR_MISSING_PARAMS);
119
+        }
120
+
121
+        TaShop origin = iTaShopService.getByName(taShop.getName());
122
+        if (null != origin && !origin.getShopId().equals(id)) {
123
+            return ResponseBean.error("名称重复", ResponseBean.ERROR_MISSING_PARAMS);
124
+        }
107 125
 
108 126
         if (iTaShopService.updateById(taShop)){
109 127
             return ResponseBean.success(iTaShopService.getById(id));

+ 31
- 0
src/main/java/com/shigongli/controller/TaShopKeeperController.java Ver arquivo

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.shigongli.common.BaseController;
7 7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.common.StringUtils;
8 9
 import com.shigongli.constants.StatusConstant;
9 10
 import com.shigongli.entity.TaPerson;
10 11
 import com.shigongli.service.ITaPersonService;
@@ -77,6 +78,21 @@ public class TaShopKeeperController extends BaseController {
77 78
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
78 79
     public ResponseBean taShopKeeperAdd(@ApiParam("保存内容") @RequestBody TaShopKeeper taShopKeeper) throws Exception{
79 80
 
81
+        if (StringUtils.isEmpty(taShopKeeper.getName())) {
82
+            return ResponseBean.error("姓名不能为空", ResponseBean.ERROR_MISSING_PARAMS);
83
+        }
84
+        if (StringUtils.isEmpty(taShopKeeper.getPhone())) {
85
+            return ResponseBean.error("电话不能为空", ResponseBean.ERROR_MISSING_PARAMS);
86
+        }
87
+        if (StringUtils.isEmpty(taShopKeeper.getShopId())) {
88
+            return ResponseBean.error("没有指定所属民宿", ResponseBean.ERROR_MISSING_PARAMS);
89
+        }
90
+
91
+        TaShopKeeper origin = iTaShopKeeperService.getByPhone(taShopKeeper.getPhone(), taShopKeeper.getShopId());
92
+        if (null != origin) {
93
+            return ResponseBean.error("电话号码重复", ResponseBean.ERROR_MISSING_PARAMS);
94
+        }
95
+
80 96
         TaPerson taPerson = iTaPersonService.getByPhone(taShopKeeper.getPhone());
81 97
         if (null != taPerson) {
82 98
             taShopKeeper.setPersonId(taPerson.getPersonId());
@@ -121,6 +137,21 @@ public class TaShopKeeperController extends BaseController {
121 137
             taShopKeeper.setPersonId(taPerson.getPersonId());
122 138
         }
123 139
 
140
+        if (StringUtils.isEmpty(taShopKeeper.getName())) {
141
+            return ResponseBean.error("姓名不能为空", ResponseBean.ERROR_MISSING_PARAMS);
142
+        }
143
+        if (StringUtils.isEmpty(taShopKeeper.getPhone())) {
144
+            return ResponseBean.error("电话不能为空", ResponseBean.ERROR_MISSING_PARAMS);
145
+        }
146
+        if (StringUtils.isEmpty(taShopKeeper.getShopId())) {
147
+            return ResponseBean.error("没有指定所属民宿", ResponseBean.ERROR_MISSING_PARAMS);
148
+        }
149
+
150
+        TaShopKeeper origin = iTaShopKeeperService.getByPhone(taShopKeeper.getPhone(), taShopKeeper.getShopId());
151
+        if (null != origin && !id.equals(origin.getKeeperId())) {
152
+            return ResponseBean.error("电话号码重复", ResponseBean.ERROR_MISSING_PARAMS);
153
+        }
154
+
124 155
         if (iTaShopKeeperService.updateById(taShopKeeper)){
125 156
             return ResponseBean.success(iTaShopKeeperService.getById(id));
126 157
         }else {

+ 3
- 0
src/main/java/com/shigongli/entity/TaHouse.java Ver arquivo

@@ -79,4 +79,7 @@ public class TaHouse implements Serializable {
79 79
 
80 80
     @TableField(exist = false)
81 81
     private List<TaHouseSurround> surroundList;
82
+
83
+    @TableField(exist = false)
84
+    private TaShop taShop;
82 85
 }

+ 5
- 0
src/main/java/com/shigongli/entity/TaShop.java Ver arquivo

@@ -2,8 +2,12 @@ package com.shigongli.entity;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4 4
 import java.time.LocalDateTime;
5
+
6
+import com.baomidou.mybatisplus.annotation.TableField;
5 7
 import com.baomidou.mybatisplus.annotation.TableId;
6 8
 import java.io.Serializable;
9
+
10
+import com.shigongli.annotations.ParamNotEmpty;
7 11
 import io.swagger.annotations.ApiModel;
8 12
 import io.swagger.annotations.ApiModelProperty;
9 13
 import lombok.Data;
@@ -31,6 +35,7 @@ public class TaShop implements Serializable {
31 35
     private String shopId;
32 36
 
33 37
     @ApiModelProperty(value = "店铺名称")
38
+    @TableField("`name`")
34 39
     private String name;
35 40
 
36 41
     @ApiModelProperty(value = "店铺logo")

+ 11
- 0
src/main/java/com/shigongli/interceptor/ParamNotEmptyAspect.java Ver arquivo

@@ -0,0 +1,11 @@
1
+package com.shigongli.interceptor;
2
+
3
+import lombok.extern.slf4j.Slf4j;
4
+import org.aspectj.lang.annotation.Aspect;
5
+import org.springframework.stereotype.Component;
6
+
7
+@Slf4j
8
+@Aspect
9
+@Component
10
+public class ParamNotEmptyAspect {
11
+}

+ 96
- 0
src/main/java/com/shigongli/interceptor/ParamNotEmptyInterceptor.java Ver arquivo

@@ -0,0 +1,96 @@
1
+package com.shigongli.interceptor;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.shigongli.annotations.ParamNotEmpty;
5
+import com.shigongli.common.ResponseBean;
6
+import com.shigongli.common.StringUtils;
7
+import lombok.extern.slf4j.Slf4j;
8
+import org.springframework.stereotype.Component;
9
+import org.springframework.web.method.HandlerMethod;
10
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
11
+
12
+import javax.servlet.http.HttpServletRequest;
13
+import javax.servlet.http.HttpServletResponse;
14
+import java.lang.reflect.Array;
15
+import java.lang.reflect.Field;
16
+import java.lang.reflect.Parameter;
17
+import java.util.List;
18
+import java.util.Map;
19
+import java.util.Set;
20
+
21
+@Slf4j
22
+@Component
23
+public class ParamNotEmptyInterceptor extends HandlerInterceptorAdapter {
24
+
25
+    @Override
26
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
27
+        if (!(handler instanceof HandlerMethod)) {
28
+            return true;
29
+        }
30
+
31
+        HandlerMethod hm = (HandlerMethod) handler;
32
+
33
+        // 获取控制器方法参数列表
34
+        Parameter[] parameters = hm.getMethod().getParameters();
35
+        if (parameters.length < 1) {
36
+            return true;
37
+        }
38
+
39
+        // 遍历所有参数
40
+        for (Parameter parameter: parameters) {
41
+            if (null == parameter) {
42
+                continue;
43
+            }
44
+
45
+            // 遍历所有参数字段
46
+            Field[] declaredFields = parameter.getClass().getDeclaredFields();
47
+            if (declaredFields.length < 1) {
48
+                continue;
49
+            }
50
+
51
+            for (Field field : declaredFields) {
52
+                // 查找带有 ParamNotNull 注解的字段
53
+                ParamNotEmpty annotation = field.getAnnotation(ParamNotEmpty.class);
54
+                if (null == annotation) {
55
+                    continue;
56
+                }
57
+
58
+                boolean isEmpty = false;
59
+                Object val = field.get(parameter);
60
+                if (null == val) {
61
+                    isEmpty = true;
62
+                } else if (field.getType().equals(String.class)) {
63
+                    // 字符串
64
+                    isEmpty = StringUtils.isEmpty(val.toString());
65
+                } else if (null != field.getType().getComponentType()) {
66
+                    // 数组
67
+                    isEmpty = Array.getLength(val) < 1;
68
+                } else if (isCollection(field.getType())) {
69
+                    // 集合
70
+                    int size = (int) field.getType().getDeclaredMethod("size", int.class).invoke(val);
71
+                    isEmpty = size < 1;
72
+                } else {
73
+                    // others
74
+                }
75
+
76
+                if (isEmpty) {
77
+                    String errMessage = annotation.name() + " 不能为空";
78
+                    response.addHeader("Content-type", "application/json");
79
+                    response.getOutputStream().write(
80
+                            JSONObject.toJSONBytes(
81
+                                    ResponseBean.error(errMessage, ResponseBean.ERROR_MISSING_PARAMS)
82
+                            ));
83
+                    return false;
84
+                }
85
+            }
86
+        }
87
+
88
+        return true;
89
+    }
90
+
91
+    private boolean isCollection(Class cla) {
92
+        return cla.equals(List.class)
93
+                || cla.equals(Map.class)
94
+                || cla.equals(Set.class);
95
+    }
96
+}

+ 1
- 0
src/main/java/com/shigongli/service/ITaMateTagGroupService.java Ver arquivo

@@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 13
  */
14 14
 public interface ITaMateTagGroupService extends IService<TaMateTagGroup> {
15 15
 
16
+    TaMateTagGroup getByName(String name);
16 17
 }

+ 2
- 0
src/main/java/com/shigongli/service/ITaMateTagService.java Ver arquivo

@@ -16,4 +16,6 @@ import java.util.List;
16 16
 public interface ITaMateTagService extends IService<TaMateTag> {
17 17
 
18 18
     List<TaMateTag> getByGroup(String groupId);
19
+
20
+    TaMateTag getByName(String name);
19 21
 }

+ 2
- 0
src/main/java/com/shigongli/service/ITaShopKeeperService.java Ver arquivo

@@ -21,4 +21,6 @@ public interface ITaShopKeeperService extends IService<TaShopKeeper> {
21 21
     List<TaShopKeeper> getByPhone(String phone);
22 22
 
23 23
     List<TaShopKeeper> getByPerson(String personId);
24
+
25
+    TaShopKeeper getByPhone(String phone, String shopId);
24 26
 }

+ 1
- 0
src/main/java/com/shigongli/service/ITaShopService.java Ver arquivo

@@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 13
  */
14 14
 public interface ITaShopService extends IService<TaShop> {
15 15
 
16
+    TaShop getByName(String name);
16 17
 }

+ 11
- 0
src/main/java/com/shigongli/service/impl/TaMateTagGroupServiceImpl.java Ver arquivo

@@ -1,5 +1,7 @@
1 1
 package com.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.shigongli.constants.StatusConstant;
3 5
 import com.shigongli.entity.TaMateTagGroup;
4 6
 import com.shigongli.mapper.TaMateTagGroupMapper;
5 7
 import com.shigongli.service.ITaMateTagGroupService;
@@ -17,4 +19,13 @@ import org.springframework.stereotype.Service;
17 19
 @Service
18 20
 public class TaMateTagGroupServiceImpl extends ServiceImpl<TaMateTagGroupMapper, TaMateTagGroup> implements ITaMateTagGroupService {
19 21
 
22
+    @Override
23
+    public TaMateTagGroup getByName(String name) {
24
+        QueryWrapper<TaMateTagGroup> queryWrapper = new QueryWrapper<TaMateTagGroup>()
25
+                .eq("name", name)
26
+                .gt("status", StatusConstant.DELETE)
27
+                .last("limit 1");
28
+
29
+        return getOne(queryWrapper);
30
+    }
20 31
 }

+ 10
- 0
src/main/java/com/shigongli/service/impl/TaMateTagServiceImpl.java Ver arquivo

@@ -29,4 +29,14 @@ public class TaMateTagServiceImpl extends ServiceImpl<TaMateTagMapper, TaMateTag
29 29
                 .orderByDesc("create_date");
30 30
         return list(queryWrapper);
31 31
     }
32
+
33
+    @Override
34
+    public TaMateTag getByName(String name) {
35
+        QueryWrapper<TaMateTag> queryWrapper = new QueryWrapper<TaMateTag>()
36
+                .eq("name", name)
37
+                .gt("status", StatusConstant.DELETE)
38
+                .last("limit 1");
39
+
40
+        return getOne(queryWrapper);
41
+    }
32 42
 }

+ 11
- 0
src/main/java/com/shigongli/service/impl/TaShopKeeperServiceImpl.java Ver arquivo

@@ -71,4 +71,15 @@ public class TaShopKeeperServiceImpl extends ServiceImpl<TaShopKeeperMapper, TaS
71 71
 
72 72
         return list;
73 73
     }
74
+
75
+    @Override
76
+    public TaShopKeeper getByPhone(String phone, String shopId) {
77
+        QueryWrapper<TaShopKeeper> queryWrapper = new QueryWrapper<TaShopKeeper>()
78
+                .eq("shop_id", shopId)
79
+                .eq("phone", phone)
80
+                .gt("status", StatusConstant.DELETE)
81
+                .last("limit 1");
82
+
83
+        return getOne(queryWrapper);
84
+    }
74 85
 }

+ 11
- 0
src/main/java/com/shigongli/service/impl/TaShopServiceImpl.java Ver arquivo

@@ -1,5 +1,7 @@
1 1
 package com.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.shigongli.constants.StatusConstant;
3 5
 import com.shigongli.entity.TaShop;
4 6
 import com.shigongli.mapper.TaShopMapper;
5 7
 import com.shigongli.service.ITaShopService;
@@ -17,4 +19,13 @@ import org.springframework.stereotype.Service;
17 19
 @Service
18 20
 public class TaShopServiceImpl extends ServiceImpl<TaShopMapper, TaShop> implements ITaShopService {
19 21
 
22
+    @Override
23
+    public TaShop getByName(String name) {
24
+        QueryWrapper<TaShop> queryWrapper = new QueryWrapper<TaShop>()
25
+                .eq("name", name)
26
+                .gt("status", StatusConstant.DELETE)
27
+                .last("limit 1");
28
+
29
+        return getOne(queryWrapper);
30
+    }
20 31
 }