diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/GroupMessageDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/GroupMessageDTO.java new file mode 100644 index 0000000000..89b86f29b1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/GroupMessageDTO.java @@ -0,0 +1,97 @@ +/** + * 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.group; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 组内消息(话题、通知、活动)记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-22 + */ +@Data +public class GroupMessageDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格id + */ + private String gridId; + + /** + * 话题:topic; 通知:notice; 活动:act + */ + private String type; + + /** + * 话题id , 通知id,活动id + */ + private String messageId; + + /** + * 发布人用户id + */ + private String publishUserId; + + /** + * 逻辑删除标识 + */ + private String 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/group/dao/GroupMessageDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupMessageDao.java new file mode 100644 index 0000000000..bbb804e7e5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/dao/GroupMessageDao.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.epmet.modules.group.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.group.entity.GroupMessageEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 组内消息(话题、通知、活动)记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-22 + */ +@Mapper +public interface GroupMessageDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupMessageEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupMessageEntity.java new file mode 100644 index 0000000000..b3a9929d77 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/entity/GroupMessageEntity.java @@ -0,0 +1,63 @@ +/** + * 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.group.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 2021-04-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("group_message") +public class GroupMessageEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格id + */ + private String gridId; + + /** + * 话题:topic; 通知:notice; 活动:act + */ + private String type; + + /** + * 话题id , 通知id,活动id + */ + private String messageId; + + /** + * 发布人用户id + */ + private String publishUserId; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/GroupMessageService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/GroupMessageService.java new file mode 100644 index 0000000000..0c0db25275 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/GroupMessageService.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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.group.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.GroupMessageDTO; +import com.epmet.modules.group.entity.GroupMessageEntity; + +import java.util.List; +import java.util.Map; + +/** + * 组内消息(话题、通知、活动)记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-04-22 + */ +public interface GroupMessageService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupMessageDTO + * @author generator + * @date 2021-04-22 + */ + GroupMessageDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-22 + */ + void save(GroupMessageDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-04-22 + */ + void update(GroupMessageDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-04-22 + */ + 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/group/service/impl/GroupMessageServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/GroupMessageServiceImpl.java new file mode 100644 index 0000000000..d0d01fb921 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/GroupMessageServiceImpl.java @@ -0,0 +1,99 @@ +/** + * 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.group.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.dto.GroupMessageDTO; +import com.epmet.modules.group.dao.GroupMessageDao; +import com.epmet.modules.group.entity.GroupMessageEntity; +import com.epmet.modules.group.service.GroupMessageService; +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 2021-04-22 + */ +@Service +public class GroupMessageServiceImpl extends BaseServiceImpl implements GroupMessageService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupMessageDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupMessageDTO.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 GroupMessageDTO get(String id) { + GroupMessageEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupMessageDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupMessageDTO dto) { + GroupMessageEntity entity = ConvertUtils.sourceToTarget(dto, GroupMessageEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupMessageDTO dto) { + GroupMessageEntity entity = ConvertUtils.sourceToTarget(dto, GroupMessageEntity.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/group/GroupMessageDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupMessageDao.xml new file mode 100644 index 0000000000..289b4fdce5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/GroupMessageDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file