From 11bceb3a56172687d1ad5c5a527b7eef62d2d1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=87=91=E9=B9=8F?= Date: Wed, 4 Sep 2019 13:48:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E5=91=98=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../elink/esua/epdc/dto/PartyMembersDTO.java | 2 + .../esua/epdc/dto/PartyTagRelationDTO.java | 54 +++++++++ .../controller/PartyMembersController.java | 2 + .../PartyTagRelationController.java | 102 ++++++++++++++++ .../elink/esua/epdc/dao/PartyMembersDao.java | 2 + .../esua/epdc/dao/PartyTagRelationDao.java | 33 +++++ .../esua/epdc/entity/PartyMembersEntity.java | 4 +- .../epdc/entity/PartyTagRelationEntity.java | 53 ++++++++ .../epdc/excel/PartyTagRelationExcel.java | 52 ++++++++ .../epdc/redis/PartyTagRelationRedis.java | 47 ++++++++ .../epdc/service/PartyTagRelationService.java | 47 ++++++++ .../service/impl/PartyMembersServiceImpl.java | 24 +++- .../impl/PartyTagRelationServiceImpl.java | 113 ++++++++++++++++++ .../main/resources/mapper/PartyMembersDao.xml | 18 ++- 14 files changed, 544 insertions(+), 9 deletions(-) create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyTagRelationDTO.java create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyTagRelationController.java create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyTagRelationDao.java create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyTagRelationEntity.java create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/PartyTagRelationExcel.java create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/PartyTagRelationRedis.java create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/PartyTagRelationService.java create mode 100755 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyTagRelationServiceImpl.java diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyMembersDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyMembersDTO.java index 9d1a6f362..9df45cd5f 100755 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyMembersDTO.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyMembersDTO.java @@ -19,6 +19,8 @@ package com.elink.esua.epdc.dto; import java.io.Serializable; import java.util.Date; +import java.util.List; + import lombok.Data; diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyTagRelationDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyTagRelationDTO.java new file mode 100755 index 000000000..a8f243fa6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/PartyTagRelationDTO.java @@ -0,0 +1,54 @@ +/** + * 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.dto; + + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 党员标签关系表 + * + * @author Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +@Data +public class PartyTagRelationDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String id; + + private String partyId; + + private String tagId; + + private Integer revision; + + private String createdBy; + + private Date createdTime; + + private String updatedBy; + + private Date updatedTime; + + private String delFlag; + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyMembersController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyMembersController.java index 40d479dea..c18a36440 100755 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyMembersController.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyMembersController.java @@ -30,6 +30,7 @@ import com.elink.esua.epdc.dto.PartyMembersDTO; import com.elink.esua.epdc.excel.PartyMembersExcel; import com.elink.esua.epdc.service.PartyMembersService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; @@ -46,6 +47,7 @@ import java.util.Map; @RestController @RequestMapping("/partymembers") public class PartyMembersController { + @Autowired private PartyMembersService partyMembersService; diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyTagRelationController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyTagRelationController.java new file mode 100755 index 000000000..afb401335 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/PartyTagRelationController.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. + *

+ * 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.PartyTagRelationDTO; +import com.elink.esua.epdc.excel.PartyTagRelationExcel; +import com.elink.esua.epdc.service.PartyTagRelationService; +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 Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +@RestController +@RequestMapping("/partytagrelation") +public class PartyTagRelationController { + @Autowired + private PartyTagRelationService partyTagRelationService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = partyTagRelationService.page(params); + + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + PartyTagRelationDTO data = partyTagRelationService.get(id); + + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody PartyTagRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + partyTagRelationService.save(dto); + + return new Result(); + } + + @PutMapping + public Result update(@RequestBody PartyTagRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + + partyTagRelationService.update(dto); + + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + + partyTagRelationService.delete(ids); + + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = partyTagRelationService.list(params); + + ExcelUtils.exportExcelToTarget(response, null, list, PartyTagRelationExcel.class); + } + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyMembersDao.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyMembersDao.java index 1106eff31..8ad93f7d1 100755 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyMembersDao.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyMembersDao.java @@ -22,6 +22,7 @@ import com.elink.esua.epdc.dto.PartyMembersDTO; import com.elink.esua.epdc.entity.PartyMembersEntity; import org.apache.ibatis.annotations.Mapper; +import java.io.Serializable; import java.util.List; import java.util.Map; @@ -36,4 +37,5 @@ public interface PartyMembersDao extends BaseDao { List pageDIY(Map params); + PartyMembersDTO selectByIdNew(String id); } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyTagRelationDao.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyTagRelationDao.java new file mode 100755 index 000000000..8329ec861 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/PartyTagRelationDao.java @@ -0,0 +1,33 @@ +/** + * 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.entity.PartyTagRelationEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 党员标签关系表 + * + * @author Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +@Mapper +public interface PartyTagRelationDao extends BaseDao { + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyMembersEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyMembersEntity.java index 63351f1dd..3eb40dd29 100755 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyMembersEntity.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyMembersEntity.java @@ -96,10 +96,10 @@ public class PartyMembersEntity extends BaseEpdcEntity { /** * 网格ID */ - private String gridId; + private long gridId; /** * 部门ID */ - private String deptId; + private long deptId; } diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyTagRelationEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyTagRelationEntity.java new file mode 100755 index 000000000..a5231fec1 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/PartyTagRelationEntity.java @@ -0,0 +1,53 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; + +import com.elink.esua.epdc.commons.mybatis.entity.BaseEntity; +import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 党员标签关系表 + * + * @author Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_party_tag_relation") +public class PartyTagRelationEntity extends BaseEpdcEntity { + private static final long serialVersionUID = 1L; + + /** + * 党员ID + */ + private String partyId; + /** + * 标签ID + */ + private String tagId; + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/PartyTagRelationExcel.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/PartyTagRelationExcel.java new file mode 100755 index 000000000..9b7a9cc94 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/PartyTagRelationExcel.java @@ -0,0 +1,52 @@ +/** + * 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.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 党员标签关系表 + * + * @author Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +@Data +public class PartyTagRelationExcel { + @Excel(name = "主键") + private String id; + @Excel(name = "党员ID") + private String partyId; + @Excel(name = "标签ID") + private String tagId; + @Excel(name = "乐观锁") + private Integer revision; + @Excel(name = "创建人") + private String createdBy; + @Excel(name = "创建时间") + private Date createdTime; + @Excel(name = "更新人") + private String updatedBy; + @Excel(name = "更新时间") + private Date updatedTime; + @Excel(name = "删除标记") + private String delFlag; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/PartyTagRelationRedis.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/PartyTagRelationRedis.java new file mode 100755 index 000000000..e2bde59e9 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/PartyTagRelationRedis.java @@ -0,0 +1,47 @@ +/** + * 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.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 党员标签关系表 + * + * @author Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +@Component +public class PartyTagRelationRedis { + @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/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/PartyTagRelationService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/PartyTagRelationService.java new file mode 100755 index 000000000..2a82e316e --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/PartyTagRelationService.java @@ -0,0 +1,47 @@ +/** + * 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.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.PartyTagRelationDTO; +import com.elink.esua.epdc.entity.PartyTagRelationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 党员标签关系表 + * + * @author Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +public interface PartyTagRelationService extends BaseService { + + PageData page(Map params); + + List list(Map params); + + PartyTagRelationDTO get(String id); + + void save(PartyTagRelationDTO dto); + + void update(PartyTagRelationDTO dto); + + void delete(String[] ids); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyMembersServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyMembersServiceImpl.java index a5ec41068..e442eee5c 100755 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyMembersServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/PartyMembersServiceImpl.java @@ -17,6 +17,9 @@ package com.elink.esua.epdc.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.elink.esua.epdc.commons.mybatis.enums.DelFlagEnum; @@ -28,9 +31,11 @@ import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dao.PartyMembersDao; import com.elink.esua.epdc.dto.PartyMembersDTO; +import com.elink.esua.epdc.dto.PartyTagRelationDTO; import com.elink.esua.epdc.entity.PartyMembersEntity; import com.elink.esua.epdc.redis.PartyMembersRedis; import com.elink.esua.epdc.service.PartyMembersService; +import com.elink.esua.epdc.service.PartyTagRelationService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,8 +53,11 @@ import java.util.Map; */ @Service public class PartyMembersServiceImpl extends BaseServiceImpl implements PartyMembersService { + @Autowired private PartyMembersRedis partyMembersRedis; + @Autowired + private PartyTagRelationService partyTagRelationService; @Override public PageData page(Map params) { @@ -87,17 +95,27 @@ public class PartyMembersServiceImpl extends BaseServiceImpl + * 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.enums.DelFlagEnum; +import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; +import com.elink.esua.epdc.commons.tools.constant.Constant; +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.PartyTagRelationDao; +import com.elink.esua.epdc.dto.PartyTagRelationDTO; +import com.elink.esua.epdc.entity.PartyTagRelationEntity; +import com.elink.esua.epdc.redis.PartyTagRelationRedis; +import com.elink.esua.epdc.service.PartyTagRelationService; +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 Mark sunlightcs@gmail.com + * @since v1.0.0 2019-09-04 + */ +@Service +public class PartyTagRelationServiceImpl extends BaseServiceImpl implements PartyTagRelationService { + @Autowired + private PartyTagRelationRedis partyTagRelationRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, Constant.CREATED_TIME, false), + getWrapper(params) + ); + + return getPageData(page, PartyTagRelationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, PartyTagRelationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get("id"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), "id", id); + //wrapper.eq(Constant.DEL_FLAG, DelFlagEnum.NORMAL.value()); + + return wrapper; + } + + @Override + public PartyTagRelationDTO get(String id) { + PartyTagRelationEntity entity = baseDao.selectById(id); + + return ConvertUtils.sourceToTarget(entity, PartyTagRelationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PartyTagRelationDTO dto) { + PartyTagRelationEntity entity = ConvertUtils.sourceToTarget(dto, PartyTagRelationEntity.class); + + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PartyTagRelationDTO dto) { + PartyTagRelationEntity entity = ConvertUtils.sourceToTarget(dto, PartyTagRelationEntity.class); + + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + //逻辑删除 + //logicDelete(ids, PartyTagRelationEntity.class); + + //物理删除 + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/PartyMembersDao.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/PartyMembersDao.xml index 5de764139..97da21ac0 100755 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/PartyMembersDao.xml +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/PartyMembersDao.xml @@ -30,7 +30,7 @@ - + @@ -56,7 +56,7 @@ + + +