傅行帆 6 years ago
parent
commit
d637c6ad43

+ 20
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TaSysMenuMapper.java View File

@@ -0,0 +1,20 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaSysMenu;
4
+import com.community.huiju.model.TaSysMenuImg;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
9
+
10
+@Mapper
11
+public interface TaSysMenuMapper {
12
+	
13
+	List<TaSysMenu> getTaSysMenuListByCommunityId();
14
+	
15
+	int insertTaSysMenu(TaSysMenu taSysMenu);
16
+	
17
+	List<TaSysMenuImg> selectTaSysMenuImgById(@Param("taMenuId") Integer taMenuId);
18
+	
19
+	int batchInsertImg(List<TaSysMenuImg> imgList);
20
+}

+ 72
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TaSysMenu.java View File

@@ -0,0 +1,72 @@
1
+package com.community.huiju.model;
2
+
3
+import lombok.Data;
4
+import lombok.EqualsAndHashCode;
5
+import lombok.experimental.Accessors;
6
+
7
+import java.io.Serializable;
8
+
9
+/**
10
+ * <p>
11
+ * APP端菜单页面
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2019-03-06
16
+ */
17
+@Data
18
+@EqualsAndHashCode(callSuper = false)
19
+@Accessors(chain = true)
20
+public class TaSysMenu implements Serializable {
21
+
22
+    private static final long serialVersionUID = 1L;
23
+
24
+    private Integer id;
25
+    
26
+    /**
27
+     * 小区id
28
+     */
29
+    private Integer communityId;
30
+
31
+    /**
32
+     * 菜单名称
33
+     */
34
+    private String menuName;
35
+
36
+    /**
37
+     * 菜单链接
38
+     */
39
+    private String menuUrl;
40
+
41
+    /**
42
+     * 父级菜单ID
43
+     */
44
+    private Integer parentId;
45
+
46
+    /**
47
+     * 排序
48
+     */
49
+    private Integer sort;
50
+
51
+    /**
52
+     * 菜单类型 0 H5  1原生开发
53
+     */
54
+    private String menuType;
55
+
56
+    /**
57
+     * 状态 0正常 1 是停用 9 删除
58
+     */
59
+    private String status;
60
+
61
+    /**
62
+     * face 代表人脸录入  monitor 代表是 公区监控
63
+     */
64
+    private String remark;
65
+
66
+    /**
67
+     * 说明
68
+     */
69
+    private String explain;
70
+
71
+
72
+}

+ 30
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TaSysMenuImg.java View File

@@ -0,0 +1,30 @@
1
+package com.community.huiju.model;
2
+
3
+import lombok.Data;
4
+import lombok.EqualsAndHashCode;
5
+import lombok.experimental.Accessors;
6
+
7
+import java.io.Serializable;
8
+
9
+/**
10
+ * <p>
11
+ * APP端菜单页面
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2019-03-06
16
+ */
17
+@Data
18
+@EqualsAndHashCode(callSuper = false)
19
+@Accessors(chain = true)
20
+public class TaSysMenuImg implements Serializable {
21
+
22
+    private static final long serialVersionUID = 1L;
23
+
24
+    private Integer id;
25
+    
26
+    private Integer taMenuId;
27
+    
28
+    private String menuIconImg;
29
+    
30
+}

+ 27
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java View File

@@ -1,9 +1,12 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3 3
 import com.community.commom.constant.Constant;
4
+import com.community.huiju.dao.TaSysMenuMapper;
4 5
 import com.community.huiju.dao.ToCommunitiesMapper;
5 6
 import com.community.huiju.dao.TpUserCommunityMapper;
6 7
 import com.community.huiju.dao.TpUserMapper;
8
+import com.community.huiju.model.TaSysMenu;
9
+import com.community.huiju.model.TaSysMenuImg;
7 10
 import com.community.huiju.model.ToCommunities;
8 11
 import com.community.huiju.model.TpSysMenu;
9 12
 import com.community.huiju.model.TpSysRole;
@@ -40,6 +43,9 @@ public class CommunityServiceImpl implements CommunityServiceI {
40 43
 	@Autowired
41 44
 	private TpUserCommunityMapper tpUserCommunityMapper;
42 45
 	
46
+	@Autowired
47
+	private TaSysMenuMapper taSysMenuMapper;
48
+	
43 49
 	/**
44 50
 	 * 分页获取小区列表
45 51
 	 * @param toCommunities
@@ -89,7 +95,27 @@ public class CommunityServiceImpl implements CommunityServiceI {
89 95
 	 * @param communityId
90 96
 	 */
91 97
 	private void addAppMenu(Integer communityId) {
92
-	
98
+		List<TaSysMenu>  list = taSysMenuMapper.getTaSysMenuListByCommunityId();
99
+		list.stream().forEach(e -> {
100
+			//插入APP菜单
101
+			TaSysMenu taSysMenu = new TaSysMenu();
102
+			taSysMenu.setCommunityId(communityId);
103
+			taSysMenu.setExplain(e.getExplain());
104
+			taSysMenu.setMenuName(e.getMenuName());
105
+			taSysMenu.setMenuType(e.getMenuType());
106
+			taSysMenu.setMenuUrl(e.getMenuUrl());
107
+			taSysMenu.setRemark(e.getRemark());
108
+			taSysMenu.setSort(e.getSort());
109
+			taSysMenu.setStatus("0");
110
+			taSysMenuMapper.insertTaSysMenu(taSysMenu);
111
+			//插入图标
112
+			List<TaSysMenuImg> imgList =  taSysMenuMapper.selectTaSysMenuImgById(e.getId());
113
+			imgList.stream().forEach(img -> {
114
+				img.setTaMenuId(taSysMenu.getId());
115
+			});
116
+			taSysMenuMapper.batchInsertImg(imgList);
117
+		});
118
+		
93 119
 	}
94 120
 	
95 121
 	/**

+ 48
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/TaSysMenuMapper.xml View File

@@ -0,0 +1,48 @@
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
+
5
+    <select id="getTaSysMenuListByCommunityId" resultType="com.community.huiju.model.TaSysMenu">
6
+        SELECT
7
+            t.id,
8
+            t.community_id AS communityId,
9
+            t.menu_url AS menuUrl,
10
+            t.menu_name AS menuName,
11
+            t.parent_id AS paremtId,
12
+            t.sort,
13
+            t.menu_type AS menuType,
14
+            t.`status`,
15
+            t.remark,
16
+            t.`explain`
17
+        FROM
18
+            ta_sys_menu t
19
+        WHERE
20
+            community_id = '-1'
21
+    </select>
22
+
23
+    <insert id="insertTaSysMenu" parameterType="com.community.huiju.model.TaSysMenu" useGeneratedKeys="true" keyProperty="id">
24
+        insert into ta_sys_menu (community_id, menu_url, menu_name, sort, menu_type,  `status`, remark, `explain`)
25
+    values (#{communityId,jdbcType=INTEGER}, #{menuUrl,jdbcType=VARCHAR},
26
+      #{menuName,jdbcType=VARCHAR}, #{sort,jdbcType=VARCHAR}, #{menuType,jdbcType=VARCHAR},
27
+      #{status,jdbcType=CHAR}, #{remark,jdbcType=VARCHAR}, #{explain,jdbcType=VARCHAR})
28
+    </insert>
29
+
30
+    <select id="selectTaSysMenuImgById" resultType="com.community.huiju.model.TaSysMenuImg">
31
+        SELECT
32
+            id,
33
+            ta_menu_id as taMenuId,
34
+            menu_icon_img as menuIconImg
35
+        FROM
36
+            ta_sys_menu_img
37
+        WHERE
38
+            ta_menu_id = #{taMenuId,jdbcType=INTEGER}
39
+    </select>
40
+
41
+    <insert id="batchInsertImg" parameterType="list" >
42
+        insert into ta_sys_menu_img (ta_menu_id, menu_icon_img)
43
+        values
44
+        <foreach collection="list" item="item" index="index" separator="," >
45
+            (#{item.taMenuId,jdbcType=VARCHAR}, #{item.menuIconImg,jdbcType=VARCHAR})
46
+        </foreach>
47
+    </insert>
48
+</mapper>

+ 2
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/TaSysMenuMapper.java View File

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.community.huiju.model.TaSysMenu;
5
+import org.apache.ibatis.annotations.Mapper;
5 6
 
6 7
 /**
7 8
  * <p>
@@ -11,6 +12,7 @@ import com.community.huiju.model.TaSysMenu;
11 12
  * @author jobob
12 13
  * @since 2019-03-06
13 14
  */
15
+@Mapper
14 16
 public interface TaSysMenuMapper extends BaseMapper<TaSysMenu> {
15 17
 
16 18
 }