张延森 4 years ago
parent
commit
b0c2006db8

+ 6
- 1
pom.xml View File

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

+ 12
- 0
src/main/java/com/shigongli/annotations/ParamNotEmpty.java View File

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 View File

1
 package com.shigongli.config;
1
 package com.shigongli.config;
2
 
2
 
3
+import com.shigongli.interceptor.ParamNotEmptyInterceptor;
3
 import com.shigongli.interceptor.PermissionInterceptor;
4
 import com.shigongli.interceptor.PermissionInterceptor;
4
 import lombok.Data;
5
 import lombok.Data;
5
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.beans.factory.annotation.Autowired;
16
     @Autowired
17
     @Autowired
17
     private PermissionInterceptor permissionInterceptor;
18
     private PermissionInterceptor permissionInterceptor;
18
 
19
 
20
+    @Autowired
21
+    private ParamNotEmptyInterceptor paramNotEmptyInterceptor;
22
+
19
     @Autowired
23
     @Autowired
20
     private InterceptorConfig interceptorConfig;
24
     private InterceptorConfig interceptorConfig;
21
 
25
 
31
                     .addPathPatterns(interceptorConfig.getPermission().getIncludePaths())
35
                     .addPathPatterns(interceptorConfig.getPermission().getIncludePaths())
32
                     .excludePathPatterns(interceptorConfig.getPermission().getExcludePaths());
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 View File

9
 import com.shigongli.common.StringUtils;
9
 import com.shigongli.common.StringUtils;
10
 import com.shigongli.constants.StatusConstant;
10
 import com.shigongli.constants.StatusConstant;
11
 import com.shigongli.entity.TaPerson;
11
 import com.shigongli.entity.TaPerson;
12
+import com.shigongli.entity.TaShop;
12
 import com.shigongli.entity.TaShopKeeper;
13
 import com.shigongli.entity.TaShopKeeper;
13
 import com.shigongli.service.ITaShopKeeperService;
14
 import com.shigongli.service.ITaShopKeeperService;
15
+import com.shigongli.service.ITaShopService;
14
 import io.swagger.annotations.Api;
16
 import io.swagger.annotations.Api;
15
 import io.swagger.annotations.ApiOperation;
17
 import io.swagger.annotations.ApiOperation;
16
 import io.swagger.annotations.ApiParam;
18
 import io.swagger.annotations.ApiParam;
52
     @Autowired
54
     @Autowired
53
     ITaShopKeeperService iTaShopKeeperService;
55
     ITaShopKeeperService iTaShopKeeperService;
54
 
56
 
57
+    @Autowired
58
+    ITaShopService iTaShopService;
59
+
55
     @Autowired
60
     @Autowired
56
     ScreenShotUtil screenShotUtil;
61
     ScreenShotUtil screenShotUtil;
57
 
62
 
185
     @RequestMapping(value="/ma/taHouse/{id}",method= RequestMethod.GET)
190
     @RequestMapping(value="/ma/taHouse/{id}",method= RequestMethod.GET)
186
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
191
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
187
     public ResponseBean houseDetail(@ApiParam("房源ID") @PathVariable String id) throws Exception{
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
     @GetMapping("/ma/taHouse/{id}/share")
199
     @GetMapping("/ma/taHouse/{id}/share")

+ 8
- 0
src/main/java/com/shigongli/controller/TaMateTagController.java View File

73
     @RequestMapping(value="/mp/taMateTag",method= RequestMethod.POST)
73
     @RequestMapping(value="/mp/taMateTag",method= RequestMethod.POST)
74
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
74
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
75
     public ResponseBean taMateTagAdd(@ApiParam("保存内容") @RequestBody TaMateTag taMateTag) throws Exception{
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
         if (iTaMateTagService.save(taMateTag)){
85
         if (iTaMateTagService.save(taMateTag)){
78
             return ResponseBean.success(taMateTag);
86
             return ResponseBean.success(taMateTag);

+ 19
- 0
src/main/java/com/shigongli/controller/TaMateTagGroupController.java View File

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.ResponseBean;
7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.common.StringUtils;
8
 import com.shigongli.constants.StatusConstant;
9
 import com.shigongli.constants.StatusConstant;
9
 import com.shigongli.entity.TaMateTag;
10
 import com.shigongli.entity.TaMateTag;
10
 import com.shigongli.service.ITaMateTagService;
11
 import com.shigongli.service.ITaMateTagService;
87
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
88
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
88
     public ResponseBean taMateTagGroupAdd(@ApiParam("保存内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
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
         if (iTaMateTagGroupService.save(taMateTagGroup)){
100
         if (iTaMateTagGroupService.save(taMateTagGroup)){
91
             return ResponseBean.success(taMateTagGroup);
101
             return ResponseBean.success(taMateTagGroup);
92
         }else {
102
         }else {
121
     public ResponseBean taMateTagGroupUpdate(@ApiParam("对象ID") @PathVariable String id,
131
     public ResponseBean taMateTagGroupUpdate(@ApiParam("对象ID") @PathVariable String id,
122
                                         @ApiParam("更新内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
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
         if (iTaMateTagGroupService.updateById(taMateTagGroup)){
143
         if (iTaMateTagGroupService.updateById(taMateTagGroup)){
125
             return ResponseBean.success(iTaMateTagGroupService.getById(id));
144
             return ResponseBean.success(iTaMateTagGroupService.getById(id));
126
         }else {
145
         }else {

+ 18
- 0
src/main/java/com/shigongli/controller/TaShopController.java View File

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.ResponseBean;
7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.common.StringUtils;
8
 import com.shigongli.constants.StatusConstant;
9
 import com.shigongli.constants.StatusConstant;
9
 import io.swagger.annotations.Api;
10
 import io.swagger.annotations.Api;
10
 import io.swagger.annotations.ApiOperation;
11
 import io.swagger.annotations.ApiOperation;
70
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
71
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
71
     public ResponseBean taShopAdd(@ApiParam("保存内容") @RequestBody TaShop taShop) throws Exception{
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
         if (iTaShopService.save(taShop)){
83
         if (iTaShopService.save(taShop)){
74
             return ResponseBean.success(taShop);
84
             return ResponseBean.success(taShop);
75
         }else {
85
         }else {
104
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
114
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
105
     public ResponseBean taShopUpdate(@ApiParam("对象ID") @PathVariable String id,
115
     public ResponseBean taShopUpdate(@ApiParam("对象ID") @PathVariable String id,
106
                                         @ApiParam("更新内容") @RequestBody TaShop taShop) throws Exception{
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
         if (iTaShopService.updateById(taShop)){
126
         if (iTaShopService.updateById(taShop)){
109
             return ResponseBean.success(iTaShopService.getById(id));
127
             return ResponseBean.success(iTaShopService.getById(id));

+ 31
- 0
src/main/java/com/shigongli/controller/TaShopKeeperController.java View File

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.ResponseBean;
7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.common.StringUtils;
8
 import com.shigongli.constants.StatusConstant;
9
 import com.shigongli.constants.StatusConstant;
9
 import com.shigongli.entity.TaPerson;
10
 import com.shigongli.entity.TaPerson;
10
 import com.shigongli.service.ITaPersonService;
11
 import com.shigongli.service.ITaPersonService;
77
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
78
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
78
     public ResponseBean taShopKeeperAdd(@ApiParam("保存内容") @RequestBody TaShopKeeper taShopKeeper) throws Exception{
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
         TaPerson taPerson = iTaPersonService.getByPhone(taShopKeeper.getPhone());
96
         TaPerson taPerson = iTaPersonService.getByPhone(taShopKeeper.getPhone());
81
         if (null != taPerson) {
97
         if (null != taPerson) {
82
             taShopKeeper.setPersonId(taPerson.getPersonId());
98
             taShopKeeper.setPersonId(taPerson.getPersonId());
121
             taShopKeeper.setPersonId(taPerson.getPersonId());
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
         if (iTaShopKeeperService.updateById(taShopKeeper)){
155
         if (iTaShopKeeperService.updateById(taShopKeeper)){
125
             return ResponseBean.success(iTaShopKeeperService.getById(id));
156
             return ResponseBean.success(iTaShopKeeperService.getById(id));
126
         }else {
157
         }else {

+ 3
- 0
src/main/java/com/shigongli/entity/TaHouse.java View File

79
 
79
 
80
     @TableField(exist = false)
80
     @TableField(exist = false)
81
     private List<TaHouseSurround> surroundList;
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 View File

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

+ 11
- 0
src/main/java/com/shigongli/interceptor/ParamNotEmptyAspect.java View File

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 View File

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 View File

13
  */
13
  */
14
 public interface ITaMateTagGroupService extends IService<TaMateTagGroup> {
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 View File

16
 public interface ITaMateTagService extends IService<TaMateTag> {
16
 public interface ITaMateTagService extends IService<TaMateTag> {
17
 
17
 
18
     List<TaMateTag> getByGroup(String groupId);
18
     List<TaMateTag> getByGroup(String groupId);
19
+
20
+    TaMateTag getByName(String name);
19
 }
21
 }

+ 2
- 0
src/main/java/com/shigongli/service/ITaShopKeeperService.java View File

21
     List<TaShopKeeper> getByPhone(String phone);
21
     List<TaShopKeeper> getByPhone(String phone);
22
 
22
 
23
     List<TaShopKeeper> getByPerson(String personId);
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 View File

13
  */
13
  */
14
 public interface ITaShopService extends IService<TaShop> {
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 View File

1
 package com.shigongli.service.impl;
1
 package com.shigongli.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.shigongli.constants.StatusConstant;
3
 import com.shigongli.entity.TaMateTagGroup;
5
 import com.shigongli.entity.TaMateTagGroup;
4
 import com.shigongli.mapper.TaMateTagGroupMapper;
6
 import com.shigongli.mapper.TaMateTagGroupMapper;
5
 import com.shigongli.service.ITaMateTagGroupService;
7
 import com.shigongli.service.ITaMateTagGroupService;
17
 @Service
19
 @Service
18
 public class TaMateTagGroupServiceImpl extends ServiceImpl<TaMateTagGroupMapper, TaMateTagGroup> implements ITaMateTagGroupService {
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 View File

29
                 .orderByDesc("create_date");
29
                 .orderByDesc("create_date");
30
         return list(queryWrapper);
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 View File

71
 
71
 
72
         return list;
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 View File

1
 package com.shigongli.service.impl;
1
 package com.shigongli.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.shigongli.constants.StatusConstant;
3
 import com.shigongli.entity.TaShop;
5
 import com.shigongli.entity.TaShop;
4
 import com.shigongli.mapper.TaShopMapper;
6
 import com.shigongli.mapper.TaShopMapper;
5
 import com.shigongli.service.ITaShopService;
7
 import com.shigongli.service.ITaShopService;
17
 @Service
19
 @Service
18
 public class TaShopServiceImpl extends ServiceImpl<TaShopMapper, TaShop> implements ITaShopService {
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
 }