dingxin 6 vuotta sitten
vanhempi
commit
6af04ec29a

+ 45
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AgreementController.java Näytä tiedosto

@@ -0,0 +1,45 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.model.TaAgreement;
5
+import com.community.huiju.service.AgreementServicel;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import java.util.List;
17
+
18
+/**
19
+ * version V1.0
20
+ * class_name: $METHOD_NAME$
21
+ * param: $METHOD_PARAM$
22
+ * describe: TODO
23
+ * creat_user:fannaixi
24
+ * creat_time: 2018/10/22
25
+ **/
26
+
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api("app端协议相关的API")
31
+public class AgreementController {
32
+
33
+    @Autowired
34
+    private AgreementServicel agreementService;
35
+
36
+    @ApiOperation(value = "获取所有协议", notes = "获取所有协议")
37
+    @RequestMapping(value = "/agreement",method = RequestMethod.GET)
38
+    public ResponseBean getAgreement(){
39
+        ResponseBean responseBean = new ResponseBean();
40
+        TaAgreement agreement = agreementService.getAgreement();
41
+        responseBean.addSuccess(agreement);
42
+        return responseBean;
43
+    }
44
+
45
+}

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaAgreementMapper.java Näytä tiedosto

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

+ 27
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaAgreement.java Näytä tiedosto

@@ -0,0 +1,27 @@
1
+ package com.community.huiju.model;
2
+import jdk.nashorn.internal.objects.annotations.Getter;
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+
8
+@Data
9
+@AllArgsConstructor
10
+@NoArgsConstructor
11
+public class TaAgreement {
12
+    /**
13
+     * 协议Id
14
+     */
15
+    private Integer id;
16
+
17
+    /**
18
+     * 用户协议信息
19
+     */
20
+    private  String userAgreement;
21
+
22
+    /**
23
+     *保护声明
24
+     */
25
+    private  String urotectionStatement;
26
+
27
+}

+ 29
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/AgreementServicel.java Näytä tiedosto

@@ -0,0 +1,29 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.huiju.model.TaAgreement;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * version V1.0
9
+ * class_name: $METHOD_NAME$
10
+ * param: $METHOD_PARAM$
11
+ * describe: TODO
12
+ * creat_user:fannaixi
13
+ * creat_time: 2018/10/22
14
+ **/
15
+public interface AgreementServicel {
16
+    int deleteByPrimaryKey(Integer id);
17
+
18
+    int insert(TaAgreement record);
19
+
20
+    int insertSelective(TaAgreement record);
21
+
22
+    TaAgreement selectByPrimaryKey(Integer id);
23
+
24
+    int updateByPrimaryKeySelective(TaAgreement record);
25
+
26
+    int updateByPrimaryKey(TaAgreement record);
27
+
28
+    TaAgreement getAgreement();
29
+}

+ 55
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/AgreementServiceimpl.java Näytä tiedosto

@@ -0,0 +1,55 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.dao.TaAgreementMapper;
4
+import com.community.huiju.model.TaAgreement;
5
+import com.community.huiju.service.AgreementServicel;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.stereotype.Service;
8
+
9
+import java.util.List;
10
+
11
+@Service("agreementService")
12
+public class AgreementServiceimpl implements AgreementServicel {
13
+
14
+    @Autowired
15
+    private TaAgreementMapper agreementMapper;
16
+
17
+    @Override
18
+    public int deleteByPrimaryKey(Integer id) {
19
+        return agreementMapper.deleteByPrimaryKey(id);
20
+    }
21
+
22
+    @Override
23
+    public int insert(TaAgreement record) {
24
+        return agreementMapper.insert(record);
25
+    }
26
+
27
+    @Override
28
+    public int insertSelective(TaAgreement record) {
29
+        return agreementMapper.insertSelective(record);
30
+    }
31
+
32
+    @Override
33
+    public TaAgreement selectByPrimaryKey(Integer id) {
34
+        return agreementMapper.selectByPrimaryKey(id);
35
+    }
36
+
37
+    @Override
38
+    public int updateByPrimaryKeySelective(TaAgreement record) {
39
+        return agreementMapper.updateByPrimaryKeySelective(record);
40
+    }
41
+
42
+    @Override
43
+    public int updateByPrimaryKey(TaAgreement record) {
44
+        return agreementMapper.updateByPrimaryKey(record);
45
+    }
46
+
47
+    /**
48
+     *
49
+     * @return
50
+     */
51
+    @Override
52
+    public TaAgreement getAgreement() {
53
+        return agreementMapper.getAgreement();
54
+    }
55
+}

+ 76
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaAgreementMapper.xml Näytä tiedosto

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