Browse Source

议题标签管理功能 init

feature/syp_points
liuchuang 5 years ago
parent
commit
c56426cb86
  1. 9
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/FieldConstant.java
  2. 91
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/EventTagDTO.java
  3. 81
      esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/EventTagRelationDTO.java
  4. 94
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EventTagController.java
  5. 94
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EventTagRelationController.java
  6. 33
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EventTagDao.java
  7. 33
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EventTagRelationDao.java
  8. 61
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/EventTagEntity.java
  9. 51
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/EventTagRelationEntity.java
  10. 68
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/excel/EventTagExcel.java
  11. 62
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/excel/EventTagRelationExcel.java
  12. 47
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/redis/EventTagRedis.java
  13. 47
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/redis/EventTagRelationRedis.java
  14. 105
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EventTagRelationService.java
  15. 96
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EventTagService.java
  16. 109
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EventTagRelationServiceImpl.java
  17. 112
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EventTagServiceImpl.java
  18. 7
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EventTagDao.xml
  19. 7
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EventTagRelationDao.xml

9
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/constant/FieldConstant.java

@ -55,4 +55,13 @@ public interface FieldConstant {
String DEPT_ID = "DEPT_ID"; String DEPT_ID = "DEPT_ID";
String DEPT_ID_HUMP = "deptId"; String DEPT_ID_HUMP = "deptId";
String SORT = "SORT";
String SORT_HUMP = "sort";
String TAG_NAME = "TAG_NAME";
String TAG_NAME_HUMP = "tagName";
String TAG_ID = "TAG_ID";
String TAG_ID_HUMP = "tagId";
} }

91
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/EventTagDTO.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto.events;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 事件标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Data
public class EventTagDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 标签名称
*/
private String tagName;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Integer sort;
/**
* 启用标识 01
*/
private String enableFlag;
/**
* 删除标识 01
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

81
esua-epdc/epdc-module/epdc-events/epdc-events-client/src/main/java/com/elink/esua/epdc/dto/events/EventTagRelationDTO.java

@ -0,0 +1,81 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.dto.events;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 事件标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Data
public class EventTagRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
* 标签ID
*/
private String tagId;
/**
* 事件ID
*/
private String eventId;
/**
* 删除标识 01
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

94
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EventTagController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.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.events.EventTagDTO;
import com.elink.esua.epdc.modules.events.excel.EventTagExcel;
import com.elink.esua.epdc.modules.events.service.EventTagService;
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 qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@RestController
@RequestMapping("eventtag")
public class EventTagController {
@Autowired
private EventTagService eventTagService;
@GetMapping("page")
public Result<PageData<EventTagDTO>> page(@RequestParam Map<String, Object> params){
PageData<EventTagDTO> page = eventTagService.page(params);
return new Result<PageData<EventTagDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<EventTagDTO> get(@PathVariable("id") String id){
EventTagDTO data = eventTagService.get(id);
return new Result<EventTagDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody EventTagDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
eventTagService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody EventTagDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
eventTagService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
eventTagService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<EventTagDTO> list = eventTagService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, EventTagExcel.class);
}
}

94
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/controller/EventTagRelationController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.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.events.EventTagRelationDTO;
import com.elink.esua.epdc.modules.events.excel.EventTagRelationExcel;
import com.elink.esua.epdc.modules.events.service.EventTagRelationService;
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 qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@RestController
@RequestMapping("eventtagrelation")
public class EventTagRelationController {
@Autowired
private EventTagRelationService eventTagRelationService;
@GetMapping("page")
public Result<PageData<EventTagRelationDTO>> page(@RequestParam Map<String, Object> params){
PageData<EventTagRelationDTO> page = eventTagRelationService.page(params);
return new Result<PageData<EventTagRelationDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<EventTagRelationDTO> get(@PathVariable("id") String id){
EventTagRelationDTO data = eventTagRelationService.get(id);
return new Result<EventTagRelationDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody EventTagRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
eventTagRelationService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody EventTagRelationDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
eventTagRelationService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
eventTagRelationService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<EventTagRelationDTO> list = eventTagRelationService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, EventTagRelationExcel.class);
}
}

33
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EventTagDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.events.entity.EventTagEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 事件标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface EventTagDao extends BaseDao<EventTagEntity> {
}

33
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/dao/EventTagRelationDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.events.entity.EventTagRelationEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 事件标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface EventTagRelationDao extends BaseDao<EventTagRelationEntity> {
}

61
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/EventTagEntity.java

@ -0,0 +1,61 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 事件标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_event_tag")
public class EventTagEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 标签名称
*/
private String tagName;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Integer sort;
/**
* 启用标识 01
*/
private String enableFlag;
}

51
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/entity/EventTagRelationEntity.java

@ -0,0 +1,51 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 事件标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("epdc_event_tag_relation")
public class EventTagRelationEntity extends BaseEpdcEntity {
private static final long serialVersionUID = 1L;
/**
* 标签ID
*/
private String tagId;
/**
* 事件ID
*/
private String eventId;
}

68
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/excel/EventTagExcel.java

@ -0,0 +1,68 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 事件标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Data
public class EventTagExcel {
@Excel(name = "ID")
private String id;
@Excel(name = "标签名称")
private String tagName;
@Excel(name = "描述")
private String description;
@Excel(name = "排序")
private Integer sort;
@Excel(name = "启用标识 0:否,1:是")
private String enableFlag;
@Excel(name = "删除标识 0:否,1:是")
private String delFlag;
@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;
}

62
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/excel/EventTagRelationExcel.java

@ -0,0 +1,62 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 事件标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Data
public class EventTagRelationExcel {
@Excel(name = "ID")
private String id;
@Excel(name = "标签ID")
private String tagId;
@Excel(name = "事件ID")
private String eventId;
@Excel(name = "删除标识 0:否,1:是")
private String delFlag;
@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;
}

47
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/redis/EventTagRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 事件标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Component
public class EventTagRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

47
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/redis/EventTagRelationRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.redis;
import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 事件标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Component
public class EventTagRelationRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

105
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EventTagRelationService.java

@ -0,0 +1,105 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.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.events.EventTagRelationDTO;
import com.elink.esua.epdc.modules.events.entity.EventTagRelationEntity;
import java.util.List;
import java.util.Map;
/**
* 事件标签关系表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
public interface EventTagRelationService extends BaseService<EventTagRelationEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<EventTagRelationDTO>
* @author generator
* @date 2020-09-02
*/
PageData<EventTagRelationDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<EventTagRelationDTO>
* @author generator
* @date 2020-09-02
*/
List<EventTagRelationDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return EventTagRelationDTO
* @author generator
* @date 2020-09-02
*/
EventTagRelationDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-09-02
*/
void save(EventTagRelationDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-09-02
*/
void update(EventTagRelationDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-09-02
*/
void delete(String[] ids);
/**
* 校验标签是否被使用
*
* @param tagId 标签ID
* @return java.lang.Boolean
* @author Liuchuang
* @since 2020/9/2 13:41
*/
Boolean checkTagRelationEvents(String tagId);
}

96
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/EventTagService.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.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.events.EventTagDTO;
import com.elink.esua.epdc.modules.events.entity.EventTagEntity;
import java.util.List;
import java.util.Map;
/**
* 事件标签表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
public interface EventTagService extends BaseService<EventTagEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<EventTagDTO>
* @author generator
* @date 2020-09-02
*/
PageData<EventTagDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<EventTagDTO>
* @author generator
* @date 2020-09-02
*/
List<EventTagDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return EventTagDTO
* @author generator
* @date 2020-09-02
*/
EventTagDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-09-02
*/
void save(EventTagDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-09-02
*/
void update(EventTagDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-09-02
*/
void delete(String[] ids);
}

109
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EventTagRelationServiceImpl.java

@ -0,0 +1,109 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dto.events.EventTagRelationDTO;
import com.elink.esua.epdc.modules.events.dao.EventTagRelationDao;
import com.elink.esua.epdc.modules.events.entity.EventTagRelationEntity;
import com.elink.esua.epdc.modules.events.service.EventTagRelationService;
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 qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Service
public class EventTagRelationServiceImpl extends BaseServiceImpl<EventTagRelationDao, EventTagRelationEntity> implements EventTagRelationService {
@Override
public PageData<EventTagRelationDTO> page(Map<String, Object> params) {
IPage<EventTagRelationEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, EventTagRelationDTO.class);
}
@Override
public List<EventTagRelationDTO> list(Map<String, Object> params) {
List<EventTagRelationEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, EventTagRelationDTO.class);
}
private QueryWrapper<EventTagRelationEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<EventTagRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public EventTagRelationDTO get(String id) {
EventTagRelationEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, EventTagRelationDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(EventTagRelationDTO dto) {
EventTagRelationEntity entity = ConvertUtils.sourceToTarget(dto, EventTagRelationEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(EventTagRelationDTO dto) {
EventTagRelationEntity entity = ConvertUtils.sourceToTarget(dto, EventTagRelationEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public Boolean checkTagRelationEvents(String tagId) {
QueryWrapper<EventTagRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(tagId), FieldConstant.TAG_ID, tagId);
wrapper.eq(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR);
int relationCount = baseDao.selectCount(wrapper);
return relationCount > NumConstant.ZERO;
}
}

112
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/events/service/impl/EventTagServiceImpl.java

@ -0,0 +1,112 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.events.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
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.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.dto.events.EventTagDTO;
import com.elink.esua.epdc.modules.events.dao.EventTagDao;
import com.elink.esua.epdc.modules.events.entity.EventTagEntity;
import com.elink.esua.epdc.modules.events.service.EventTagRelationService;
import com.elink.esua.epdc.modules.events.service.EventTagService;
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 qu qu@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Service
public class EventTagServiceImpl extends BaseServiceImpl<EventTagDao, EventTagEntity> implements EventTagService {
@Autowired
private EventTagRelationService eventTagRelationService;
@Override
public PageData<EventTagDTO> page(Map<String, Object> params) {
IPage<EventTagEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.SORT, true),
getWrapper(params)
);
return getPageData(page, EventTagDTO.class);
}
@Override
public List<EventTagDTO> list(Map<String, Object> params) {
List<EventTagEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, EventTagDTO.class);
}
private QueryWrapper<EventTagEntity> getWrapper(Map<String, Object> params){
String tagName = (String)params.get(FieldConstant.TAG_NAME_HUMP);
QueryWrapper<EventTagEntity> wrapper = new QueryWrapper<>();
wrapper.like(FieldConstant.TAG_NAME, tagName.trim());
return wrapper;
}
@Override
public EventTagDTO get(String id) {
EventTagEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, EventTagDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(EventTagDTO dto) {
EventTagEntity entity = ConvertUtils.sourceToTarget(dto, EventTagEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(EventTagDTO dto) {
EventTagEntity entity = ConvertUtils.sourceToTarget(dto, EventTagEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 删除校验
Boolean relationed = eventTagRelationService.checkTagRelationEvents(ids[NumConstant.ZERO]);
if (relationed) {
throw new RenException("当前标签被使用,不能删除");
} else {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
}

7
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EventTagDao.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.events.dao.EventTagDao">
</mapper>

7
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/resources/mapper/events/EventTagRelationDao.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.elink.esua.epdc.modules.events.dao.EventTagRelationDao">
</mapper>
Loading…
Cancel
Save