+ * 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.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
+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.ScreenDeptInfoDTO;
+import com.elink.esua.epdc.excel.ScreenDeptInfoExcel;
+import com.elink.esua.epdc.service.ScreenDeptInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 网格小程序码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-08-03
+ */
+@RestController
+@RequestMapping("screendeptinfo")
+public class ScreenDeptInfoController {
+
+ @Autowired
+ private ScreenDeptInfoService screenDeptInfoService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = screenDeptInfoService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ ScreenDeptInfoDTO data = screenDeptInfoService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody ScreenDeptInfoDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ screenDeptInfoService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody ScreenDeptInfoDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ screenDeptInfoService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ screenDeptInfoService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = screenDeptInfoService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, ScreenDeptInfoExcel.class);
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/ScreenDeptInfoDao.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/ScreenDeptInfoDao.java
new file mode 100644
index 0000000..e3b9e54
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/ScreenDeptInfoDao.java
@@ -0,0 +1,55 @@
+/**
+ * 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.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.ScreenDeptInfoDTO;
+import com.elink.esua.epdc.entity.ScreenDeptInfoEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 网格小程序码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-08-03
+ */
+@Mapper
+public interface ScreenDeptInfoDao extends BaseDao {
+ /**
+ * 功能描述: 列表信息查询
+ *
+ * @param: Map
+ * @return: List
+ * @author: zhy
+ * @date: 2020/8/4 10:01
+ */
+ List selectListOfScreenDeptInfo(Map params);
+ /**
+ * 功能描述: 基本信息查询
+ *
+ * @param: ScreenDeptInfoDTO
+ * @return: ScreenDeptInfoEntity
+ * @author: zhy
+ * @date: 2020/8/4 10:01
+ */
+ ScreenDeptInfoEntity selectByDept(ScreenDeptInfoDTO dto);
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/ScreenDeptInfoEntity.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/ScreenDeptInfoEntity.java
new file mode 100644
index 0000000..fe8d540
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/ScreenDeptInfoEntity.java
@@ -0,0 +1,102 @@
+/**
+ * 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.redis;
+
+import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 网格小程序码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-08-03
+ */
+@Component
+public class ScreenDeptInfoRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/ScreenDeptInfoService.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/ScreenDeptInfoService.java
new file mode 100644
index 0000000..899e6e6
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/ScreenDeptInfoService.java
@@ -0,0 +1,95 @@
+/**
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.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.constant.FieldConstant;
+import com.elink.esua.epdc.commons.tools.exception.RenException;
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.dao.ScreenDeptInfoDao;
+import com.elink.esua.epdc.dto.ScreenDeptInfoDTO;
+import com.elink.esua.epdc.entity.ScreenDeptInfoEntity;
+import com.elink.esua.epdc.redis.ScreenDeptInfoRedis;
+import com.elink.esua.epdc.service.ScreenDeptInfoService;
+import com.elink.esua.epdc.service.SysDeptService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 网格小程序码
+ *
+ * @author zhangyuan qu@elink-cn.com
+ * @since v1.0.0 2020-08-03
+ */
+@Service
+public class ScreenDeptInfoServiceImpl extends BaseServiceImpl implements ScreenDeptInfoService {
+
+ @Autowired
+ private ScreenDeptInfoRedis screenDeptInfoRedis;
+
+ @Autowired
+ private SysDeptService sysDeptService;
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = getPage(params);
+ if (params.containsKey("deptId") && StringUtils.isNotBlank(params.get("deptId").toString())) {
+ params.put("deptList", sysDeptService.getSubDeptIdList(Long.parseLong(params.get("deptId").toString())));
+ }
+ List entityList = baseDao.selectListOfScreenDeptInfo(params);
+ List list = ConvertUtils.sourceToTarget(entityList, ScreenDeptInfoDTO.class);
+ return new PageData<>(list, page.getTotal());
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, ScreenDeptInfoDTO.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 ScreenDeptInfoDTO get(String id) {
+ ScreenDeptInfoEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, ScreenDeptInfoDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(ScreenDeptInfoDTO dto) {
+ ScreenDeptInfoEntity screenDeptInfo = baseDao.selectByDept(dto);
+ if (screenDeptInfo != null) {
+ throw new RenException("该机构数据已经存在");
+ }
+ ScreenDeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, ScreenDeptInfoEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(ScreenDeptInfoDTO dto) {
+ ScreenDeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, ScreenDeptInfoEntity.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/epdc-cloud-admin/src/main/resources/mapper/ScreenDeptInfoDao.xml b/epdc-cloud-admin/src/main/resources/mapper/ScreenDeptInfoDao.xml
new file mode 100644
index 0000000..eac8c30
--- /dev/null
+++ b/epdc-cloud-admin/src/main/resources/mapper/ScreenDeptInfoDao.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ID,DEPT_ID,DEPT_NAME,sort,village_num,building_num,house_master_num,
+ focus_groups_num,person_num,party_num,grid_master,
+ CREATED_BY,CREATED_TIME,UPDATED_BY,UPDATED_TIME,DEL_FLAG,remark,extend
+
+
+
+
\ No newline at end of file