Explorar el Código

提交本地记录

weiximei hace 6 años
padre
commit
e701459023
Se han modificado 42 ficheros con 2600 adiciones y 0 borrados
  1. 1
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java
  2. 10
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  3. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class
  4. 38
    0
      CODE/smart-community/operate-api/pom.xml
  5. 2
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/OperateApplication.java
  6. 15
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/ICode.java
  7. 48
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java
  8. 23
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/entity/CodeEntity.java
  9. 11
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/impl/ImgCodeImpl.java
  10. 70
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/impl/PhoneCodeImpl.java
  11. 95
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/BannerController.java
  12. 63
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/CodeController.java
  13. 59
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/UserController.java
  14. 17
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/SysDictionaryMapper.java
  15. 37
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToBannerMapper.java
  16. 19
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysMenuMapper.java
  17. 19
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysRoleMapper.java
  18. 19
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysRoleMenuMapper.java
  19. 19
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysUserRoleMapper.java
  20. 22
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToUserMapper.java
  21. 58
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java
  22. 17
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/exception/WisdomException.java
  23. 53
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/SysDictionary.java
  24. 184
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java
  25. 83
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysMenu.java
  26. 85
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysRole.java
  27. 33
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysRoleMenu.java
  28. 33
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysUserRole.java
  29. 125
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToUser.java
  30. 48
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToBannerService.java
  31. 19
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToUserService.java
  32. 158
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java
  33. 55
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToUserServerImpl.java
  34. 55
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/vo/ToBannerVO.java
  35. 52
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/vo/ToUserVO.java
  36. 93
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/SysDictionaryMapper.xml
  37. 280
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml
  38. 128
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToSysMenuMapper.xml
  39. 128
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToSysRoleMapper.xml
  40. 71
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToSysRoleMenuMapper.xml
  41. 71
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToSysUserRoleMapper.xml
  42. 184
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/ToUserMapper.xml

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java Ver fichero

@@ -53,6 +53,7 @@ public class UserController {
53 53
         if (null != userVO) {
54 54
             UserElement userElement = new UserElement();
55 55
             BeanUtils.copyProperties(userVO,userElement);
56
+            userElement.setLoginType(Constant.APP_LOGIN_TYPE);
56 57
             session.setAttribute(Constant.APP_USER_SESSION,userElement);
57 58
             userVO.setToken(session.getId());
58 59
         }

+ 10
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Ver fichero

@@ -6,6 +6,9 @@ package com.community.commom.constant;
6 6
  */
7 7
 public class Constant {
8 8
 
9
+    /** 系统异常 500 **/
10
+    public static final String REQUEST_ERROR = "500";
11
+
9 12
     /** APP端session **/
10 13
     public static final String APP_USER_SESSION = "appUser";
11 14
 
@@ -74,4 +77,11 @@ public class Constant {
74 77
     
75 78
     /** 工单回复的发起人 **/
76 79
     public static final String TICKET_USER_TYPE = "1";
80
+
81
+    /** banner的类型 外链接 **/
82
+    public static final String BANNER_TYPE_LINK = "1";
83
+
84
+    /** banner的类型 文章 **/
85
+    public static final String BANNER_TYPE_ARTICLE = "2";
86
+
77 87
 }

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class Ver fichero


+ 38
- 0
CODE/smart-community/operate-api/pom.xml Ver fichero

@@ -104,6 +104,44 @@
104 104
 			<artifactId>spring-boot-starter-test</artifactId>
105 105
 			<scope>test</scope>
106 106
 		</dependency>
107
+
108
+
109
+		<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
110
+		<dependency>
111
+			<groupId>org.projectlombok</groupId>
112
+			<artifactId>lombok</artifactId>
113
+			<version>1.18.2</version>
114
+			<scope>provided</scope>
115
+		</dependency>
116
+
117
+		<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
118
+		<dependency>
119
+			<groupId>com.google.guava</groupId>
120
+			<artifactId>guava</artifactId>
121
+			<version>26.0-jre</version>
122
+		</dependency>
123
+
124
+		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
125
+		<dependency>
126
+			<groupId>org.apache.commons</groupId>
127
+			<artifactId>commons-lang3</artifactId>
128
+			<version>3.8.1</version>
129
+		</dependency>
130
+
131
+		<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
132
+		<dependency>
133
+			<groupId>commons-lang</groupId>
134
+			<artifactId>commons-lang</artifactId>
135
+			<version>2.6</version>
136
+		</dependency>
137
+
138
+		<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
139
+		<dependency>
140
+			<groupId>com.squareup.okhttp3</groupId>
141
+			<artifactId>okhttp</artifactId>
142
+			<version>3.11.0</version>
143
+		</dependency>
144
+
107 145
 	</dependencies>
108 146
 
109 147
 	<dependencyManagement>

+ 2
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/OperateApplication.java Ver fichero

@@ -4,10 +4,12 @@ import org.springframework.boot.SpringApplication;
4 4
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5 5
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 6
 import org.springframework.cloud.openfeign.EnableFeignClients;
7
+import org.springframework.transaction.annotation.EnableTransactionManagement;
7 8
 
8 9
 @SpringBootApplication
9 10
 @EnableDiscoveryClient
10 11
 @EnableFeignClients
12
+@EnableTransactionManagement
11 13
 public class OperateApplication {
12 14
 
13 15
 	public static void main(String[] args) {

+ 15
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/ICode.java Ver fichero

@@ -0,0 +1,15 @@
1
+package com.community.huiju.common.code;
2
+
3
+
4
+/**
5
+ * 验证码接口
6
+ * @author weiximei
7
+ */
8
+public interface ICode {
9
+
10
+    /**
11
+     * 验证码
12
+     */
13
+    boolean sendCode(String phone, String code);
14
+
15
+}

+ 48
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java Ver fichero

@@ -0,0 +1,48 @@
1
+package com.community.huiju.common.code.cache;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.google.common.cache.CacheBuilder;
5
+import com.google.common.cache.CacheLoader;
6
+import com.google.common.cache.LoadingCache;
7
+import lombok.extern.slf4j.Slf4j;
8
+
9
+import java.util.concurrent.ExecutionException;
10
+import java.util.concurrent.TimeUnit;
11
+
12
+/**
13
+ * 缓存
14
+ * @author weiximei
15
+ */
16
+@Slf4j
17
+public class AppkeyCache {
18
+
19
+    // .refreshAfterWrite(3, TimeUnit.HOURS)// 给定时间内没有被读/写访问,则回收。
20
+    static LoadingCache<String, Object> cache = CacheBuilder.newBuilder()
21
+            .expireAfterAccess(Constant.CACHE_EXPIRE, TimeUnit.HOURS)// 缓存过期时间和redis缓存时长一样
22
+            .maximumSize(Constant.CACHE_SIZE).// 设置缓存个数
23
+            build(new CacheLoader<String, Object>() {
24
+            @Override
25
+            /** 当本地缓存命没有中时,调用load方法获取结果并将结果缓存 **/
26
+            public String load(String appKey) throws Exception {
27
+                return null;
28
+            }
29
+
30
+    });
31
+
32
+    public static Object getCache(String appKey) {
33
+        Object value = null;
34
+        try {
35
+            value = cache.get(appKey);
36
+        } catch (ExecutionException e) {
37
+            e.printStackTrace();
38
+        }
39
+        return value;
40
+    }
41
+
42
+    public static void setCache(String appKey,Object appValue){
43
+        log.info("缓存的key-value: {}-{}", appKey,appValue);
44
+        cache.put(appKey,appValue);
45
+    }
46
+
47
+
48
+}

+ 23
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/entity/CodeEntity.java Ver fichero

@@ -0,0 +1,23 @@
1
+package com.community.huiju.common.code.entity;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+@Data
8
+@AllArgsConstructor
9
+@NoArgsConstructor
10
+public class CodeEntity {
11
+
12
+   private String code;
13
+
14
+   private String tel;
15
+
16
+    /**
17
+     * 参数 格式 String params = "["xxx"]"
18
+     */
19
+   private String params;
20
+
21
+
22
+
23
+}

+ 11
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/impl/ImgCodeImpl.java Ver fichero

@@ -0,0 +1,11 @@
1
+package com.community.huiju.common.code.impl;
2
+
3
+/**
4
+ * 图片验证码
5
+ * @author weiximei
6
+ */
7
+public class ImgCodeImpl {
8
+
9
+
10
+
11
+}

+ 70
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/common/code/impl/PhoneCodeImpl.java Ver fichero

@@ -0,0 +1,70 @@
1
+package com.community.huiju.common.code.impl;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.huiju.common.code.ICode;
5
+import lombok.extern.slf4j.Slf4j;
6
+import okhttp3.*;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Service;
9
+import org.springframework.web.client.RestTemplate;
10
+
11
+import java.io.IOException;
12
+import java.util.concurrent.TimeUnit;
13
+
14
+/**
15
+ * 手机验证码
16
+ * @author weiximei
17
+ */
18
+@Service("phoneCodeImpl")
19
+@Slf4j
20
+public class PhoneCodeImpl implements ICode {
21
+
22
+    public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
23
+
24
+
25
+    public OkHttpClient getClient() {
26
+        OkHttpClient client  = new OkHttpClient.Builder()
27
+                .connectTimeout(10, TimeUnit.SECONDS)
28
+                .writeTimeout(10,TimeUnit.SECONDS)
29
+                .readTimeout(20, TimeUnit.SECONDS)
30
+                .build();
31
+        return client;
32
+    }
33
+
34
+    @Override
35
+    public boolean sendCode(String phone, String code) {
36
+        boolean bool = false;
37
+
38
+        try {
39
+            String result = null;
40
+            OkHttpClient client = getClient();
41
+            RequestBody body = RequestBody.create(JSON, "{\"code\":\""+Constant.CODE+"\"," + "\"tel\":\""+phone+"\"," + "\"params\":[\""+code+"\"]}");
42
+            Request request = new Request.Builder()
43
+                    .url(Constant.REQUEST_URL)
44
+                    .post(body)
45
+                    .build();
46
+            Response response = client.newCall(request).execute();
47
+            if (response.isSuccessful()) {
48
+                result = response.body().string();
49
+            } else {
50
+                throw new IOException("Unexpected code " + response);
51
+            }
52
+
53
+
54
+
55
+            if ("发送成功".equals(result)) {
56
+                bool = true;
57
+                log.info("手机号 {} 验证码 {} 发送成功!",phone,code);
58
+            }else {
59
+                bool = false;
60
+                log.error("短信发送验证码失败!{}", result);
61
+            }
62
+        } catch (Exception e){
63
+            e.printStackTrace();
64
+            log.error("短信发送错误!",e);
65
+            bool = false;
66
+        }
67
+
68
+        return bool;
69
+    }
70
+}

+ 95
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/BannerController.java Ver fichero

@@ -0,0 +1,95 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.ToBanner;
7
+import com.community.huiju.service.IToBannerService;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.cloud.context.config.annotation.RefreshScope;
14
+import org.springframework.web.bind.annotation.*;
15
+
16
+import javax.servlet.http.HttpSession;
17
+import javax.validation.Valid;
18
+
19
+@RestController
20
+@RefreshScope
21
+@RequestMapping("/")
22
+@Api(value = "Banner 控制器")
23
+public class BannerController {
24
+
25
+    @Autowired
26
+    private IToBannerService iToBannerService;
27
+
28
+    @ApiOperation(value = "添加Banner",notes = "添加Banner")
29
+    @ApiImplicitParams({
30
+            @ApiImplicitParam(paramType = "body",dataType = "ToBanner",name = "banner",value = "bannerTitle(标题)," +
31
+                    "sort(权重),bannerCover(图片),bannerPosition(Banner位),communityId(小区)," +
32
+                    "effTime(生效时间),expTime(失效时间),bannerType(Banner类型),externalLink(Banner的URL)," +
33
+                    "bannerContent(Banner内容)"),
34
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
35
+    })
36
+    @RequestMapping(value = "/banner",method = RequestMethod.POST)
37
+    public ResponseBean addBanner(@RequestBody @Valid ToBanner banner,
38
+                                  HttpSession session){
39
+
40
+        UserElement userElement = (UserElement) session.getAttribute(Constant.WEB_USER_SESSION);
41
+        ResponseBean response = new ResponseBean();
42
+        response = iToBannerService.addBanner(banner,userElement.getId());
43
+        return response;
44
+    }
45
+
46
+    @ApiOperation(value = "修改Banner",notes = "修改Banner")
47
+    @ApiImplicitParams({
48
+            @ApiImplicitParam(paramType = "body",dataType = "ToBanner",name = "banner",value = "bannerTitle(标题)," +
49
+                    "sort(权重),bannerCover(图片),bannerPosition(Banner位),communityId(小区)," +
50
+                    "effTime(生效时间),expTime(失效时间),bannerType(Banner类型),externalLink(Banner的URL)," +
51
+                    "bannerContent(Banner内容)"),
52
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
53
+    })
54
+    @RequestMapping(value = "/banner",method = RequestMethod.PUT)
55
+    public ResponseBean updateBanner(@RequestBody @Valid ToBanner banner,
56
+                                  HttpSession session){
57
+
58
+        UserElement userElement = (UserElement) session.getAttribute(Constant.WEB_USER_SESSION);
59
+        ResponseBean response = new ResponseBean();
60
+        response = iToBannerService.modifyBanner(banner,userElement.getId());
61
+        return response;
62
+    }
63
+
64
+    @ApiOperation(value = "获取Banner详情",notes = "获取Banner详情")
65
+    @ApiImplicitParams({
66
+            @ApiImplicitParam(paramType = "id",dataType = "Integer",name = "bannerId",value = "bannerId(编号),")
67
+    })
68
+    @RequestMapping(value = "/banner",method = RequestMethod.GET)
69
+    public ResponseBean getByIdBanner(@RequestParam(value = "bannerId") Integer bannerId,
70
+                                  HttpSession session){
71
+
72
+        ResponseBean response = new ResponseBean();
73
+        response = iToBannerService.getById(bannerId);
74
+        return response;
75
+    }
76
+
77
+//    @ApiOperation(value = "根据条件查询Banner",notes = "根据条件查询Banner")
78
+//    @ApiImplicitParams({
79
+//            @ApiImplicitParam(paramType = "body",dataType = "ToBanner",name = "banner",value = "bannerTitle(标题)," +
80
+//                    "sort(权重),bannerCover(图片),bannerPosition(Banner位),communityId(小区)," +
81
+//                    "effTime(生效时间),expTime(失效时间),bannerType(Banner类型),externalLink(Banner的URL)," +
82
+//                    "bannerContent(Banner内容)"),
83
+//            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
84
+//    })
85
+//    @RequestMapping(value = "/banner",method = RequestMethod.GET)
86
+//    public ResponseBean updateBanner(@RequestBody @Valid ToBanner banner,
87
+//                                     HttpSession session){
88
+//
89
+//        UserElement userElement = (UserElement) session.getAttribute(Constant.WEB_USER_SESSION);
90
+//        ResponseBean response = new ResponseBean();
91
+//        response = iToBannerService.modifyBanner(banner,userElement.getId());
92
+//        return response;
93
+//    }
94
+
95
+}

+ 63
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/CodeController.java Ver fichero

@@ -0,0 +1,63 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.utils.AccountValidatorUtil;
5
+import com.community.huiju.common.code.ICode;
6
+import com.community.huiju.common.code.cache.AppkeyCache;
7
+import io.swagger.annotations.Api;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.beans.factory.annotation.Qualifier;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.RequestParam;
18
+import org.springframework.web.bind.annotation.RestController;
19
+
20
+import javax.servlet.http.HttpSession;
21
+
22
+/**
23
+ * @author weiximei
24
+ */
25
+@RestController
26
+@RequestMapping("/")
27
+@RefreshScope
28
+@Api(value = "获取验证码的API", description = "获取验证码的API")
29
+@Slf4j
30
+public class CodeController {
31
+
32
+    @Autowired
33
+    @Qualifier("phoneCodeImpl")
34
+    private ICode iCode;
35
+
36
+    @ApiOperation(value = "获取手机验证码", notes = "根据手机号发送验证码")
37
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "query",dataType = "String",name = "phone",value = "手机号")})
38
+    @RequestMapping(value = "/code/sendCode",method = RequestMethod.POST)
39
+    public ResponseBean sendCode(@RequestParam String phone, HttpSession session) {
40
+        ResponseBean response = new ResponseBean();
41
+
42
+        log.info("{} 手机号校验结果: {}",phone, AccountValidatorUtil.isPhone(phone));
43
+        if (!AccountValidatorUtil.isPhone(phone)){
44
+            response.addError("请输入正取的手机号!");
45
+            return response;
46
+        }
47
+
48
+        int code = (int) ((Math.random()*9+1)*1000);
49
+        //boolean result = iCode.sendCode(phone,String.valueOf(code));
50
+        boolean result = true;
51
+        if (result) {
52
+            log.info("{} 验证码: {}",phone,code);
53
+            // 设置缓存
54
+            AppkeyCache.setCache(phone,String.valueOf(code));
55
+            //session.setAttribute(Constant.SESSION_PHONE_CODE,String.valueOf(code));
56
+            response.addSuccess("发送成功!"+code);
57
+        } else {
58
+            response.addError("发送失败!");
59
+        }
60
+        return response;
61
+    }
62
+
63
+}

+ 59
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/UserController.java Ver fichero

@@ -0,0 +1,59 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.constant.Constant;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.commom.session.UserElement;
7
+import com.community.huiju.service.IToUserService;
8
+import com.community.huiju.vo.ToUserVO;
9
+import io.swagger.annotations.Api;
10
+import io.swagger.annotations.ApiImplicitParam;
11
+import io.swagger.annotations.ApiImplicitParams;
12
+import io.swagger.annotations.ApiOperation;
13
+import org.apache.catalina.servlet4preview.http.HttpServletRequest;
14
+import org.springframework.beans.BeanUtils;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.cloud.context.config.annotation.RefreshScope;
17
+import org.springframework.web.bind.annotation.*;
18
+
19
+import javax.servlet.http.HttpSession;
20
+
21
+/**
22
+ * 用户 控制器
23
+ * @author weiximei
24
+ */
25
+@RestController
26
+@RequestMapping("/")
27
+@RefreshScope
28
+@Api(value = "运营web用户API",description = "运营web用户API")
29
+public class UserController {
30
+
31
+    @Autowired
32
+    private IToUserService iToUserService;
33
+
34
+    @ApiOperation(value = "用户登录",nickname = "根据手机号, 验证码")
35
+    @ApiImplicitParams({
36
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "loginName登陆名, code 验证码")
37
+    })
38
+    @RequestMapping(value = "/user/login",method = RequestMethod.POST)
39
+    public ResponseBean login(@RequestBody String parameter, HttpSession session, HttpServletRequest request){
40
+
41
+        ResponseBean response = new ResponseBean();
42
+
43
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
44
+        response = iToUserService.login(jsonObject.getString("loginName"),jsonObject.getString("code"));
45
+        ToUserVO userVO = (ToUserVO) response.getData();
46
+
47
+        if (null != userVO) {
48
+            UserElement userElement = new UserElement();
49
+            BeanUtils.copyProperties(userVO,userElement);
50
+            userElement.setLoginType(Constant.WEB_LOGIN_TYPE);
51
+            session.setAttribute(Constant.WEB_USER_SESSION,userElement);
52
+            userVO.setToken(session.getId());
53
+        }
54
+
55
+        return response;
56
+    }
57
+
58
+
59
+}

+ 17
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/SysDictionaryMapper.java Ver fichero

@@ -0,0 +1,17 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.SysDictionary;
4
+
5
+public interface SysDictionaryMapper {
6
+    int deleteByPrimaryKey(Integer id);
7
+
8
+    int insert(SysDictionary record);
9
+
10
+    int insertSelective(SysDictionary record);
11
+
12
+    SysDictionary selectByPrimaryKey(Integer id);
13
+
14
+    int updateByPrimaryKeySelective(SysDictionary record);
15
+
16
+    int updateByPrimaryKey(SysDictionary record);
17
+}

+ 37
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToBannerMapper.java Ver fichero

@@ -0,0 +1,37 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.ToBanner;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+import java.util.List;
7
+
8
+@Mapper
9
+public interface ToBannerMapper {
10
+    int deleteByPrimaryKey(Integer id);
11
+
12
+    int insert(ToBanner record);
13
+
14
+    int insertSelective(ToBanner record);
15
+
16
+    ToBanner selectByPrimaryKey(Integer id);
17
+
18
+    int updateByPrimaryKeySelective(ToBanner record);
19
+
20
+    int updateByPrimaryKeyWithBLOBs(ToBanner record);
21
+
22
+    int updateByPrimaryKey(ToBanner record);
23
+
24
+    /**
25
+     * 根据条件查询Banner
26
+     *
27
+     * title 标题
28
+     * bannerDescription 跳转描述
29
+     * bannerPosition banner位
30
+     *
31
+     *
32
+     * @param toBanner
33
+     * @return
34
+     */
35
+    List<ToBanner> selectBanner(ToBanner toBanner);
36
+
37
+}

+ 19
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysMenuMapper.java Ver fichero

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.ToSysMenu;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface ToSysMenuMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(ToSysMenu record);
11
+
12
+    int insertSelective(ToSysMenu record);
13
+
14
+    ToSysMenu selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(ToSysMenu record);
17
+
18
+    int updateByPrimaryKey(ToSysMenu record);
19
+}

+ 19
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysRoleMapper.java Ver fichero

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.ToSysRole;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface ToSysRoleMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(ToSysRole record);
11
+
12
+    int insertSelective(ToSysRole record);
13
+
14
+    ToSysRole selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(ToSysRole record);
17
+
18
+    int updateByPrimaryKey(ToSysRole record);
19
+}

+ 19
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysRoleMenuMapper.java Ver fichero

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.ToSysRoleMenu;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface ToSysRoleMenuMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(ToSysRoleMenu record);
11
+
12
+    int insertSelective(ToSysRoleMenu record);
13
+
14
+    ToSysRoleMenu selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(ToSysRoleMenu record);
17
+
18
+    int updateByPrimaryKey(ToSysRoleMenu record);
19
+}

+ 19
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToSysUserRoleMapper.java Ver fichero

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.ToSysUserRole;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface ToSysUserRoleMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(ToSysUserRole record);
11
+
12
+    int insertSelective(ToSysUserRole record);
13
+
14
+    ToSysUserRole selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(ToSysUserRole record);
17
+
18
+    int updateByPrimaryKey(ToSysUserRole record);
19
+}

+ 22
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/ToUserMapper.java Ver fichero

@@ -0,0 +1,22 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.ToUser;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+@Mapper
8
+public interface ToUserMapper {
9
+    int deleteByPrimaryKey(Integer id);
10
+
11
+    int insert(ToUser record);
12
+
13
+    int insertSelective(ToUser record);
14
+
15
+    ToUser selectByPrimaryKey(Integer id);
16
+
17
+    int updateByPrimaryKeySelective(ToUser record);
18
+
19
+    int updateByPrimaryKey(ToUser record);
20
+
21
+    ToUser selectByLoginName(@Param(value = "loginName") String loginName);
22
+}

+ 58
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java Ver fichero

@@ -0,0 +1,58 @@
1
+package com.community.huiju.exception;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.validation.ObjectError;
7
+import org.springframework.web.bind.MethodArgumentNotValidException;
8
+import org.springframework.web.bind.annotation.ControllerAdvice;
9
+import org.springframework.web.bind.annotation.ExceptionHandler;
10
+import org.springframework.web.bind.annotation.ResponseBody;
11
+
12
+import java.util.List;
13
+
14
+/**
15
+ * 统一异常出口
16
+ * @author weiximei
17
+ */
18
+@ControllerAdvice
19
+@ResponseBody
20
+@Slf4j
21
+public class ExceptionHandleAdice {
22
+
23
+
24
+    @ExceptionHandler(Exception.class)
25
+    public ResponseBean handleException(Exception e){
26
+        log.error(e.getMessage(),e);
27
+        ResponseBean response = new ResponseBean();
28
+        response.addError(Constant.REQUEST_ERROR,"系统异常,请稍后重试!");
29
+        return response;
30
+    }
31
+
32
+
33
+    @ExceptionHandler(WisdomException.class)
34
+    public ResponseBean handleException(WisdomException e) {
35
+        log.error(e.getMessage(),e);
36
+        ResponseBean response = new ResponseBean();
37
+        response.addError(e.getMessage());
38
+        return response;
39
+    }
40
+
41
+
42
+    @ExceptionHandler(MethodArgumentNotValidException.class)
43
+    public ResponseBean handlelllewgalParamException(MethodArgumentNotValidException e){
44
+        ResponseBean response = new ResponseBean();
45
+
46
+        List<ObjectError> errors  =e.getBindingResult().getAllErrors();
47
+        String message = "参数不合法";
48
+        if (errors.size() >0) {
49
+            message = errors.get(0).getDefaultMessage();
50
+        }
51
+
52
+        response.addError(message);
53
+
54
+        return response;
55
+    }
56
+
57
+
58
+}

+ 17
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/exception/WisdomException.java Ver fichero

@@ -0,0 +1,17 @@
1
+package com.community.huiju.exception;
2
+
3
+
4
+/**
5
+ * @author weiximei
6
+ */
7
+public class WisdomException extends RuntimeException {
8
+
9
+
10
+    public WisdomException(String msg, Throwable t) {
11
+        super(msg, t);
12
+    }
13
+
14
+    public WisdomException(String msg) {
15
+        super(msg);
16
+    }
17
+}

+ 53
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/SysDictionary.java Ver fichero

@@ -0,0 +1,53 @@
1
+package com.community.huiju.model;
2
+
3
+public class SysDictionary {
4
+    private Integer id;
5
+
6
+    private String code;
7
+
8
+    private String name;
9
+
10
+    private String groupId;
11
+
12
+    private Integer sort;
13
+
14
+    public Integer getId() {
15
+        return id;
16
+    }
17
+
18
+    public void setId(Integer id) {
19
+        this.id = id;
20
+    }
21
+
22
+    public String getCode() {
23
+        return code;
24
+    }
25
+
26
+    public void setCode(String code) {
27
+        this.code = code == null ? null : code.trim();
28
+    }
29
+
30
+    public String getName() {
31
+        return name;
32
+    }
33
+
34
+    public void setName(String name) {
35
+        this.name = name == null ? null : name.trim();
36
+    }
37
+
38
+    public String getGroupId() {
39
+        return groupId;
40
+    }
41
+
42
+    public void setGroupId(String groupId) {
43
+        this.groupId = groupId == null ? null : groupId.trim();
44
+    }
45
+
46
+    public Integer getSort() {
47
+        return sort;
48
+    }
49
+
50
+    public void setSort(Integer sort) {
51
+        this.sort = sort;
52
+    }
53
+}

+ 184
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java Ver fichero

@@ -0,0 +1,184 @@
1
+package com.community.huiju.model;
2
+
3
+import javax.validation.constraints.Future;
4
+import javax.validation.constraints.Min;
5
+import javax.validation.constraints.NotBlank;
6
+import java.util.Date;
7
+
8
+public class ToBanner {
9
+    private Integer id;
10
+
11
+    private String title;
12
+
13
+    @Min(value = 0,message = "小区不能为空!")
14
+    private Integer communityId;
15
+
16
+    private String bannerDescription;
17
+
18
+    private Integer sort;
19
+
20
+    @NotBlank(message = "banner图片不能为空!")
21
+    private String bannerCover;
22
+
23
+    @Min(value = 0,message = "请选择有效的banner位!")
24
+    private Integer bannerPosition;
25
+
26
+    private Date effTime;
27
+
28
+    private Date expTime;
29
+
30
+    @NotBlank(message = "banner类型不能为空!")
31
+    private String bannerType;
32
+
33
+    @NotBlank(message = "跳转的URL不能为空!")
34
+    private String externalLink;
35
+
36
+    @NotBlank(message = "banner标题不能为空!")
37
+    private String bannerTitle;
38
+
39
+    private Integer createUser;
40
+
41
+    private Date createDate;
42
+
43
+    private Integer updateUser;
44
+
45
+    private Date updateDate;
46
+
47
+    private String bannerContent;
48
+
49
+    public Integer getId() {
50
+        return id;
51
+    }
52
+
53
+    public void setId(Integer id) {
54
+        this.id = id;
55
+    }
56
+
57
+    public String getTitle() {
58
+        return title;
59
+    }
60
+
61
+    public void setTitle(String title) {
62
+        this.title = title;
63
+    }
64
+
65
+    public Integer getCommunityId() {
66
+        return communityId;
67
+    }
68
+
69
+    public void setCommunityId(Integer communityId) {
70
+        this.communityId = communityId;
71
+    }
72
+
73
+    public String getBannerDescription() {
74
+        return bannerDescription;
75
+    }
76
+
77
+    public void setBannerDescription(String bannerDescription) {
78
+        this.bannerDescription = bannerDescription == null ? null : bannerDescription.trim();
79
+    }
80
+
81
+    public Integer getSort() {
82
+        return sort;
83
+    }
84
+
85
+    public void setSort(Integer sort) {
86
+        this.sort = sort;
87
+    }
88
+
89
+    public String getBannerCover() {
90
+        return bannerCover;
91
+    }
92
+
93
+    public void setBannerCover(String bannerCover) {
94
+        this.bannerCover = bannerCover == null ? null : bannerCover.trim();
95
+    }
96
+
97
+    public Integer getBannerPosition() {
98
+        return bannerPosition;
99
+    }
100
+
101
+    public void setBannerPosition(Integer bannerPosition) {
102
+        this.bannerPosition = bannerPosition;
103
+    }
104
+
105
+    public Date getEffTime() {
106
+        return effTime;
107
+    }
108
+
109
+    public void setEffTime(Date effTime) {
110
+        this.effTime = effTime;
111
+    }
112
+
113
+    public Date getExpTime() {
114
+        return expTime;
115
+    }
116
+
117
+    public void setExpTime(Date expTime) {
118
+        this.expTime = expTime;
119
+    }
120
+
121
+    public String getBannerType() {
122
+        return bannerType;
123
+    }
124
+
125
+    public void setBannerType(String bannerType) {
126
+        this.bannerType = bannerType == null ? null : bannerType.trim();
127
+    }
128
+
129
+    public String getExternalLink() {
130
+        return externalLink;
131
+    }
132
+
133
+    public void setExternalLink(String externalLink) {
134
+        this.externalLink = externalLink == null ? null : externalLink.trim();
135
+    }
136
+
137
+    public String getBannerTitle() {
138
+        return bannerTitle;
139
+    }
140
+
141
+    public void setBannerTitle(String bannerTitle) {
142
+        this.bannerTitle = bannerTitle == null ? null : bannerTitle.trim();
143
+    }
144
+
145
+    public Integer getCreateUser() {
146
+        return createUser;
147
+    }
148
+
149
+    public void setCreateUser(Integer createUser) {
150
+        this.createUser = createUser;
151
+    }
152
+
153
+    public Date getCreateDate() {
154
+        return createDate;
155
+    }
156
+
157
+    public void setCreateDate(Date createDate) {
158
+        this.createDate = createDate;
159
+    }
160
+
161
+    public Integer getUpdateUser() {
162
+        return updateUser;
163
+    }
164
+
165
+    public void setUpdateUser(Integer updateUser) {
166
+        this.updateUser = updateUser;
167
+    }
168
+
169
+    public Date getUpdateDate() {
170
+        return updateDate;
171
+    }
172
+
173
+    public void setUpdateDate(Date updateDate) {
174
+        this.updateDate = updateDate;
175
+    }
176
+
177
+    public String getBannerContent() {
178
+        return bannerContent;
179
+    }
180
+
181
+    public void setBannerContent(String bannerContent) {
182
+        this.bannerContent = bannerContent == null ? null : bannerContent.trim();
183
+    }
184
+}

+ 83
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysMenu.java Ver fichero

@@ -0,0 +1,83 @@
1
+package com.community.huiju.model;
2
+
3
+public class ToSysMenu {
4
+    private Integer id;
5
+
6
+    private String menuName;
7
+
8
+    private String menuUrl;
9
+
10
+    private String menuIcon;
11
+
12
+    private Integer parentId;
13
+
14
+    private Integer sort;
15
+
16
+    private String menuType;
17
+
18
+    private String status;
19
+
20
+    public Integer getId() {
21
+        return id;
22
+    }
23
+
24
+    public void setId(Integer id) {
25
+        this.id = id;
26
+    }
27
+
28
+    public String getMenuName() {
29
+        return menuName;
30
+    }
31
+
32
+    public void setMenuName(String menuName) {
33
+        this.menuName = menuName == null ? null : menuName.trim();
34
+    }
35
+
36
+    public String getMenuUrl() {
37
+        return menuUrl;
38
+    }
39
+
40
+    public void setMenuUrl(String menuUrl) {
41
+        this.menuUrl = menuUrl == null ? null : menuUrl.trim();
42
+    }
43
+
44
+    public String getMenuIcon() {
45
+        return menuIcon;
46
+    }
47
+
48
+    public void setMenuIcon(String menuIcon) {
49
+        this.menuIcon = menuIcon == null ? null : menuIcon.trim();
50
+    }
51
+
52
+    public Integer getParentId() {
53
+        return parentId;
54
+    }
55
+
56
+    public void setParentId(Integer parentId) {
57
+        this.parentId = parentId;
58
+    }
59
+
60
+    public Integer getSort() {
61
+        return sort;
62
+    }
63
+
64
+    public void setSort(Integer sort) {
65
+        this.sort = sort;
66
+    }
67
+
68
+    public String getMenuType() {
69
+        return menuType;
70
+    }
71
+
72
+    public void setMenuType(String menuType) {
73
+        this.menuType = menuType == null ? null : menuType.trim();
74
+    }
75
+
76
+    public String getStatus() {
77
+        return status;
78
+    }
79
+
80
+    public void setStatus(String status) {
81
+        this.status = status == null ? null : status.trim();
82
+    }
83
+}

+ 85
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysRole.java Ver fichero

@@ -0,0 +1,85 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class ToSysRole {
6
+    private Integer id;
7
+
8
+    private String roleName;
9
+
10
+    private String description;
11
+
12
+    private String status;
13
+
14
+    private Integer createUser;
15
+
16
+    private Date createDate;
17
+
18
+    private Integer updateUser;
19
+
20
+    private Date updateDate;
21
+
22
+    public Integer getId() {
23
+        return id;
24
+    }
25
+
26
+    public void setId(Integer id) {
27
+        this.id = id;
28
+    }
29
+
30
+    public String getRoleName() {
31
+        return roleName;
32
+    }
33
+
34
+    public void setRoleName(String roleName) {
35
+        this.roleName = roleName == null ? null : roleName.trim();
36
+    }
37
+
38
+    public String getDescription() {
39
+        return description;
40
+    }
41
+
42
+    public void setDescription(String description) {
43
+        this.description = description == null ? null : description.trim();
44
+    }
45
+
46
+    public String getStatus() {
47
+        return status;
48
+    }
49
+
50
+    public void setStatus(String status) {
51
+        this.status = status == null ? null : status.trim();
52
+    }
53
+
54
+    public Integer getCreateUser() {
55
+        return createUser;
56
+    }
57
+
58
+    public void setCreateUser(Integer createUser) {
59
+        this.createUser = createUser;
60
+    }
61
+
62
+    public Date getCreateDate() {
63
+        return createDate;
64
+    }
65
+
66
+    public void setCreateDate(Date createDate) {
67
+        this.createDate = createDate;
68
+    }
69
+
70
+    public Integer getUpdateUser() {
71
+        return updateUser;
72
+    }
73
+
74
+    public void setUpdateUser(Integer updateUser) {
75
+        this.updateUser = updateUser;
76
+    }
77
+
78
+    public Date getUpdateDate() {
79
+        return updateDate;
80
+    }
81
+
82
+    public void setUpdateDate(Date updateDate) {
83
+        this.updateDate = updateDate;
84
+    }
85
+}

+ 33
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysRoleMenu.java Ver fichero

@@ -0,0 +1,33 @@
1
+package com.community.huiju.model;
2
+
3
+public class ToSysRoleMenu {
4
+    private Integer id;
5
+
6
+    private Integer roleId;
7
+
8
+    private Integer menuId;
9
+
10
+    public Integer getId() {
11
+        return id;
12
+    }
13
+
14
+    public void setId(Integer id) {
15
+        this.id = id;
16
+    }
17
+
18
+    public Integer getRoleId() {
19
+        return roleId;
20
+    }
21
+
22
+    public void setRoleId(Integer roleId) {
23
+        this.roleId = roleId;
24
+    }
25
+
26
+    public Integer getMenuId() {
27
+        return menuId;
28
+    }
29
+
30
+    public void setMenuId(Integer menuId) {
31
+        this.menuId = menuId;
32
+    }
33
+}

+ 33
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToSysUserRole.java Ver fichero

@@ -0,0 +1,33 @@
1
+package com.community.huiju.model;
2
+
3
+public class ToSysUserRole {
4
+    private Integer id;
5
+
6
+    private Integer userId;
7
+
8
+    private Integer roleId;
9
+
10
+    public Integer getId() {
11
+        return id;
12
+    }
13
+
14
+    public void setId(Integer id) {
15
+        this.id = id;
16
+    }
17
+
18
+    public Integer getUserId() {
19
+        return userId;
20
+    }
21
+
22
+    public void setUserId(Integer userId) {
23
+        this.userId = userId;
24
+    }
25
+
26
+    public Integer getRoleId() {
27
+        return roleId;
28
+    }
29
+
30
+    public void setRoleId(Integer roleId) {
31
+        this.roleId = roleId;
32
+    }
33
+}

+ 125
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToUser.java Ver fichero

@@ -0,0 +1,125 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class ToUser {
6
+    private Integer id;
7
+
8
+    private String userName;
9
+
10
+    private String loginName;
11
+
12
+    private String loginPassword;
13
+
14
+    private String email;
15
+
16
+    private String headPortrait;
17
+
18
+    private String remark;
19
+
20
+    private String status;
21
+
22
+    private Integer createUser;
23
+
24
+    private Date createDate;
25
+
26
+    private Integer updateUser;
27
+
28
+    private Date updateDate;
29
+
30
+    public Integer getId() {
31
+        return id;
32
+    }
33
+
34
+    public void setId(Integer id) {
35
+        this.id = id;
36
+    }
37
+
38
+    public String getUserName() {
39
+        return userName;
40
+    }
41
+
42
+    public void setUserName(String userName) {
43
+        this.userName = userName == null ? null : userName.trim();
44
+    }
45
+
46
+    public String getLoginName() {
47
+        return loginName;
48
+    }
49
+
50
+    public void setLoginName(String loginName) {
51
+        this.loginName = loginName == null ? null : loginName.trim();
52
+    }
53
+
54
+    public String getLoginPassword() {
55
+        return loginPassword;
56
+    }
57
+
58
+    public void setLoginPassword(String loginPassword) {
59
+        this.loginPassword = loginPassword == null ? null : loginPassword.trim();
60
+    }
61
+
62
+    public String getEmail() {
63
+        return email;
64
+    }
65
+
66
+    public void setEmail(String email) {
67
+        this.email = email == null ? null : email.trim();
68
+    }
69
+
70
+    public String getHeadPortrait() {
71
+        return headPortrait;
72
+    }
73
+
74
+    public void setHeadPortrait(String headPortrait) {
75
+        this.headPortrait = headPortrait == null ? null : headPortrait.trim();
76
+    }
77
+
78
+    public String getRemark() {
79
+        return remark;
80
+    }
81
+
82
+    public void setRemark(String remark) {
83
+        this.remark = remark == null ? null : remark.trim();
84
+    }
85
+
86
+    public String getStatus() {
87
+        return status;
88
+    }
89
+
90
+    public void setStatus(String status) {
91
+        this.status = status == null ? null : status.trim();
92
+    }
93
+
94
+    public Integer getCreateUser() {
95
+        return createUser;
96
+    }
97
+
98
+    public void setCreateUser(Integer createUser) {
99
+        this.createUser = createUser;
100
+    }
101
+
102
+    public Date getCreateDate() {
103
+        return createDate;
104
+    }
105
+
106
+    public void setCreateDate(Date createDate) {
107
+        this.createDate = createDate;
108
+    }
109
+
110
+    public Integer getUpdateUser() {
111
+        return updateUser;
112
+    }
113
+
114
+    public void setUpdateUser(Integer updateUser) {
115
+        this.updateUser = updateUser;
116
+    }
117
+
118
+    public Date getUpdateDate() {
119
+        return updateDate;
120
+    }
121
+
122
+    public void setUpdateDate(Date updateDate) {
123
+        this.updateDate = updateDate;
124
+    }
125
+}

+ 48
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToBannerService.java Ver fichero

@@ -0,0 +1,48 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.model.ToBanner;
5
+
6
+/**
7
+ * banner 业务管理
8
+ * @author weiximei
9
+ */
10
+public interface IToBannerService {
11
+
12
+    /**
13
+     * 添加banner
14
+     * @param banner
15
+     * @param currentUserId
16
+     * @return
17
+     */
18
+    ResponseBean addBanner(ToBanner banner,Integer currentUserId);
19
+
20
+    /**
21
+     * 查询banner详情
22
+     * @param bannerId banner的编号
23
+     * @return
24
+     */
25
+    ResponseBean getById(Integer bannerId);
26
+
27
+    /**
28
+     * 修改banner
29
+     * @param banner
30
+     * @param currentUserId
31
+     * @return
32
+     */
33
+    ResponseBean modifyBanner(ToBanner banner,Integer currentUserId);
34
+
35
+    /**
36
+     * 根据条件查询Banner
37
+     *
38
+     * title 标题
39
+     * bannerDescription 跳转描述
40
+     * bannerPosition banner位
41
+     *
42
+     *
43
+     * @param banner
44
+     * @return
45
+     */
46
+    ResponseBean getBanner(ToBanner banner);
47
+
48
+}

+ 19
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/IToUserService.java Ver fichero

@@ -0,0 +1,19 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+
5
+/**
6
+ * 用户 业务
7
+ * @author weiximei
8
+ */
9
+public interface IToUserService {
10
+
11
+    /**
12
+     * 用户登录
13
+     * @param loginName
14
+     * @param code 验证码
15
+     * @return
16
+     */
17
+    ResponseBean login(String loginName,String code);
18
+
19
+}

+ 158
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java Ver fichero

@@ -0,0 +1,158 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.huiju.dao.SysDictionaryMapper;
6
+import com.community.huiju.dao.ToBannerMapper;
7
+import com.community.huiju.dao.ToCommunitiesMapper;
8
+import com.community.huiju.dao.ToUserMapper;
9
+import com.community.huiju.model.SysDictionary;
10
+import com.community.huiju.model.ToBanner;
11
+import com.community.huiju.model.ToCommunities;
12
+import com.community.huiju.model.ToUser;
13
+import com.community.huiju.service.IToBannerService;
14
+import com.community.huiju.vo.ToBannerVO;
15
+import org.apache.commons.lang.StringUtils;
16
+import org.springframework.beans.BeanUtils;
17
+import org.springframework.beans.factory.annotation.Autowired;
18
+import org.springframework.stereotype.Service;
19
+
20
+import java.util.Date;
21
+import java.util.List;
22
+import java.util.stream.Collectors;
23
+
24
+/**
25
+ * banner 业务
26
+ * @author weiximei
27
+ */
28
+@Service("iToBannerService")
29
+public class ToBannerServiceImpl implements IToBannerService {
30
+
31
+    @Autowired
32
+    private ToBannerMapper toBannerMapper;
33
+
34
+    @Autowired
35
+    private ToUserMapper toUserMapper;
36
+
37
+    @Autowired
38
+    private ToCommunitiesMapper toCommunitiesMapper;
39
+
40
+    @Autowired
41
+    private SysDictionaryMapper sysDictionaryMapper;
42
+
43
+    @Override
44
+    public ResponseBean addBanner(ToBanner banner,Integer currentUserId) {
45
+
46
+        ResponseBean response = new ResponseBean();
47
+        if (!Constant.BANNER_TYPE_ARTICLE.equals(banner.getBannerType())) {
48
+            if (StringUtils.isBlank(banner.getBannerContent())) {
49
+                response.addError("Banner内容不能为空");
50
+                return response;
51
+            }
52
+        }
53
+
54
+        Date effTime = banner.getEffTime();
55
+        Date currentDate = new Date();
56
+        if (effTime.getTime() < currentDate.getTime()) {
57
+            response.addError("生效时间不能小于当前时间!");
58
+            return response;
59
+        }
60
+
61
+        Date expTime = banner.getExpTime();
62
+        if (expTime.getTime() <= effTime.getTime()) {
63
+            response.addError("失效时间不能小于生效时间!");
64
+            return response;
65
+        }
66
+
67
+        ToUser toUser = toUserMapper.selectByPrimaryKey(currentUserId);
68
+
69
+        banner.setCreateDate(new Date());
70
+        banner.setCreateUser(toUser.getId());
71
+        banner.setUpdateDate(new Date());
72
+        banner.setUpdateUser(toUser.getId());
73
+
74
+        int result = toBannerMapper.insertSelective(banner);
75
+        if (result > 0) {
76
+            response.addSuccess("添加成功!");
77
+        }
78
+
79
+        return response;
80
+    }
81
+
82
+
83
+    @Override
84
+    public ResponseBean getById(Integer bannerId) {
85
+
86
+        ResponseBean response = new ResponseBean();
87
+        ToBanner toBanner = toBannerMapper.selectByPrimaryKey(bannerId);
88
+
89
+        response.addSuccess(toBanner);
90
+
91
+        return response;
92
+    }
93
+
94
+    @Override
95
+    public ResponseBean modifyBanner(ToBanner banner,Integer currentUserId) {
96
+        ResponseBean response = new ResponseBean();
97
+        if (!Constant.BANNER_TYPE_ARTICLE.equals(banner.getBannerType())) {
98
+            if (StringUtils.isBlank(banner.getBannerContent())) {
99
+                response.addError("Banner内容不能为空");
100
+                return response;
101
+            }
102
+        }
103
+
104
+        Date effTime = banner.getEffTime();
105
+        Date currentDate = new Date();
106
+        if (effTime.getTime() < currentDate.getTime()) {
107
+            response.addError("生效时间不能小于当前时间!");
108
+            return response;
109
+        }
110
+
111
+        Date expTime = banner.getExpTime();
112
+        if (expTime.getTime() <= effTime.getTime()) {
113
+            response.addError("失效时间不能小于生效时间!");
114
+            return response;
115
+        }
116
+
117
+        ToUser toUser = toUserMapper.selectByPrimaryKey(currentUserId);
118
+
119
+        banner.setUpdateDate(new Date());
120
+        banner.setUpdateUser(toUser.getId());
121
+
122
+        int result = toBannerMapper.updateByPrimaryKeySelective(banner);
123
+        if (result > 0) {
124
+            response.addSuccess("修改成功!");
125
+            return response;
126
+        }
127
+
128
+        return response;
129
+    }
130
+
131
+    @Override
132
+    public ResponseBean getBanner(ToBanner banner) {
133
+
134
+        ResponseBean response = new ResponseBean();
135
+
136
+        List<ToBanner> bannerList = toBannerMapper.selectBanner(banner);
137
+        List<ToBannerVO> bannerVOList = bannerList.stream().map(e->{
138
+            ToBannerVO toBannerVO = new ToBannerVO();
139
+            BeanUtils.copyProperties(e,toBannerVO);
140
+
141
+            ToCommunities toCommunities = toCommunitiesMapper.selectByPrimaryKey(e.getCommunityId());
142
+            toBannerVO.setCommunityName(toCommunities.getCommunityName());
143
+
144
+            SysDictionary sysDictionary = sysDictionaryMapper.selectByPrimaryKey(e.getBannerPosition());
145
+            toBannerVO.setBannerPositionName(sysDictionary.getName());
146
+
147
+            ToUser toUser = toUserMapper.selectByPrimaryKey(e.getUpdateUser());
148
+            toBannerVO.setUpdateUserName(toUser.getUserName());
149
+
150
+            return toBannerVO;
151
+
152
+        }).collect(Collectors.toList());
153
+
154
+        response.addSuccess(bannerVOList);
155
+
156
+        return response;
157
+    }
158
+}

+ 55
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToUserServerImpl.java Ver fichero

@@ -0,0 +1,55 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.commom.utils.AccountValidatorUtil;
5
+import com.community.huiju.common.code.cache.AppkeyCache;
6
+import com.community.huiju.dao.ToUserMapper;
7
+import com.community.huiju.model.ToUser;
8
+import com.community.huiju.service.IToUserService;
9
+import com.community.huiju.vo.ToUserVO;
10
+import lombok.extern.slf4j.Slf4j;
11
+import org.apache.commons.lang.StringUtils;
12
+import org.springframework.beans.BeanUtils;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.stereotype.Service;
15
+
16
+@Service("iToUserServer")
17
+@Slf4j
18
+public class ToUserServerImpl implements IToUserService {
19
+
20
+    @Autowired
21
+    private ToUserMapper toUserMapper;
22
+
23
+    @Override
24
+    public ResponseBean login(String loginName, String code) {
25
+
26
+        ResponseBean response = new ResponseBean();
27
+        String phoneCode = (String) AppkeyCache.getCache(loginName);
28
+        if (!phoneCode.equals(code)) {
29
+            response.addError("验证码错误!");
30
+            return response;
31
+        }
32
+        // 设置验证码为null字符
33
+        AppkeyCache.setCache(loginName,"null");
34
+        log.info("{} 手机号校验结果: {}",loginName,AccountValidatorUtil.isPhone(loginName));
35
+        if (!AccountValidatorUtil.isPhone(loginName)){
36
+            response.addError("请输入正取的手机号!");
37
+            return response;
38
+        }
39
+        if (StringUtils.isBlank(code)) {
40
+            response.addError("请输入验证码!");
41
+            return response;
42
+        }
43
+
44
+        ToUser currentUser = toUserMapper.selectByLoginName(loginName);
45
+        if (null == currentUser) {
46
+            response.addError("用户不存在!");
47
+            return response;
48
+        }
49
+
50
+        ToUserVO userVO = new ToUserVO();
51
+        BeanUtils.copyProperties(currentUser,userVO);
52
+        response.addSuccess(userVO);
53
+        return response;
54
+    }
55
+}

+ 55
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/vo/ToBannerVO.java Ver fichero

@@ -0,0 +1,55 @@
1
+package com.community.huiju.vo;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+import javax.validation.constraints.Min;
8
+import javax.validation.constraints.NotBlank;
9
+import java.util.Date;
10
+
11
+/**
12
+ * @author weiximei
13
+ */
14
+@Data
15
+@AllArgsConstructor
16
+@NoArgsConstructor
17
+public class ToBannerVO {
18
+
19
+    /** 编号 **/
20
+    private Integer id;
21
+
22
+    /** 标题 **/
23
+    private String title;
24
+
25
+    /** 社区编号 **/
26
+    private Integer communityId;
27
+
28
+    /** 社区名称 **/
29
+    private String communityName;
30
+
31
+    /** 权重 **/
32
+    private Integer sort;
33
+
34
+    /** banner 位 **/
35
+    private Integer bannerPosition;
36
+
37
+    /** banner 位 的名称 **/
38
+    private String bannerPositionName;
39
+
40
+    /** 生效时间 **/
41
+    private Date effTime;
42
+
43
+    /** 失效时间 **/
44
+    private Date expTime;
45
+
46
+    /** banner 类型 **/
47
+    private String bannerType;
48
+
49
+    /** 修改时间 **/
50
+    private Date updateDate;
51
+
52
+    /** 修改人 **/
53
+    private String updateUserName;
54
+
55
+}

+ 52
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/vo/ToUserVO.java Ver fichero

@@ -0,0 +1,52 @@
1
+package com.community.huiju.vo;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+import java.util.Date;
8
+
9
+/**
10
+ * @author weiximei
11
+ */
12
+@Data
13
+@AllArgsConstructor
14
+@NoArgsConstructor
15
+public class ToUserVO {
16
+
17
+    private Integer id;
18
+
19
+    /** 用户名称 **/
20
+    private String userName;
21
+
22
+    /** 登陆账号 **/
23
+    private String loginName;
24
+
25
+    /** 邮箱 **/
26
+    private String email;
27
+
28
+    /** 头像 **/
29
+    private String headPortrait;
30
+
31
+    /** 备注 **/
32
+    private String remark;
33
+
34
+    /** 状态 **/
35
+    private String status;
36
+
37
+    /** 创建人 **/
38
+    private Integer createUser;
39
+
40
+    /** 创建时间 **/
41
+    private Date createDate;
42
+
43
+    /** 更新人 **/
44
+    private Integer updateUser;
45
+
46
+    /** 更新时间 **/
47
+    private Date updateDate;
48
+
49
+    /** 用户token **/
50
+    private String token;
51
+
52
+}

+ 93
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/SysDictionaryMapper.xml Ver fichero

@@ -0,0 +1,93 @@
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.community.huiju.dao.SysDictionaryMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.SysDictionary" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="code" property="code" jdbcType="VARCHAR" />
7
+    <result column="name" property="name" jdbcType="VARCHAR" />
8
+    <result column="group_id" property="groupId" jdbcType="VARCHAR" />
9
+    <result column="sort" property="sort" jdbcType="INTEGER" />
10
+  </resultMap>
11
+  <sql id="Base_Column_List" >
12
+    id, code, name, group_id, sort
13
+  </sql>
14
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
15
+    select 
16
+    <include refid="Base_Column_List" />
17
+    from sys_dictionary
18
+    where id = #{id,jdbcType=INTEGER}
19
+  </select>
20
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
21
+    delete from sys_dictionary
22
+    where id = #{id,jdbcType=INTEGER}
23
+  </delete>
24
+  <insert id="insert" parameterType="com.community.huiju.model.SysDictionary" >
25
+    insert into sys_dictionary (id, code, name, 
26
+      group_id, sort)
27
+    values (#{id,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
28
+      #{groupId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER})
29
+  </insert>
30
+  <insert id="insertSelective" parameterType="com.community.huiju.model.SysDictionary" >
31
+    insert into sys_dictionary
32
+    <trim prefix="(" suffix=")" suffixOverrides="," >
33
+      <if test="id != null" >
34
+        id,
35
+      </if>
36
+      <if test="code != null" >
37
+        code,
38
+      </if>
39
+      <if test="name != null" >
40
+        name,
41
+      </if>
42
+      <if test="groupId != null" >
43
+        group_id,
44
+      </if>
45
+      <if test="sort != null" >
46
+        sort,
47
+      </if>
48
+    </trim>
49
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
50
+      <if test="id != null" >
51
+        #{id,jdbcType=INTEGER},
52
+      </if>
53
+      <if test="code != null" >
54
+        #{code,jdbcType=VARCHAR},
55
+      </if>
56
+      <if test="name != null" >
57
+        #{name,jdbcType=VARCHAR},
58
+      </if>
59
+      <if test="groupId != null" >
60
+        #{groupId,jdbcType=VARCHAR},
61
+      </if>
62
+      <if test="sort != null" >
63
+        #{sort,jdbcType=INTEGER},
64
+      </if>
65
+    </trim>
66
+  </insert>
67
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.SysDictionary" >
68
+    update sys_dictionary
69
+    <set >
70
+      <if test="code != null" >
71
+        code = #{code,jdbcType=VARCHAR},
72
+      </if>
73
+      <if test="name != null" >
74
+        name = #{name,jdbcType=VARCHAR},
75
+      </if>
76
+      <if test="groupId != null" >
77
+        group_id = #{groupId,jdbcType=VARCHAR},
78
+      </if>
79
+      <if test="sort != null" >
80
+        sort = #{sort,jdbcType=INTEGER},
81
+      </if>
82
+    </set>
83
+    where id = #{id,jdbcType=INTEGER}
84
+  </update>
85
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.SysDictionary" >
86
+    update sys_dictionary
87
+    set code = #{code,jdbcType=VARCHAR},
88
+      name = #{name,jdbcType=VARCHAR},
89
+      group_id = #{groupId,jdbcType=VARCHAR},
90
+      sort = #{sort,jdbcType=INTEGER}
91
+    where id = #{id,jdbcType=INTEGER}
92
+  </update>
93
+</mapper>

+ 280
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml Ver fichero

@@ -0,0 +1,280 @@
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.community.huiju.dao.ToBannerMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.ToBanner" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="title" property="title" jdbcType="VARCHAR" />
8
+    <result column="banner_description" property="bannerDescription" jdbcType="VARCHAR" />
9
+    <result column="sort" property="sort" jdbcType="INTEGER" />
10
+    <result column="banner_cover" property="bannerCover" jdbcType="VARCHAR" />
11
+    <result column="banner_position" property="bannerPosition" jdbcType="INTEGER" />
12
+    <result column="eff_time" property="effTime" jdbcType="TIMESTAMP" />
13
+    <result column="exp_time" property="expTime" jdbcType="TIMESTAMP" />
14
+    <result column="banner_type" property="bannerType" jdbcType="CHAR" />
15
+    <result column="external_link" property="externalLink" jdbcType="VARCHAR" />
16
+    <result column="banner_title" property="bannerTitle" jdbcType="VARCHAR" />
17
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
18
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
19
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
20
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
21
+  </resultMap>
22
+  <resultMap id="ResultMapWithBLOBs" type="com.community.huiju.model.ToBanner" extends="BaseResultMap" >
23
+    <result column="banner_content" property="bannerContent" jdbcType="LONGVARCHAR" />
24
+  </resultMap>
25
+  <sql id="Base_Column_List" >
26
+    id, community_id, title, banner_description, sort, banner_cover, banner_position,
27
+    eff_time, exp_time, banner_type, external_link, banner_title, create_user, create_date,
28
+    update_user, update_date
29
+  </sql>
30
+  <sql id="Blob_Column_List" >
31
+    banner_content
32
+  </sql>
33
+  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
34
+    select
35
+    <include refid="Base_Column_List" />
36
+    ,
37
+    <include refid="Blob_Column_List" />
38
+    from to_banner
39
+    where id = #{id,jdbcType=INTEGER}
40
+  </select>
41
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
42
+    delete from to_banner
43
+    where id = #{id,jdbcType=INTEGER}
44
+  </delete>
45
+  <insert id="insert" parameterType="com.community.huiju.model.ToBanner" >
46
+    insert into to_banner (id, community_id, title,
47
+      banner_description, sort, banner_cover,
48
+      banner_position, eff_time, exp_time,
49
+      banner_type, external_link, banner_title,
50
+      create_user, create_date, update_user,
51
+      update_date, banner_content)
52
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR},
53
+      #{bannerDescription,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{bannerCover,jdbcType=VARCHAR},
54
+      #{bannerPosition,jdbcType=INTEGER}, #{effTime,jdbcType=TIMESTAMP}, #{expTime,jdbcType=TIMESTAMP},
55
+      #{bannerType,jdbcType=CHAR}, #{externalLink,jdbcType=VARCHAR}, #{bannerTitle,jdbcType=VARCHAR},
56
+      #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
57
+      #{updateDate,jdbcType=TIMESTAMP}, #{bannerContent,jdbcType=LONGVARCHAR})
58
+  </insert>
59
+  <insert id="insertSelective" parameterType="com.community.huiju.model.ToBanner" >
60
+    insert into to_banner
61
+    <trim prefix="(" suffix=")" suffixOverrides="," >
62
+      <if test="id != null" >
63
+        id,
64
+      </if>
65
+      <if test="communityId != null" >
66
+        community_id,
67
+      </if>
68
+      <if test="title != null" >
69
+        title,
70
+      </if>
71
+      <if test="bannerDescription != null" >
72
+        banner_description,
73
+      </if>
74
+      <if test="sort != null" >
75
+        sort,
76
+      </if>
77
+      <if test="bannerCover != null" >
78
+        banner_cover,
79
+      </if>
80
+      <if test="bannerPosition != null" >
81
+        banner_position,
82
+      </if>
83
+      <if test="effTime != null" >
84
+        eff_time,
85
+      </if>
86
+      <if test="expTime != null" >
87
+        exp_time,
88
+      </if>
89
+      <if test="bannerType != null" >
90
+        banner_type,
91
+      </if>
92
+      <if test="externalLink != null" >
93
+        external_link,
94
+      </if>
95
+      <if test="bannerTitle != null" >
96
+        banner_title,
97
+      </if>
98
+      <if test="createUser != null" >
99
+        create_user,
100
+      </if>
101
+      <if test="createDate != null" >
102
+        create_date,
103
+      </if>
104
+      <if test="updateUser != null" >
105
+        update_user,
106
+      </if>
107
+      <if test="updateDate != null" >
108
+        update_date,
109
+      </if>
110
+      <if test="bannerContent != null" >
111
+        banner_content,
112
+      </if>
113
+    </trim>
114
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
115
+      <if test="id != null" >
116
+        #{id,jdbcType=INTEGER},
117
+      </if>
118
+      <if test="communityId != null" >
119
+        #{communityId,jdbcType=INTEGER},
120
+      </if>
121
+      <if test="title != null" >
122
+        #{title,jdbcType=VARCHAR},
123
+      </if>
124
+      <if test="bannerDescription != null" >
125
+        #{bannerDescription,jdbcType=VARCHAR},
126
+      </if>
127
+      <if test="sort != null" >
128
+        #{sort,jdbcType=INTEGER},
129
+      </if>
130
+      <if test="bannerCover != null" >
131
+        #{bannerCover,jdbcType=VARCHAR},
132
+      </if>
133
+      <if test="bannerPosition != null" >
134
+        #{bannerPosition,jdbcType=INTEGER},
135
+      </if>
136
+      <if test="effTime != null" >
137
+        #{effTime,jdbcType=TIMESTAMP},
138
+      </if>
139
+      <if test="expTime != null" >
140
+        #{expTime,jdbcType=TIMESTAMP},
141
+      </if>
142
+      <if test="bannerType != null" >
143
+        #{bannerType,jdbcType=CHAR},
144
+      </if>
145
+      <if test="externalLink != null" >
146
+        #{externalLink,jdbcType=VARCHAR},
147
+      </if>
148
+      <if test="bannerTitle != null" >
149
+        #{bannerTitle,jdbcType=VARCHAR},
150
+      </if>
151
+      <if test="createUser != null" >
152
+        #{createUser,jdbcType=INTEGER},
153
+      </if>
154
+      <if test="createDate != null" >
155
+        #{createDate,jdbcType=TIMESTAMP},
156
+      </if>
157
+      <if test="updateUser != null" >
158
+        #{updateUser,jdbcType=INTEGER},
159
+      </if>
160
+      <if test="updateDate != null" >
161
+        #{updateDate,jdbcType=TIMESTAMP},
162
+      </if>
163
+      <if test="bannerContent != null" >
164
+        #{bannerContent,jdbcType=LONGVARCHAR},
165
+      </if>
166
+    </trim>
167
+  </insert>
168
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToBanner" >
169
+    update to_banner
170
+    <set >
171
+      <if test="communityId != null" >
172
+        community_id = #{communityId,jdbcType=INTEGER},
173
+      </if>
174
+      <if test="title != null" >
175
+        title = #{title,jdbcType=VARCHAR},
176
+      </if>
177
+      <if test="bannerDescription != null" >
178
+        banner_description = #{bannerDescription,jdbcType=VARCHAR},
179
+      </if>
180
+      <if test="sort != null" >
181
+        sort = #{sort,jdbcType=INTEGER},
182
+      </if>
183
+      <if test="bannerCover != null" >
184
+        banner_cover = #{bannerCover,jdbcType=VARCHAR},
185
+      </if>
186
+      <if test="bannerPosition != null" >
187
+        banner_position = #{bannerPosition,jdbcType=INTEGER},
188
+      </if>
189
+      <if test="effTime != null" >
190
+        eff_time = #{effTime,jdbcType=TIMESTAMP},
191
+      </if>
192
+      <if test="expTime != null" >
193
+        exp_time = #{expTime,jdbcType=TIMESTAMP},
194
+      </if>
195
+      <if test="bannerType != null" >
196
+        banner_type = #{bannerType,jdbcType=CHAR},
197
+      </if>
198
+      <if test="externalLink != null" >
199
+        external_link = #{externalLink,jdbcType=VARCHAR},
200
+      </if>
201
+      <if test="bannerTitle != null" >
202
+        banner_title = #{bannerTitle,jdbcType=VARCHAR},
203
+      </if>
204
+      <if test="createUser != null" >
205
+        create_user = #{createUser,jdbcType=INTEGER},
206
+      </if>
207
+      <if test="createDate != null" >
208
+        create_date = #{createDate,jdbcType=TIMESTAMP},
209
+      </if>
210
+      <if test="updateUser != null" >
211
+        update_user = #{updateUser,jdbcType=INTEGER},
212
+      </if>
213
+      <if test="updateDate != null" >
214
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
215
+      </if>
216
+      <if test="bannerContent != null" >
217
+        banner_content = #{bannerContent,jdbcType=LONGVARCHAR},
218
+      </if>
219
+    </set>
220
+    where id = #{id,jdbcType=INTEGER}
221
+  </update>
222
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.community.huiju.model.ToBanner" >
223
+    update to_banner
224
+    set community_id = #{communityId,jdbcType=INTEGER},
225
+      title = #{title,jdbcType=VARCHAR},
226
+      banner_description = #{bannerDescription,jdbcType=VARCHAR},
227
+      sort = #{sort,jdbcType=INTEGER},
228
+      banner_cover = #{bannerCover,jdbcType=VARCHAR},
229
+      banner_position = #{bannerPosition,jdbcType=INTEGER},
230
+      eff_time = #{effTime,jdbcType=TIMESTAMP},
231
+      exp_time = #{expTime,jdbcType=TIMESTAMP},
232
+      banner_type = #{bannerType,jdbcType=CHAR},
233
+      external_link = #{externalLink,jdbcType=VARCHAR},
234
+      banner_title = #{bannerTitle,jdbcType=VARCHAR},
235
+      create_user = #{createUser,jdbcType=INTEGER},
236
+      create_date = #{createDate,jdbcType=TIMESTAMP},
237
+      update_user = #{updateUser,jdbcType=INTEGER},
238
+      update_date = #{updateDate,jdbcType=TIMESTAMP},
239
+      banner_content = #{bannerContent,jdbcType=LONGVARCHAR}
240
+    where id = #{id,jdbcType=INTEGER}
241
+  </update>
242
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.ToBanner" >
243
+    update to_banner
244
+    set community_id = #{communityId,jdbcType=INTEGER},
245
+      title = #{title,jdbcType=VARCHAR},
246
+      banner_description = #{bannerDescription,jdbcType=VARCHAR},
247
+      sort = #{sort,jdbcType=INTEGER},
248
+      banner_cover = #{bannerCover,jdbcType=VARCHAR},
249
+      banner_position = #{bannerPosition,jdbcType=INTEGER},
250
+      eff_time = #{effTime,jdbcType=TIMESTAMP},
251
+      exp_time = #{expTime,jdbcType=TIMESTAMP},
252
+      banner_type = #{bannerType,jdbcType=CHAR},
253
+      external_link = #{externalLink,jdbcType=VARCHAR},
254
+      banner_title = #{bannerTitle,jdbcType=VARCHAR},
255
+      create_user = #{createUser,jdbcType=INTEGER},
256
+      create_date = #{createDate,jdbcType=TIMESTAMP},
257
+      update_user = #{updateUser,jdbcType=INTEGER},
258
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
259
+    where id = #{id,jdbcType=INTEGER}
260
+  </update>
261
+
262
+  <select id="selectBanner" parameterType="com.community.huiju.model.ToBanner" resultMap="BaseResultMap" >
263
+    select
264
+    <include refid="Base_Column_List" />
265
+    ,
266
+    <include refid="Blob_Column_List" />
267
+    from to_banner
268
+    <trim prefix="where" prefixOverrides="and">
269
+      <if test="title != null">
270
+       and title = #{title,jdbcType=VARCHAR}
271
+      </if>
272
+      <if test="bannerDescription != null">
273
+       and banner_description = #{bannerDescription,jdbcType=VARCHAR}
274
+      </if>
275
+      <if test="bannerPosition != null">
276
+       and banner_position = #{bannerPosition,jdbcType=INTEGER}
277
+      </if>
278
+    </trim>
279
+  </select>
280
+</mapper>

+ 128
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToSysMenuMapper.xml Ver fichero

@@ -0,0 +1,128 @@
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.community.huiju.dao.ToSysMenuMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.ToSysMenu" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="menu_name" property="menuName" jdbcType="VARCHAR" />
7
+    <result column="menu_url" property="menuUrl" jdbcType="VARCHAR" />
8
+    <result column="menu_icon" property="menuIcon" jdbcType="VARCHAR" />
9
+    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
10
+    <result column="sort" property="sort" jdbcType="INTEGER" />
11
+    <result column="menu_type" property="menuType" jdbcType="CHAR" />
12
+    <result column="status" property="status" jdbcType="CHAR" />
13
+  </resultMap>
14
+  <sql id="Base_Column_List" >
15
+    id, menu_name, menu_url, menu_icon, parent_id, sort, menu_type, status
16
+  </sql>
17
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
18
+    select 
19
+    <include refid="Base_Column_List" />
20
+    from to_sys_menu
21
+    where id = #{id,jdbcType=INTEGER}
22
+  </select>
23
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
24
+    delete from to_sys_menu
25
+    where id = #{id,jdbcType=INTEGER}
26
+  </delete>
27
+  <insert id="insert" parameterType="com.community.huiju.model.ToSysMenu" >
28
+    insert into to_sys_menu (id, menu_name, menu_url, 
29
+      menu_icon, parent_id, sort, 
30
+      menu_type, status)
31
+    values (#{id,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, 
32
+      #{menuIcon,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, 
33
+      #{menuType,jdbcType=CHAR}, #{status,jdbcType=CHAR})
34
+  </insert>
35
+  <insert id="insertSelective" parameterType="com.community.huiju.model.ToSysMenu" >
36
+    insert into to_sys_menu
37
+    <trim prefix="(" suffix=")" suffixOverrides="," >
38
+      <if test="id != null" >
39
+        id,
40
+      </if>
41
+      <if test="menuName != null" >
42
+        menu_name,
43
+      </if>
44
+      <if test="menuUrl != null" >
45
+        menu_url,
46
+      </if>
47
+      <if test="menuIcon != null" >
48
+        menu_icon,
49
+      </if>
50
+      <if test="parentId != null" >
51
+        parent_id,
52
+      </if>
53
+      <if test="sort != null" >
54
+        sort,
55
+      </if>
56
+      <if test="menuType != null" >
57
+        menu_type,
58
+      </if>
59
+      <if test="status != null" >
60
+        status,
61
+      </if>
62
+    </trim>
63
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
64
+      <if test="id != null" >
65
+        #{id,jdbcType=INTEGER},
66
+      </if>
67
+      <if test="menuName != null" >
68
+        #{menuName,jdbcType=VARCHAR},
69
+      </if>
70
+      <if test="menuUrl != null" >
71
+        #{menuUrl,jdbcType=VARCHAR},
72
+      </if>
73
+      <if test="menuIcon != null" >
74
+        #{menuIcon,jdbcType=VARCHAR},
75
+      </if>
76
+      <if test="parentId != null" >
77
+        #{parentId,jdbcType=INTEGER},
78
+      </if>
79
+      <if test="sort != null" >
80
+        #{sort,jdbcType=INTEGER},
81
+      </if>
82
+      <if test="menuType != null" >
83
+        #{menuType,jdbcType=CHAR},
84
+      </if>
85
+      <if test="status != null" >
86
+        #{status,jdbcType=CHAR},
87
+      </if>
88
+    </trim>
89
+  </insert>
90
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToSysMenu" >
91
+    update to_sys_menu
92
+    <set >
93
+      <if test="menuName != null" >
94
+        menu_name = #{menuName,jdbcType=VARCHAR},
95
+      </if>
96
+      <if test="menuUrl != null" >
97
+        menu_url = #{menuUrl,jdbcType=VARCHAR},
98
+      </if>
99
+      <if test="menuIcon != null" >
100
+        menu_icon = #{menuIcon,jdbcType=VARCHAR},
101
+      </if>
102
+      <if test="parentId != null" >
103
+        parent_id = #{parentId,jdbcType=INTEGER},
104
+      </if>
105
+      <if test="sort != null" >
106
+        sort = #{sort,jdbcType=INTEGER},
107
+      </if>
108
+      <if test="menuType != null" >
109
+        menu_type = #{menuType,jdbcType=CHAR},
110
+      </if>
111
+      <if test="status != null" >
112
+        status = #{status,jdbcType=CHAR},
113
+      </if>
114
+    </set>
115
+    where id = #{id,jdbcType=INTEGER}
116
+  </update>
117
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.ToSysMenu" >
118
+    update to_sys_menu
119
+    set menu_name = #{menuName,jdbcType=VARCHAR},
120
+      menu_url = #{menuUrl,jdbcType=VARCHAR},
121
+      menu_icon = #{menuIcon,jdbcType=VARCHAR},
122
+      parent_id = #{parentId,jdbcType=INTEGER},
123
+      sort = #{sort,jdbcType=INTEGER},
124
+      menu_type = #{menuType,jdbcType=CHAR},
125
+      status = #{status,jdbcType=CHAR}
126
+    where id = #{id,jdbcType=INTEGER}
127
+  </update>
128
+</mapper>

+ 128
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToSysRoleMapper.xml Ver fichero

@@ -0,0 +1,128 @@
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.community.huiju.dao.ToSysRoleMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.ToSysRole" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="role_name" property="roleName" jdbcType="VARCHAR" />
7
+    <result column="description" property="description" jdbcType="VARCHAR" />
8
+    <result column="status" property="status" jdbcType="CHAR" />
9
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
10
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
11
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
12
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
13
+  </resultMap>
14
+  <sql id="Base_Column_List" >
15
+    id, role_name, description, status, create_user, create_date, update_user, update_date
16
+  </sql>
17
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
18
+    select 
19
+    <include refid="Base_Column_List" />
20
+    from to_sys_role
21
+    where id = #{id,jdbcType=INTEGER}
22
+  </select>
23
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
24
+    delete from to_sys_role
25
+    where id = #{id,jdbcType=INTEGER}
26
+  </delete>
27
+  <insert id="insert" parameterType="com.community.huiju.model.ToSysRole" >
28
+    insert into to_sys_role (id, role_name, description, 
29
+      status, create_user, create_date, 
30
+      update_user, update_date)
31
+    values (#{id,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, 
32
+      #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
33
+      #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
34
+  </insert>
35
+  <insert id="insertSelective" parameterType="com.community.huiju.model.ToSysRole" >
36
+    insert into to_sys_role
37
+    <trim prefix="(" suffix=")" suffixOverrides="," >
38
+      <if test="id != null" >
39
+        id,
40
+      </if>
41
+      <if test="roleName != null" >
42
+        role_name,
43
+      </if>
44
+      <if test="description != null" >
45
+        description,
46
+      </if>
47
+      <if test="status != null" >
48
+        status,
49
+      </if>
50
+      <if test="createUser != null" >
51
+        create_user,
52
+      </if>
53
+      <if test="createDate != null" >
54
+        create_date,
55
+      </if>
56
+      <if test="updateUser != null" >
57
+        update_user,
58
+      </if>
59
+      <if test="updateDate != null" >
60
+        update_date,
61
+      </if>
62
+    </trim>
63
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
64
+      <if test="id != null" >
65
+        #{id,jdbcType=INTEGER},
66
+      </if>
67
+      <if test="roleName != null" >
68
+        #{roleName,jdbcType=VARCHAR},
69
+      </if>
70
+      <if test="description != null" >
71
+        #{description,jdbcType=VARCHAR},
72
+      </if>
73
+      <if test="status != null" >
74
+        #{status,jdbcType=CHAR},
75
+      </if>
76
+      <if test="createUser != null" >
77
+        #{createUser,jdbcType=INTEGER},
78
+      </if>
79
+      <if test="createDate != null" >
80
+        #{createDate,jdbcType=TIMESTAMP},
81
+      </if>
82
+      <if test="updateUser != null" >
83
+        #{updateUser,jdbcType=INTEGER},
84
+      </if>
85
+      <if test="updateDate != null" >
86
+        #{updateDate,jdbcType=TIMESTAMP},
87
+      </if>
88
+    </trim>
89
+  </insert>
90
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToSysRole" >
91
+    update to_sys_role
92
+    <set >
93
+      <if test="roleName != null" >
94
+        role_name = #{roleName,jdbcType=VARCHAR},
95
+      </if>
96
+      <if test="description != null" >
97
+        description = #{description,jdbcType=VARCHAR},
98
+      </if>
99
+      <if test="status != null" >
100
+        status = #{status,jdbcType=CHAR},
101
+      </if>
102
+      <if test="createUser != null" >
103
+        create_user = #{createUser,jdbcType=INTEGER},
104
+      </if>
105
+      <if test="createDate != null" >
106
+        create_date = #{createDate,jdbcType=TIMESTAMP},
107
+      </if>
108
+      <if test="updateUser != null" >
109
+        update_user = #{updateUser,jdbcType=INTEGER},
110
+      </if>
111
+      <if test="updateDate != null" >
112
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
113
+      </if>
114
+    </set>
115
+    where id = #{id,jdbcType=INTEGER}
116
+  </update>
117
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.ToSysRole" >
118
+    update to_sys_role
119
+    set role_name = #{roleName,jdbcType=VARCHAR},
120
+      description = #{description,jdbcType=VARCHAR},
121
+      status = #{status,jdbcType=CHAR},
122
+      create_user = #{createUser,jdbcType=INTEGER},
123
+      create_date = #{createDate,jdbcType=TIMESTAMP},
124
+      update_user = #{updateUser,jdbcType=INTEGER},
125
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
126
+    where id = #{id,jdbcType=INTEGER}
127
+  </update>
128
+</mapper>

+ 71
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToSysRoleMenuMapper.xml Ver fichero

@@ -0,0 +1,71 @@
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.community.huiju.dao.ToSysRoleMenuMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.ToSysRoleMenu" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="role_id" property="roleId" jdbcType="INTEGER" />
7
+    <result column="menu_id" property="menuId" jdbcType="INTEGER" />
8
+  </resultMap>
9
+  <sql id="Base_Column_List" >
10
+    id, role_id, menu_id
11
+  </sql>
12
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
13
+    select 
14
+    <include refid="Base_Column_List" />
15
+    from to_sys_role_menu
16
+    where id = #{id,jdbcType=INTEGER}
17
+  </select>
18
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
19
+    delete from to_sys_role_menu
20
+    where id = #{id,jdbcType=INTEGER}
21
+  </delete>
22
+  <insert id="insert" parameterType="com.community.huiju.model.ToSysRoleMenu" >
23
+    insert into to_sys_role_menu (id, role_id, menu_id
24
+      )
25
+    values (#{id,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}, #{menuId,jdbcType=INTEGER}
26
+      )
27
+  </insert>
28
+  <insert id="insertSelective" parameterType="com.community.huiju.model.ToSysRoleMenu" >
29
+    insert into to_sys_role_menu
30
+    <trim prefix="(" suffix=")" suffixOverrides="," >
31
+      <if test="id != null" >
32
+        id,
33
+      </if>
34
+      <if test="roleId != null" >
35
+        role_id,
36
+      </if>
37
+      <if test="menuId != null" >
38
+        menu_id,
39
+      </if>
40
+    </trim>
41
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
42
+      <if test="id != null" >
43
+        #{id,jdbcType=INTEGER},
44
+      </if>
45
+      <if test="roleId != null" >
46
+        #{roleId,jdbcType=INTEGER},
47
+      </if>
48
+      <if test="menuId != null" >
49
+        #{menuId,jdbcType=INTEGER},
50
+      </if>
51
+    </trim>
52
+  </insert>
53
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToSysRoleMenu" >
54
+    update to_sys_role_menu
55
+    <set >
56
+      <if test="roleId != null" >
57
+        role_id = #{roleId,jdbcType=INTEGER},
58
+      </if>
59
+      <if test="menuId != null" >
60
+        menu_id = #{menuId,jdbcType=INTEGER},
61
+      </if>
62
+    </set>
63
+    where id = #{id,jdbcType=INTEGER}
64
+  </update>
65
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.ToSysRoleMenu" >
66
+    update to_sys_role_menu
67
+    set role_id = #{roleId,jdbcType=INTEGER},
68
+      menu_id = #{menuId,jdbcType=INTEGER}
69
+    where id = #{id,jdbcType=INTEGER}
70
+  </update>
71
+</mapper>

+ 71
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToSysUserRoleMapper.xml Ver fichero

@@ -0,0 +1,71 @@
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.community.huiju.dao.ToSysUserRoleMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.ToSysUserRole" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="user_id" property="userId" jdbcType="INTEGER" />
7
+    <result column="role_id" property="roleId" jdbcType="INTEGER" />
8
+  </resultMap>
9
+  <sql id="Base_Column_List" >
10
+    id, user_id, role_id
11
+  </sql>
12
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
13
+    select 
14
+    <include refid="Base_Column_List" />
15
+    from to_sys_user_role
16
+    where id = #{id,jdbcType=INTEGER}
17
+  </select>
18
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
19
+    delete from to_sys_user_role
20
+    where id = #{id,jdbcType=INTEGER}
21
+  </delete>
22
+  <insert id="insert" parameterType="com.community.huiju.model.ToSysUserRole" >
23
+    insert into to_sys_user_role (id, user_id, role_id
24
+      )
25
+    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}
26
+      )
27
+  </insert>
28
+  <insert id="insertSelective" parameterType="com.community.huiju.model.ToSysUserRole" >
29
+    insert into to_sys_user_role
30
+    <trim prefix="(" suffix=")" suffixOverrides="," >
31
+      <if test="id != null" >
32
+        id,
33
+      </if>
34
+      <if test="userId != null" >
35
+        user_id,
36
+      </if>
37
+      <if test="roleId != null" >
38
+        role_id,
39
+      </if>
40
+    </trim>
41
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
42
+      <if test="id != null" >
43
+        #{id,jdbcType=INTEGER},
44
+      </if>
45
+      <if test="userId != null" >
46
+        #{userId,jdbcType=INTEGER},
47
+      </if>
48
+      <if test="roleId != null" >
49
+        #{roleId,jdbcType=INTEGER},
50
+      </if>
51
+    </trim>
52
+  </insert>
53
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToSysUserRole" >
54
+    update to_sys_user_role
55
+    <set >
56
+      <if test="userId != null" >
57
+        user_id = #{userId,jdbcType=INTEGER},
58
+      </if>
59
+      <if test="roleId != null" >
60
+        role_id = #{roleId,jdbcType=INTEGER},
61
+      </if>
62
+    </set>
63
+    where id = #{id,jdbcType=INTEGER}
64
+  </update>
65
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.ToSysUserRole" >
66
+    update to_sys_user_role
67
+    set user_id = #{userId,jdbcType=INTEGER},
68
+      role_id = #{roleId,jdbcType=INTEGER}
69
+    where id = #{id,jdbcType=INTEGER}
70
+  </update>
71
+</mapper>

+ 184
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/ToUserMapper.xml Ver fichero

@@ -0,0 +1,184 @@
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.community.huiju.dao.ToUserMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.ToUser" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
7
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
8
+    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
9
+    <result column="email" property="email" jdbcType="VARCHAR" />
10
+    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
11
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
12
+    <result column="status" property="status" jdbcType="CHAR" />
13
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
14
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
15
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
16
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
17
+  </resultMap>
18
+  <sql id="Base_Column_List" >
19
+    id, user_name, login_name, login_password, email, head_portrait, remark, status, 
20
+    create_user, create_date, update_user, update_date
21
+  </sql>
22
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
23
+    select 
24
+    <include refid="Base_Column_List" />
25
+    from to_user
26
+    where id = #{id,jdbcType=INTEGER}
27
+  </select>
28
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
29
+    delete from to_user
30
+    where id = #{id,jdbcType=INTEGER}
31
+  </delete>
32
+  <insert id="insert" parameterType="com.community.huiju.model.ToUser" >
33
+    insert into to_user (id, user_name, login_name, 
34
+      login_password, email, head_portrait, 
35
+      remark, status, create_user, 
36
+      create_date, update_user, update_date
37
+      )
38
+    values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR}, 
39
+      #{loginPassword,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{headPortrait,jdbcType=VARCHAR}, 
40
+      #{remark,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, 
41
+      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP}
42
+      )
43
+  </insert>
44
+  <insert id="insertSelective" parameterType="com.community.huiju.model.ToUser" >
45
+    insert into to_user
46
+    <trim prefix="(" suffix=")" suffixOverrides="," >
47
+      <if test="id != null" >
48
+        id,
49
+      </if>
50
+      <if test="userName != null" >
51
+        user_name,
52
+      </if>
53
+      <if test="loginName != null" >
54
+        login_name,
55
+      </if>
56
+      <if test="loginPassword != null" >
57
+        login_password,
58
+      </if>
59
+      <if test="email != null" >
60
+        email,
61
+      </if>
62
+      <if test="headPortrait != null" >
63
+        head_portrait,
64
+      </if>
65
+      <if test="remark != null" >
66
+        remark,
67
+      </if>
68
+      <if test="status != null" >
69
+        status,
70
+      </if>
71
+      <if test="createUser != null" >
72
+        create_user,
73
+      </if>
74
+      <if test="createDate != null" >
75
+        create_date,
76
+      </if>
77
+      <if test="updateUser != null" >
78
+        update_user,
79
+      </if>
80
+      <if test="updateDate != null" >
81
+        update_date,
82
+      </if>
83
+    </trim>
84
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
85
+      <if test="id != null" >
86
+        #{id,jdbcType=INTEGER},
87
+      </if>
88
+      <if test="userName != null" >
89
+        #{userName,jdbcType=VARCHAR},
90
+      </if>
91
+      <if test="loginName != null" >
92
+        #{loginName,jdbcType=VARCHAR},
93
+      </if>
94
+      <if test="loginPassword != null" >
95
+        #{loginPassword,jdbcType=VARCHAR},
96
+      </if>
97
+      <if test="email != null" >
98
+        #{email,jdbcType=VARCHAR},
99
+      </if>
100
+      <if test="headPortrait != null" >
101
+        #{headPortrait,jdbcType=VARCHAR},
102
+      </if>
103
+      <if test="remark != null" >
104
+        #{remark,jdbcType=VARCHAR},
105
+      </if>
106
+      <if test="status != null" >
107
+        #{status,jdbcType=CHAR},
108
+      </if>
109
+      <if test="createUser != null" >
110
+        #{createUser,jdbcType=INTEGER},
111
+      </if>
112
+      <if test="createDate != null" >
113
+        #{createDate,jdbcType=TIMESTAMP},
114
+      </if>
115
+      <if test="updateUser != null" >
116
+        #{updateUser,jdbcType=INTEGER},
117
+      </if>
118
+      <if test="updateDate != null" >
119
+        #{updateDate,jdbcType=TIMESTAMP},
120
+      </if>
121
+    </trim>
122
+  </insert>
123
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToUser" >
124
+    update to_user
125
+    <set >
126
+      <if test="userName != null" >
127
+        user_name = #{userName,jdbcType=VARCHAR},
128
+      </if>
129
+      <if test="loginName != null" >
130
+        login_name = #{loginName,jdbcType=VARCHAR},
131
+      </if>
132
+      <if test="loginPassword != null" >
133
+        login_password = #{loginPassword,jdbcType=VARCHAR},
134
+      </if>
135
+      <if test="email != null" >
136
+        email = #{email,jdbcType=VARCHAR},
137
+      </if>
138
+      <if test="headPortrait != null" >
139
+        head_portrait = #{headPortrait,jdbcType=VARCHAR},
140
+      </if>
141
+      <if test="remark != null" >
142
+        remark = #{remark,jdbcType=VARCHAR},
143
+      </if>
144
+      <if test="status != null" >
145
+        status = #{status,jdbcType=CHAR},
146
+      </if>
147
+      <if test="createUser != null" >
148
+        create_user = #{createUser,jdbcType=INTEGER},
149
+      </if>
150
+      <if test="createDate != null" >
151
+        create_date = #{createDate,jdbcType=TIMESTAMP},
152
+      </if>
153
+      <if test="updateUser != null" >
154
+        update_user = #{updateUser,jdbcType=INTEGER},
155
+      </if>
156
+      <if test="updateDate != null" >
157
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
158
+      </if>
159
+    </set>
160
+    where id = #{id,jdbcType=INTEGER}
161
+  </update>
162
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.ToUser" >
163
+    update to_user
164
+    set user_name = #{userName,jdbcType=VARCHAR},
165
+      login_name = #{loginName,jdbcType=VARCHAR},
166
+      login_password = #{loginPassword,jdbcType=VARCHAR},
167
+      email = #{email,jdbcType=VARCHAR},
168
+      head_portrait = #{headPortrait,jdbcType=VARCHAR},
169
+      remark = #{remark,jdbcType=VARCHAR},
170
+      status = #{status,jdbcType=CHAR},
171
+      create_user = #{createUser,jdbcType=INTEGER},
172
+      create_date = #{createDate,jdbcType=TIMESTAMP},
173
+      update_user = #{updateUser,jdbcType=INTEGER},
174
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
175
+    where id = #{id,jdbcType=INTEGER}
176
+  </update>
177
+
178
+  <select id="selectByLoginName" parameterType="string" resultMap="BaseResultMap" >
179
+    select
180
+    <include refid="Base_Column_List"/>
181
+    from to_user where login_name = #{loginName,jdbcType=VARCHAR}
182
+  </select>
183
+
184
+</mapper>