+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.group.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.dto.group.UserGroupDTO;
+import com.elink.esua.epdc.modules.group.service.UserGroupService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+
+/**
+ * 用户社群关系表 用户社群关系表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-17
+ */
+@RestController
+@RequestMapping("usergroup")
+public class UserGroupController {
+
+ @Autowired
+ private UserGroupService userGroupService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = userGroupService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ UserGroupDTO data = userGroupService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody UserGroupDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ userGroupService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody UserGroupDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ userGroupService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ userGroupService.delete(ids);
+ return new Result();
+ }
+
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.java
index 374f1d984..eabcda417 100644
--- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.java
+++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/GroupDao.java
@@ -44,5 +44,16 @@ public interface GroupDao extends BaseDao {
* @since 2019/10/11 14:54
*/
List selectListOfGroups(Map params);
+
+ /**
+ *
+ * 查询社群名称重复数量
+ *
+ * @params [gridId, groupName]
+ * @return java.lang.Long
+ * @author liuchuang
+ * @since 2019/10/17 16:38
+ */
+ Long selectListOfRepeatGroupName(Long gridId, String groupName);
}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/UserGroupDao.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/UserGroupDao.java
new file mode 100644
index 000000000..c153a7660
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/dao/UserGroupDao.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.group.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.group.UserGroupDTO;
+import com.elink.esua.epdc.modules.group.entity.UserGroupEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 用户社群关系表 用户社群关系表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-17
+ */
+@Mapper
+public interface UserGroupDao extends BaseDao {
+
+ /**
+ *
+ * 社群成员列表
+ *
+ * @params [params]
+ * @return java.util.List
+ * @author liuchuang
+ * @since 2019/10/17 10:31
+ */
+ List selectListOfGroupUsers(Map params);
+
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java
index b98616500..ecd842435 100644
--- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java
+++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/GroupEntity.java
@@ -66,7 +66,7 @@ public class GroupEntity extends BaseEpdcEntity {
/**
* 区ID
*/
- private String areaId;
+ private Long areaId;
/**
* 街道
@@ -76,7 +76,7 @@ public class GroupEntity extends BaseEpdcEntity {
/**
* 街道ID
*/
- private String streetId;
+ private Long streetId;
/**
* 社区
@@ -86,7 +86,7 @@ public class GroupEntity extends BaseEpdcEntity {
/**
* 社区ID
*/
- private String communityId;
+ private Long communityId;
/**
* 网格
@@ -96,7 +96,7 @@ public class GroupEntity extends BaseEpdcEntity {
/**
* 网格ID
*/
- private String gridId;
+ private Long gridId;
/**
* 状态 0:待审核,5:审核不通过,10:审核通过,15:禁言,20:已解散
diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/UserGroupEntity.java b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/UserGroupEntity.java
new file mode 100644
index 000000000..7227fd708
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/java/com.elink.esua.epdc/modules/group/entity/UserGroupEntity.java
@@ -0,0 +1,84 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.modules.group.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
+import com.elink.esua.epdc.dto.group.UserGroupDTO;
+import com.elink.esua.epdc.modules.group.dao.UserGroupDao;
+import com.elink.esua.epdc.modules.group.entity.UserGroupEntity;
+import com.elink.esua.epdc.modules.group.service.UserGroupService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 用户社群关系表 用户社群关系表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2019-10-17
+ */
+@Service
+public class UserGroupServiceImpl extends BaseServiceImpl implements UserGroupService {
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = getPage(params);
+ List list = baseDao.selectListOfGroupUsers(params);
+ return new PageData<>(list, page.getTotal());
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, UserGroupDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public UserGroupDTO get(String id) {
+ UserGroupEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, UserGroupDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(UserGroupDTO dto) {
+ UserGroupEntity entity = ConvertUtils.sourceToTarget(dto, UserGroupEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(UserGroupDTO dto) {
+ UserGroupEntity entity = ConvertUtils.sourceToTarget(dto, UserGroupEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+}
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml
index 4db1798ce..3f46a39d8 100644
--- a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml
+++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/GroupDao.xml
@@ -18,7 +18,9 @@
AND ugp.LORD_FLAG = '1'
WHERE
gp.DEL_FLAG = '0'
- AND gp.STATE = #{state}
+
+ AND gp.STATE = #{state}
+
AND gp.GRID_ID = #{gridId}
@@ -32,5 +34,9 @@
gp.GROUP_CATEGORY, gp.CREATED_TIME DESC
+
+
\ No newline at end of file
diff --git a/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/UserGroupDao.xml b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/UserGroupDao.xml
new file mode 100644
index 000000000..a91258736
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-group/epdc-group-server/src/main/resources/mapper/group/UserGroupDao.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
\ No newline at end of file