diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java new file mode 100644 index 0000000000..a20c1d77ff --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java @@ -0,0 +1,105 @@ +/** + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 专题表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-15 + */ +@Data +public class SpecialSubjectDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键(专题id) + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 标签id + */ + private String tagId; + + /** + * 新增此专题的用户id + */ + private String addUserId; + + /** + * 新增此专题时用户所在的组织id或者网格id + */ + private String addOrgId; + + /** + * 网格:grid;社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province + */ + private String orgLevel; + + /** + * 新增此专题用户所属的组织id + */ + private String addUserAgencyId; + + /** + * 删除标识 0未删除;1已删除 + */ + 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/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java new file mode 100644 index 0000000000..37d780ce55 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java @@ -0,0 +1,39 @@ +/** + * 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.controller; + +import com.epmet.service.SpecialSubjectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 专题表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-15 + */ +@RestController +@RequestMapping("specialsubject") +public class SpecialSubjectController { + + @Autowired + private SpecialSubjectService specialSubjectService; + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/SpecialSubjectDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/SpecialSubjectDao.java new file mode 100644 index 0000000000..a4737a5ffc --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/SpecialSubjectDao.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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.SpecialSubjectEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 专题表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-15 + */ +@Mapper +public interface SpecialSubjectDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java new file mode 100644 index 0000000000..fd35ce2950 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java @@ -0,0 +1,75 @@ +/** + * 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.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 2021-07-15 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("special_subject") +public class SpecialSubjectEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 标签id + */ + private String tagId; + + /** + * 新增此专题的用户id + */ + private String addUserId; + + /** + * 新增此专题时用户所在的组织id或者网格id + */ + private String addOrgId; + + /** + * 网格:grid;社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province + */ + private String orgLevel; + + /** + * 新增此专题用户所属的组织id + */ + private String addUserAgencyId; + +} diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/SpecialSubjectService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/SpecialSubjectService.java new file mode 100644 index 0000000000..451910e743 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/SpecialSubjectService.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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.SpecialSubjectDTO; +import com.epmet.entity.SpecialSubjectEntity; + +import java.util.List; +import java.util.Map; + +/** + * 专题表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-07-15 + */ +public interface SpecialSubjectService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-07-15 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-07-15 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return SpecialSubjectDTO + * @author generator + * @date 2021-07-15 + */ + SpecialSubjectDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-07-15 + */ + void save(SpecialSubjectDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-07-15 + */ + void update(SpecialSubjectDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-07-15 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java new file mode 100644 index 0000000000..9bc8edba52 --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.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.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.dao.SpecialSubjectDao; +import com.epmet.dto.SpecialSubjectDTO; +import com.epmet.entity.SpecialSubjectEntity; +import com.epmet.service.SpecialSubjectService; +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-07-15 + */ +@Service +public class SpecialSubjectServiceImpl extends BaseServiceImpl implements SpecialSubjectService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, SpecialSubjectDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, SpecialSubjectDTO.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 SpecialSubjectDTO get(String id) { + SpecialSubjectEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, SpecialSubjectDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(SpecialSubjectDTO dto) { + SpecialSubjectEntity entity = ConvertUtils.sourceToTarget(dto, SpecialSubjectEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(SpecialSubjectDTO dto) { + SpecialSubjectEntity entity = ConvertUtils.sourceToTarget(dto, SpecialSubjectEntity.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-voice/gov-voice-server/src/main/resources/db/migration/V0.0.4__create_specialsubject.sql b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.4__create_specialsubject.sql new file mode 100644 index 0000000000..388674a0dc --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.4__create_specialsubject.sql @@ -0,0 +1,16 @@ +CREATE TABLE `special_subject` ( + `ID` varchar(64) NOT NULL COMMENT '主键(专题id)', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `TAG_ID` varchar(64) NOT NULL COMMENT '标签id', + `ADD_USER_ID` varchar(64) NOT NULL COMMENT '新增此专题的用户id', + `ADD_ORG_ID` varchar(64) NOT NULL COMMENT '新增此专题时用户所在的组织id或者网格id', + `ORG_LEVEL` varchar(10) NOT NULL COMMENT '网格:grid;社区级:community,\r\n乡(镇、街道)级:street,\r\n区县级: district,\r\n市级: city\r\n省级:province', + `ADD_USER_AGENCY_ID` varchar(64) NOT NULL COMMENT '新增此专题用户所属的组织id', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='专题表'; \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml new file mode 100644 index 0000000000..d671b8b4eb --- /dev/null +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file