From f98cd52cda197d1309ce42a1934586c4ec48b4f5 Mon Sep 17 00:00:00 2001 From: lichao <326994889@qq.com> Date: Wed, 8 Nov 2023 15:32:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E7=BD=91=E6=A0=BC=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 7 +- .../com/epmet/dto/CustomerMicroGridDTO.java | 129 ++++++++++++++++++ .../form/CustomerMicroGridPageFormDTO.java | 46 +++++++ .../CustomerMicroGridDetailResultDTO.java | 55 ++++++++ .../CustomerMicroGridPageResultDTO.java | 47 +++++++ .../CustomerMicroGridController.java | 85 ++++++++++++ .../com/epmet/dao/CustomerMicroGridDao.java | 25 ++++ .../epmet/entity/CustomerMicroGridEntity.java | 99 ++++++++++++++ .../epmet/excel/CustomerMicroGridExcel.java | 84 ++++++++++++ .../epmet/redis/CustomerMicroGridRedis.java | 30 ++++ .../service/CustomerMicroGridService.java | 81 +++++++++++ .../impl/CustomerMicroGridServiceImpl.java | 105 ++++++++++++++ .../resources/mapper/CustomerMicroGridDao.xml | 62 +++++++++ 13 files changed, 853 insertions(+), 2 deletions(-) create mode 100755 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerMicroGridDTO.java create mode 100755 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerMicroGridPageFormDTO.java create mode 100755 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridDetailResultDTO.java create mode 100755 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridPageResultDTO.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerMicroGridController.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerMicroGridDao.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerMicroGridEntity.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerMicroGridExcel.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerMicroGridRedis.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerMicroGridService.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerMicroGridServiceImpl.java create mode 100755 epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerMicroGridDao.xml diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index 86b39b69c8..073794bf6b 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,9 +9,12 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://118.190.150.119:43306/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://47.104.92.53:10059/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root - password: root + password: elink!123 + # url: jdbc:mysql://118.190.150.119:43306/epmet_gov_org?useUnicode=true&characterEncoding=UTF-8&useSSL=false +# username: root +# password: root #oracle配置 # driverClassName: oracle.jdbc.OracleDriver # url: jdbc:oracle:thin:@192.168.10.10:1521:helowin diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerMicroGridDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerMicroGridDTO.java new file mode 100755 index 0000000000..ab9a269362 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerMicroGridDTO.java @@ -0,0 +1,129 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Data +public class CustomerMicroGridDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 微网格名称 + */ + private String microgridName; + + /** + * 微网格长 + */ + private String contacts; + + /** + * 性别(女性-0,男性-1) + */ + private String sex; + + /** + * 联系电话 + */ + private String mobile; + + /** + * 地址 + */ + private String address; + + /** + * 网格id + */ + private Integer gridId; + + /** + * 所属组织机构ID + */ + private String agencyId; + + /** + * 所有上级组织ID + */ + private String agencyPids; + + /** + * 当前网格总人数 + */ + private Integer totalUser; + + /** + * 网格排序 + */ + private Integer sort; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 中心点位地址 + */ + private String centerAddress; + + /** + * 坐标区域 + */ + private String coordinates; + + /** + * 编码 + */ + private String code; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerMicroGridPageFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerMicroGridPageFormDTO.java new file mode 100755 index 0000000000..00a9627b64 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerMicroGridPageFormDTO.java @@ -0,0 +1,46 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NonNull; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Data +public class CustomerMicroGridPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface CustomerMicroGridPage{} + + @NotBlank(message = "pageNo不能为空",groups = CustomerMicroGridPageFormDTO.CustomerMicroGridPage.class) + private Integer pageNo; + + @NotBlank(message = "pageNo不能为空",groups = CustomerMicroGridPageFormDTO.CustomerMicroGridPage.class) + private Integer pageSize; + + + private String agencyId; + + + private String agencyPids; + + /** + * 微网格名称 + */ + private String microgridName; + + /** + * 微网格长 + */ + private String contacts; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridDetailResultDTO.java new file mode 100755 index 0000000000..2871b77169 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridDetailResultDTO.java @@ -0,0 +1,55 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Data +public class CustomerMicroGridDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + private String agencyId; + + private String communityName; + + private String gridId; + + private String gridName; + + /** + * 微网格名称 + */ + private String microgridName; + + /** + * 微网格长 + */ + private String contacts; + + private String sex; + + private String mobile; + + private String address; + + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridPageResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridPageResultDTO.java new file mode 100755 index 0000000000..edf3ceb38e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerMicroGridPageResultDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Data +public class CustomerMicroGridPageResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + private String communityName; + + private String gridName; + + + /** + * 微网格名称 + */ + private String microgridName; + + /** + * 微网格长 + */ + private String contacts; + + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerMicroGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerMicroGridController.java new file mode 100755 index 0000000000..30c428a34a --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerMicroGridController.java @@ -0,0 +1,85 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CustomerMicroGridDTO; +import com.epmet.dto.form.CustomerMicroGridPageFormDTO; +import com.epmet.dto.result.CustomerMicroGridDetailResultDTO; +import com.epmet.dto.result.CustomerMicroGridPageResultDTO; +import com.epmet.excel.CustomerMicroGridExcel; +import com.epmet.service.CustomerMicroGridService; +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 generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@RestController +@RequestMapping("customerMicroGrid") +public class CustomerMicroGridController { + + @Autowired + private CustomerMicroGridService customerMicroGridService; + + @PostMapping("page") + public Result> page(@RequestBody CustomerMicroGridPageFormDTO dto){ + PageData page = customerMicroGridService.page(dto); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + CustomerMicroGridDetailResultDTO data = customerMicroGridService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody CustomerMicroGridDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerMicroGridService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody CustomerMicroGridDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerMicroGridService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + customerMicroGridService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = customerMicroGridService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, CustomerMicroGridExcel.class); + } + + + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerMicroGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerMicroGridDao.java new file mode 100755 index 0000000000..fda95abeba --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerMicroGridDao.java @@ -0,0 +1,25 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.CustomerMicroGridPageFormDTO; +import com.epmet.dto.result.CustomerMicroGridDetailResultDTO; +import com.epmet.dto.result.CustomerMicroGridPageResultDTO; +import com.epmet.entity.CustomerMicroGridEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Mapper +public interface CustomerMicroGridDao extends BaseDao { + + List selectPageList(CustomerMicroGridPageFormDTO dto); + + CustomerMicroGridDetailResultDTO selectDetailById(@Param("id") String id); +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerMicroGridEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerMicroGridEntity.java new file mode 100755 index 0000000000..4cd13a2793 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerMicroGridEntity.java @@ -0,0 +1,99 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_micro_grid") +public class CustomerMicroGridEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 微网格名称 + */ + private String microgridName; + + /** + * 微网格长 + */ + private String contacts; + + /** + * 性别(女性-0,男性-1) + */ + private String sex; + + /** + * 联系电话 + */ + private String mobile; + + /** + * 地址 + */ + private String address; + + /** + * 网格id + */ + private Integer gridId; + + /** + * 所属组织机构ID + */ + private String agencyId; + + /** + * 所有上级组织ID + */ + private String agencyPids; + + /** + * 当前网格总人数 + */ + private Integer totalUser; + + /** + * 网格排序 + */ + private Integer sort; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 中心点位地址 + */ + private String centerAddress; + + /** + * 坐标区域 + */ + private String coordinates; + + /** + * 编码 + */ + private String code; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerMicroGridExcel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerMicroGridExcel.java new file mode 100755 index 0000000000..e977a9d503 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerMicroGridExcel.java @@ -0,0 +1,84 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Data +public class CustomerMicroGridExcel { + + @Excel(name = "ID 唯一标识") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "微网格名称") + private String microgridName; + + @Excel(name = "微网格长") + private String contacts; + + @Excel(name = "性别(女性-0,男性-1)") + private String sex; + + @Excel(name = "联系电话") + private String mobile; + + @Excel(name = "地址") + private String address; + + @Excel(name = "网格id") + private Integer gridId; + + @Excel(name = "所属组织机构ID") + private String agencyId; + + @Excel(name = "所有上级组织ID") + private String agencyPids; + + @Excel(name = "当前网格总人数") + private Integer totalUser; + + @Excel(name = "网格排序") + private Integer sort; + + @Excel(name = "中心位置纬度") + private String latitude; + + @Excel(name = "中心点位地址") + private String centerAddress; + + @Excel(name = "坐标区域") + private String coordinates; + + @Excel(name = "编码") + private String code; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerMicroGridRedis.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerMicroGridRedis.java new file mode 100755 index 0000000000..350fa9d3f2 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/CustomerMicroGridRedis.java @@ -0,0 +1,30 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Component +public class CustomerMicroGridRedis { + @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/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerMicroGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerMicroGridService.java new file mode 100755 index 0000000000..d10aab595b --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerMicroGridService.java @@ -0,0 +1,81 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CustomerMicroGridDTO; +import com.epmet.dto.form.CustomerMicroGridPageFormDTO; +import com.epmet.dto.result.CustomerMicroGridDetailResultDTO; +import com.epmet.dto.result.CustomerMicroGridPageResultDTO; +import com.epmet.entity.CustomerMicroGridEntity; + +import java.util.List; +import java.util.Map; + +/** + * 微网格表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +public interface CustomerMicroGridService extends BaseService { + + /** + * 默认分页 + * + * @param dto + * @return PageData + * @author generator + * @date 2023-11-07 + */ + PageData page(CustomerMicroGridPageFormDTO dto); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2023-11-07 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerMicroGridDTO + * @author generator + * @date 2023-11-07 + */ + CustomerMicroGridDetailResultDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2023-11-07 + */ + void save(CustomerMicroGridDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2023-11-07 + */ + void update(CustomerMicroGridDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2023-11-07 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerMicroGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerMicroGridServiceImpl.java new file mode 100755 index 0000000000..eb2516514b --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerMicroGridServiceImpl.java @@ -0,0 +1,105 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CustomerAgencyDao; +import com.epmet.dao.CustomerMicroGridDao; +import com.epmet.dto.CustomerMicroGridDTO; +import com.epmet.dto.IcBirthRecordDTO; +import com.epmet.dto.form.CustomerMicroGridPageFormDTO; +import com.epmet.dto.result.CustomerMicroGridDetailResultDTO; +import com.epmet.dto.result.CustomerMicroGridPageResultDTO; +import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.entity.CustomerMicroGridEntity; +import com.epmet.redis.CustomerMicroGridRedis; +import com.epmet.service.CustomerMicroGridService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +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 generator generator@elink-cn.com + * @since v1.0.0 2023-11-07 + */ +@Service +public class CustomerMicroGridServiceImpl extends BaseServiceImpl implements CustomerMicroGridService { + + @Autowired + private CustomerMicroGridRedis customerMicroGridRedis; + @Autowired + private CustomerAgencyDao customerAgencyDao; + + @Override + public PageData page(CustomerMicroGridPageFormDTO dto) { + + // 获取所有的pids + if (StringUtils.isNotBlank(dto.getAgencyId())){ + CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(dto.getAgencyId()); + dto.setAgencyPids(customerAgencyEntity.getPids().concat(":").concat(dto.getAgencyId())); + } + + PageHelper.startPage(dto.getPageNo(), dto.getPageSize()); + List entityList = baseDao.selectPageList(dto); + PageInfo pageInfo = new PageInfo<>(entityList); + + return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerMicroGridDTO.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 CustomerMicroGridDetailResultDTO get(String id) { + CustomerMicroGridDetailResultDTO resultDTO = baseDao.selectDetailById(id); + return resultDTO; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerMicroGridDTO dto) { + CustomerMicroGridEntity entity = ConvertUtils.sourceToTarget(dto, CustomerMicroGridEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerMicroGridDTO dto) { + CustomerMicroGridEntity entity = ConvertUtils.sourceToTarget(dto, CustomerMicroGridEntity.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/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerMicroGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerMicroGridDao.xml new file mode 100755 index 0000000000..af987fc615 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerMicroGridDao.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file