diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkRecordDTO.java new file mode 100644 index 0000000000..a7a0923715 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkRecordDTO.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.epmet.resi.group.dto.topic; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Data +public class TopicShareLinkRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 邀请ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 话题所属网格ID + */ + private String gridId; + + /** + * 小组ID + */ + private String groupId; + + /** + * 话题ID + */ + private String topicId; + + /** + * 分享人ID(当前登录用户) + */ + private String shareUserId; + + /** + * 邀请内容 + */ + private String inviteContent; + + /** + * 删除状态 0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkVisitRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkVisitRecordDTO.java new file mode 100644 index 0000000000..572160d9ee --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/TopicShareLinkVisitRecordDTO.java @@ -0,0 +1,96 @@ +/** + * 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.epmet.resi.group.dto.topic; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 话题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Data +public class TopicShareLinkVisitRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分享人【邀请人】ID + */ + private String shareUserId; + + /** + * 被邀请人ID + */ + private String inviteeUserId; + + /** + * 话题分享链接表id + */ + private String shareLinkRecId; + + /** + * 是否邀请注册:0:是,1:不是 + */ + private Integer isInviteRegister; + + /** + * 删除状态,0:正常,1:删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java new file mode 100644 index 0000000000..c8231a7a55 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkRecordController.java @@ -0,0 +1,67 @@ +package com.epmet.modules.topic.controller; + +import com.epmet.commons.tools.page.PageData; +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.modules.topic.service.TopicShareLinkRecordService; +import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@RestController +@RequestMapping("topicsharelinkrecord") +public class TopicShareLinkRecordController { + + @Autowired + private TopicShareLinkRecordService topicShareLinkRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicShareLinkRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicShareLinkRecordDTO data = topicShareLinkRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicShareLinkRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicShareLinkRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicShareLinkRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicShareLinkRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicShareLinkRecordService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkVisitRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkVisitRecordController.java new file mode 100644 index 0000000000..2c482fb303 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicShareLinkVisitRecordController.java @@ -0,0 +1,67 @@ +package com.epmet.modules.topic.controller; + +import com.epmet.commons.tools.page.PageData; +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; +import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 话题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@RestController +@RequestMapping("topicsharelinkvisitrecord") +public class TopicShareLinkVisitRecordController { + + @Autowired + private TopicShareLinkVisitRecordService topicShareLinkVisitRecordService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = topicShareLinkVisitRecordService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + TopicShareLinkVisitRecordDTO data = topicShareLinkVisitRecordService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody TopicShareLinkVisitRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + topicShareLinkVisitRecordService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody TopicShareLinkVisitRecordDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + topicShareLinkVisitRecordService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + topicShareLinkVisitRecordService.delete(ids); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java new file mode 100644 index 0000000000..4791dc49fe --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkRecordDao.java @@ -0,0 +1,16 @@ +package com.epmet.modules.topic.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Mapper +public interface TopicShareLinkRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkVisitRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkVisitRecordDao.java new file mode 100644 index 0000000000..03157f911d --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicShareLinkVisitRecordDao.java @@ -0,0 +1,16 @@ +package com.epmet.modules.topic.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 话题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Mapper +public interface TopicShareLinkVisitRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkRecordEntity.java new file mode 100644 index 0000000000..e7dd0448c4 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkRecordEntity.java @@ -0,0 +1,68 @@ +/** + * 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.epmet.modules.topic.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("topic_share_link_record") +public class TopicShareLinkRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 话题所属网格ID + */ + private String gridId; + + /** + * 小组ID + */ + private String groupId; + + /** + * 话题ID + */ + private String topicId; + + /** + * 分享人ID(当前登录用户) + */ + private String shareUserId; + + /** + * 邀请内容 + */ + private String inviteContent; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkVisitRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkVisitRecordEntity.java new file mode 100644 index 0000000000..44edb3624a --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/entity/TopicShareLinkVisitRecordEntity.java @@ -0,0 +1,66 @@ +/** + * 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.epmet.modules.topic.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 2020-12-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("topic_share_link_visit_record") +public class TopicShareLinkVisitRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分享人【邀请人】ID + */ + private String shareUserId; + + /** + * 被邀请人ID + */ + private String inviteeUserId; + + /** + * 话题分享链接表id + */ + private String shareLinkRecId; + + /** + * 是否邀请注册:0:是,1:不是 + */ + private Integer isInviteRegister; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java new file mode 100644 index 0000000000..37f1691642 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkRecordService.java @@ -0,0 +1,78 @@ +package com.epmet.modules.topic.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; +import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题分享链接表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +public interface TopicShareLinkRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicShareLinkRecordDTO + * @author generator + * @date 2020-12-18 + */ + TopicShareLinkRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void save(TopicShareLinkRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void update(TopicShareLinkRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkVisitRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkVisitRecordService.java new file mode 100644 index 0000000000..e09b2e3605 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicShareLinkVisitRecordService.java @@ -0,0 +1,78 @@ +package com.epmet.modules.topic.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; +import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; + +import java.util.List; +import java.util.Map; + +/** + * 话题分享链接访问记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +public interface TopicShareLinkVisitRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-18 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-18 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return TopicShareLinkVisitRecordDTO + * @author generator + * @date 2020-12-18 + */ + TopicShareLinkVisitRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void save(TopicShareLinkVisitRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-18 + */ + void update(TopicShareLinkVisitRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-18 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java new file mode 100644 index 0000000000..3681548f68 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkRecordServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.modules.topic.service.impl; + +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.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.topic.dao.TopicShareLinkRecordDao; +import com.epmet.modules.topic.entity.TopicShareLinkRecordEntity; +import com.epmet.modules.topic.service.TopicShareLinkRecordService; +import com.epmet.resi.group.dto.topic.TopicShareLinkRecordDTO; +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 generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Service +public class TopicShareLinkRecordServiceImpl extends BaseServiceImpl implements TopicShareLinkRecordService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicShareLinkRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicShareLinkRecordDTO.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 TopicShareLinkRecordDTO get(String id) { + TopicShareLinkRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicShareLinkRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicShareLinkRecordDTO dto) { + TopicShareLinkRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicShareLinkRecordDTO dto) { + TopicShareLinkRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkRecordEntity.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/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java new file mode 100644 index 0000000000..8719638483 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicShareLinkVisitRecordServiceImpl.java @@ -0,0 +1,82 @@ +package com.epmet.modules.topic.service.impl; + +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.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.topic.dao.TopicShareLinkVisitRecordDao; +import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; +import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; +import com.epmet.resi.group.dto.topic.TopicShareLinkVisitRecordDTO; +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 generator generator@elink-cn.com + * @since v1.0.0 2020-12-18 + */ +@Service +public class TopicShareLinkVisitRecordServiceImpl extends BaseServiceImpl implements TopicShareLinkVisitRecordService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, TopicShareLinkVisitRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, TopicShareLinkVisitRecordDTO.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 TopicShareLinkVisitRecordDTO get(String id) { + TopicShareLinkVisitRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, TopicShareLinkVisitRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TopicShareLinkVisitRecordDTO dto) { + TopicShareLinkVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkVisitRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TopicShareLinkVisitRecordDTO dto) { + TopicShareLinkVisitRecordEntity entity = ConvertUtils.sourceToTarget(dto, TopicShareLinkVisitRecordEntity.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/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml new file mode 100644 index 0000000000..bd2beb3aaa --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkRecordDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkVisitRecordDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkVisitRecordDao.xml new file mode 100644 index 0000000000..e17f1e1b1a --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicShareLinkVisitRecordDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file