瀏覽代碼

提交分支

魏超 6 年之前
父節點
當前提交
7d2ec87dd0

+ 45
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MenuController.java 查看文件

@@ -0,0 +1,45 @@
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.TaSysMenu;
7
+import com.community.huiju.service.MenuServiceI;
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.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.RestController;
18
+
19
+import javax.servlet.http.HttpSession;
20
+import java.util.List;
21
+import java.util.Map;
22
+
23
+/**
24
+ * @author FXF
25
+ * @date 2018-11-05
26
+ */
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api(value = "菜单API", description = "菜单API")
31
+public class MenuController {
32
+	
33
+	@Autowired
34
+	private MenuServiceI menuService;
35
+	
36
+	@ApiOperation(value = "按小区获取菜单列表", notes = "按小区获取菜单列表")
37
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id")})
38
+	@RequestMapping(value = "/menus/{communityId}",method = RequestMethod.GET)
39
+	public ResponseBean getMenuList(@PathVariable Integer communityId, HttpSession session){
40
+		ResponseBean responseBean = new ResponseBean();
41
+		List<TaSysMenu> list = menuService.getMenuList(communityId);
42
+		responseBean.addSuccess(list);
43
+		return responseBean;
44
+	}
45
+}

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysMenuImgMapper.java 查看文件

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

+ 29
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysMenuMapper.java 查看文件

@@ -0,0 +1,29 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaSysMenu;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TaSysMenuMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TaSysMenu record);
14
+
15
+    int insertSelective(TaSysMenu record);
16
+
17
+    TaSysMenu selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TaSysMenu record);
20
+
21
+    int updateByPrimaryKey(TaSysMenu record);
22
+    
23
+    /**
24
+     * 获取菜单列表
25
+     * @param communityId
26
+     * @return
27
+     */
28
+    List<TaSysMenu> selectByCommunity(@Param("communityId") Integer communityId);
29
+}

+ 95
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenu.java 查看文件

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

+ 33
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenuImg.java 查看文件

@@ -0,0 +1,33 @@
1
+package com.community.huiju.model;
2
+
3
+public class TaSysMenuImg {
4
+    private Integer id;
5
+
6
+    private Integer taMenuId;
7
+
8
+    private String menuIconImg;
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 getTaMenuId() {
19
+        return taMenuId;
20
+    }
21
+
22
+    public void setTaMenuId(Integer taMenuId) {
23
+        this.taMenuId = taMenuId;
24
+    }
25
+
26
+    public String getMenuIconImg() {
27
+        return menuIconImg;
28
+    }
29
+
30
+    public void setMenuIconImg(String menuIconImg) {
31
+        this.menuIconImg = menuIconImg == null ? null : menuIconImg.trim();
32
+    }
33
+}

+ 15
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MenuServiceI.java 查看文件

@@ -0,0 +1,15 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.huiju.model.TaSysMenu;
4
+
5
+import java.util.List;
6
+
7
+public interface MenuServiceI {
8
+	
9
+	/**
10
+	 * 获取菜单列表
11
+	 * @param communityId
12
+	 * @return
13
+	 */
14
+	List<TaSysMenu> getMenuList(Integer communityId);
15
+}

+ 41
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MenuServiceImpl.java 查看文件

@@ -0,0 +1,41 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.dao.TaSysMenuImgMapper;
4
+import com.community.huiju.dao.TaSysMenuMapper;
5
+import com.community.huiju.model.TaSysMenu;
6
+import com.community.huiju.model.TaSysMenuImg;
7
+import com.community.huiju.service.MenuServiceI;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+
13
+/**
14
+ * @author FXF
15
+ * @date 2018-11-05
16
+ */
17
+@Service("menuService")
18
+public class MenuServiceImpl implements MenuServiceI {
19
+	
20
+	@Autowired
21
+	private TaSysMenuMapper taSysMenuMapper;
22
+	
23
+	@Autowired
24
+	private TaSysMenuImgMapper taSysMenuImgMapper;
25
+	
26
+	/**
27
+	 * 获取菜单列表
28
+	 * @param communityId
29
+	 * @return
30
+	 */
31
+	@Override
32
+	public List<TaSysMenu> getMenuList(Integer communityId) {
33
+		//获取菜单列表
34
+		List<TaSysMenu> menuList = taSysMenuMapper.selectByCommunity(communityId);
35
+		menuList.stream().forEach(menu -> {
36
+			List<TaSysMenuImg> menuImgList = taSysMenuImgMapper.selectByMenuId(menu.getId());
37
+			menu.setMenuImgList(menuImgList);
38
+		});
39
+		return menuList;
40
+	}
41
+}

+ 78
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuImgMapper.xml 查看文件

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

+ 135
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuMapper.xml 查看文件

@@ -0,0 +1,135 @@
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.TaSysMenuMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaSysMenu" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="menu_name" property="menuName" jdbcType="VARCHAR" />
8
+    <result column="menu_url" property="menuUrl" 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, community_id, menu_name, menu_url, 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 ta_sys_menu
21
+    where id = #{id,jdbcType=INTEGER}
22
+  </select>
23
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
24
+    delete from ta_sys_menu
25
+    where id = #{id,jdbcType=INTEGER}
26
+  </delete>
27
+  <insert id="insert" parameterType="com.community.huiju.model.TaSysMenu" >
28
+    insert into ta_sys_menu (id, community_id, menu_name, 
29
+      menu_url, parent_id, sort, 
30
+      menu_type, status)
31
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, 
32
+      #{menuUrl,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.TaSysMenu" >
36
+    insert into ta_sys_menu
37
+    <trim prefix="(" suffix=")" suffixOverrides="," >
38
+      <if test="id != null" >
39
+        id,
40
+      </if>
41
+      <if test="communityId != null" >
42
+        community_id,
43
+      </if>
44
+      <if test="menuName != null" >
45
+        menu_name,
46
+      </if>
47
+      <if test="menuUrl != null" >
48
+        menu_url,
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="communityId != null" >
68
+        #{communityId,jdbcType=INTEGER},
69
+      </if>
70
+      <if test="menuName != null" >
71
+        #{menuName,jdbcType=VARCHAR},
72
+      </if>
73
+      <if test="menuUrl != null" >
74
+        #{menuUrl,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.TaSysMenu" >
91
+    update ta_sys_menu
92
+    <set >
93
+      <if test="communityId != null" >
94
+        community_id = #{communityId,jdbcType=INTEGER},
95
+      </if>
96
+      <if test="menuName != null" >
97
+        menu_name = #{menuName,jdbcType=VARCHAR},
98
+      </if>
99
+      <if test="menuUrl != null" >
100
+        menu_url = #{menuUrl,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.TaSysMenu" >
118
+    update ta_sys_menu
119
+    set community_id = #{communityId,jdbcType=INTEGER},
120
+      menu_name = #{menuName,jdbcType=VARCHAR},
121
+      menu_url = #{menuUrl,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
+
129
+  <select id="selectByCommunity" resultMap="BaseResultMap">
130
+    select
131
+    <include refid="Base_Column_List" />
132
+    from ta_sys_menu
133
+    where community_id = #{communityId,jdbcType=INTEGER}
134
+  </select>
135
+</mapper>

+ 973
- 680
文档/MYSQL/smartCommunity.pdb
文件差異過大導致無法顯示
查看文件