From e75396aaaad8ebf7c1e964327e7e13f0b1a0d223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=98=89=E4=BC=9F?= <1724121454@qq.com> Date: Tue, 20 Jul 2021 14:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=B1=BB=E5=9E=8B=E8=A1=A8?= =?UTF-8?q?=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MessageTypeController.java | 128 +++++ .../meapi/mapper/MessageTypeMapper.java | 18 + .../mesnac/meapi/model/MessageType.java | 246 ++++++++++ .../meapi/service/MessageTypeService.java | 28 ++ .../service/impl/MessageTypeServiceImpl.java | 46 ++ .../resources/mapper/MessageTypeMapper.xml | 444 ++++++++++++++++++ 6 files changed, 910 insertions(+) create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/MessageTypeController.java create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/MessageTypeMapper.java create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/model/MessageType.java create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/service/MessageTypeService.java create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/MessageTypeServiceImpl.java create mode 100644 meapi/src/main/resources/mapper/MessageTypeMapper.xml diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/MessageTypeController.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/MessageTypeController.java new file mode 100644 index 00000000..de62790c --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/controller/MessageTypeController.java @@ -0,0 +1,128 @@ +package com.foreverwin.mesnac.meapi.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.meapi.model.MessageType; +import com.foreverwin.mesnac.meapi.service.MessageTypeService; +import com.foreverwin.modular.core.util.FrontPage; +import com.foreverwin.modular.core.util.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * + * @author Philip + * @since 2021-07-20 + */ +@RestController +@RequestMapping("/MESSAGE-TYPE") +public class MessageTypeController { + + @Autowired + public MessageTypeService messageTypeService; + + /** + * 根据id查询 + * + * @param id 主键 + * @return + */ + @ResponseBody + @GetMapping("/{id:.+}") + public R getMessageTypeById(@PathVariable String id) { + return R.ok( messageTypeService.getById(id)); + } + + /** + * 查询所有数据 + * + * @return + */ + @ResponseBody + @GetMapping("") + public R getMessageTypeList(MessageType messageType){ + List result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(messageType); + result = messageTypeService.list(queryWrapper); + return R.ok(result); + } + + /** + * 分页查询数据 + * + * @param frontPage 分页信息 + * @return + */ + @ResponseBody + @GetMapping("/page") + public R page(FrontPage frontPage, MessageType messageType){ + IPage result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(messageType); + if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { + //TODO modify global query + queryWrapper.lambda().and(wrapper -> wrapper + .like(MessageType::getHandle, frontPage.getGlobalQuery()) + .or().like(MessageType::getSite, frontPage.getGlobalQuery()) + .or().like(MessageType::getMessageType, frontPage.getGlobalQuery()) + .or().like(MessageType::getDescription, frontPage.getGlobalQuery()) + .or().like(MessageType::getSeverity, frontPage.getGlobalQuery()) + .or().like(MessageType::getProcessWorkflowBo, frontPage.getGlobalQuery()) + .or().like(MessageType::getEnabled, frontPage.getGlobalQuery()) + .or().like(MessageType::getSubject, frontPage.getGlobalQuery()) + .or().like(MessageType::getBody, frontPage.getGlobalQuery()) + .or().like(MessageType::getAutoClose, frontPage.getGlobalQuery()) + .or().like(MessageType::getAutoCloseIntervalUnit, frontPage.getGlobalQuery()) + .or().like(MessageType::getAutoClosedByWf, frontPage.getGlobalQuery()) + .or().like(MessageType::getSignalFlag, frontPage.getGlobalQuery()) + ); + } + result = messageTypeService.page(frontPage.getPagePlus(), queryWrapper); + return R.ok(result); + } + + /** + * 新增 + * @param messageType 传递的实体 + * @return null 失败 实体成功 + */ + @PostMapping + public R save(@RequestBody MessageType messageType) { + return R.ok(messageTypeService.save(messageType)); + } + + /** + * 修改 + * @param messageType 传递的实体 + * @return null 失败 实体成功 + */ + @PutMapping + public R updateById(@RequestBody MessageType messageType) { + return R.ok(messageTypeService.updateById(messageType)); + } + + /** + * 根据id删除对象 + * @param id 实体ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}") + public R removeById(@PathVariable("id") String id){ + return R.ok(messageTypeService.removeById(id)); + } + + /** + * 批量删除对象 + * @param ids 实体集合ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.POST, value = "/delete-batch") + public R removeByIds(List ids){ + return R.ok(messageTypeService.removeByIds(ids)); + } +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/MessageTypeMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/MessageTypeMapper.java new file mode 100644 index 00000000..8d1ba4e4 --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/MessageTypeMapper.java @@ -0,0 +1,18 @@ +package com.foreverwin.mesnac.meapi.mapper; + +import com.foreverwin.mesnac.meapi.model.MessageType; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Philip + * @since 2021-07-20 + */ +@Repository +public interface MessageTypeMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/MessageType.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/MessageType.java new file mode 100644 index 00000000..8a87ef45 --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/MessageType.java @@ -0,0 +1,246 @@ +package com.foreverwin.mesnac.meapi.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Philip + * @since 2021-07-20 + */ + +@TableName("MESSAGE_TYPE") + +public class MessageType extends Model { + + private static final long serialVersionUID = 1L; + + @TableField("HANDLE") + private String handle; + @TableField("SITE") + private String site; + @TableField("MESSAGE_TYPE") + private String messageType; + @TableField("DESCRIPTION") + private String description; + @TableField("SEVERITY") + private String severity; + @TableField("PROCESS_WORKFLOW_BO") + private String processWorkflowBo; + @TableField("ENABLED") + private String enabled; + @TableField("SUBJECT") + private String subject; + @TableField("BODY") + private String body; + @TableField("AUTO_CLOSE") + private String autoClose; + @TableField("AUTO_CLOSE_INTERVAL") + private Long autoCloseInterval; + @TableField("AUTO_CLOSE_INTERVAL_UNIT") + private String autoCloseIntervalUnit; + @TableField("AUTO_CLOSED_BY_WF") + private String autoClosedByWf; + @TableField("SIGNAL_FLAG") + private String signalFlag; + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + @TableField("MODIFIED_DATE_TIME") + private LocalDateTime modifiedDateTime; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getMessageType() { + return messageType; + } + + public void setMessageType(String messageType) { + this.messageType = messageType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getSeverity() { + return severity; + } + + public void setSeverity(String severity) { + this.severity = severity; + } + + public String getProcessWorkflowBo() { + return processWorkflowBo; + } + + public void setProcessWorkflowBo(String processWorkflowBo) { + this.processWorkflowBo = processWorkflowBo; + } + + public String getEnabled() { + return enabled; + } + + public void setEnabled(String enabled) { + this.enabled = enabled; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public String getAutoClose() { + return autoClose; + } + + public void setAutoClose(String autoClose) { + this.autoClose = autoClose; + } + + public Long getAutoCloseInterval() { + return autoCloseInterval; + } + + public void setAutoCloseInterval(Long autoCloseInterval) { + this.autoCloseInterval = autoCloseInterval; + } + + public String getAutoCloseIntervalUnit() { + return autoCloseIntervalUnit; + } + + public void setAutoCloseIntervalUnit(String autoCloseIntervalUnit) { + this.autoCloseIntervalUnit = autoCloseIntervalUnit; + } + + public String getAutoClosedByWf() { + return autoClosedByWf; + } + + public void setAutoClosedByWf(String autoClosedByWf) { + this.autoClosedByWf = autoClosedByWf; + } + + public String getSignalFlag() { + return signalFlag; + } + + public void setSignalFlag(String signalFlag) { + this.signalFlag = signalFlag; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public LocalDateTime getModifiedDateTime() { + return modifiedDateTime; + } + + public void setModifiedDateTime(LocalDateTime modifiedDateTime) { + this.modifiedDateTime = modifiedDateTime; + } + +public static final String HANDLE = "HANDLE"; + +public static final String SITE = "SITE"; + +public static final String MESSAGE_TYPE = "MESSAGE_TYPE"; + +public static final String DESCRIPTION = "DESCRIPTION"; + +public static final String SEVERITY = "SEVERITY"; + +public static final String PROCESS_WORKFLOW_BO = "PROCESS_WORKFLOW_BO"; + +public static final String ENABLED = "ENABLED"; + +public static final String SUBJECT = "SUBJECT"; + +public static final String BODY = "BODY"; + +public static final String AUTO_CLOSE = "AUTO_CLOSE"; + +public static final String AUTO_CLOSE_INTERVAL = "AUTO_CLOSE_INTERVAL"; + +public static final String AUTO_CLOSE_INTERVAL_UNIT = "AUTO_CLOSE_INTERVAL_UNIT"; + +public static final String AUTO_CLOSED_BY_WF = "AUTO_CLOSED_BY_WF"; + +public static final String SIGNAL_FLAG = "SIGNAL_FLAG"; + +public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; + +public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "MessageType{" + + "handle = " + handle + + ", site = " + site + + ", messageType = " + messageType + + ", description = " + description + + ", severity = " + severity + + ", processWorkflowBo = " + processWorkflowBo + + ", enabled = " + enabled + + ", subject = " + subject + + ", body = " + body + + ", autoClose = " + autoClose + + ", autoCloseInterval = " + autoCloseInterval + + ", autoCloseIntervalUnit = " + autoCloseIntervalUnit + + ", autoClosedByWf = " + autoClosedByWf + + ", signalFlag = " + signalFlag + + ", createdDateTime = " + createdDateTime + + ", modifiedDateTime = " + modifiedDateTime + + "}"; + } +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/MessageTypeService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/MessageTypeService.java new file mode 100644 index 00000000..d9b18496 --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/MessageTypeService.java @@ -0,0 +1,28 @@ +package com.foreverwin.mesnac.meapi.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.meapi.model.MessageType; +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.modular.core.util.FrontPage; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Philip + * @since 2021-07-20 + */ +public interface MessageTypeService extends IService { + + /** + * 分页查询 + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, MessageType messageType); + + List selectList(MessageType messageType); +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/MessageTypeServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/MessageTypeServiceImpl.java new file mode 100644 index 00000000..7edc9292 --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/MessageTypeServiceImpl.java @@ -0,0 +1,46 @@ +package com.foreverwin.mesnac.meapi.service.impl; + +import com.foreverwin.modular.core.util.FrontPage; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.meapi.model.MessageType; +import com.foreverwin.mesnac.meapi.mapper.MessageTypeMapper; +import com.foreverwin.mesnac.meapi.service.MessageTypeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +/** + *

+ * 服务实现类 + *

+ * + * @author Philip + * @since 2021-07-20 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class MessageTypeServiceImpl extends ServiceImpl implements MessageTypeService { + + + @Autowired + private MessageTypeMapper messageTypeMapper; + + @Override + public IPage selectPage(FrontPage frontPage, MessageType messageType) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(messageType); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(MessageType messageType) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(messageType); + return super.list(queryWrapper); + } + + +} \ No newline at end of file diff --git a/meapi/src/main/resources/mapper/MessageTypeMapper.xml b/meapi/src/main/resources/mapper/MessageTypeMapper.xml new file mode 100644 index 00000000..938315c4 --- /dev/null +++ b/meapi/src/main/resources/mapper/MessageTypeMapper.xml @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + HANDLE, SITE, MESSAGE_TYPE, DESCRIPTION, SEVERITY, PROCESS_WORKFLOW_BO, ENABLED, SUBJECT, BODY, AUTO_CLOSE, AUTO_CLOSE_INTERVAL, AUTO_CLOSE_INTERVAL_UNIT, AUTO_CLOSED_BY_WF, SIGNAL_FLAG, CREATED_DATE_TIME, MODIFIED_DATE_TIME + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO MESSAGE_TYPE + + HANDLE, + SITE, + MESSAGE_TYPE, + DESCRIPTION, + SEVERITY, + PROCESS_WORKFLOW_BO, + ENABLED, + SUBJECT, + BODY, + AUTO_CLOSE, + AUTO_CLOSE_INTERVAL, + AUTO_CLOSE_INTERVAL_UNIT, + AUTO_CLOSED_BY_WF, + SIGNAL_FLAG, + CREATED_DATE_TIME, + MODIFIED_DATE_TIME, + VALUES + + #{handle}, + #{site}, + #{messageType}, + #{description}, + #{severity}, + #{processWorkflowBo}, + #{enabled}, + #{subject}, + #{body}, + #{autoClose}, + #{autoCloseInterval}, + #{autoCloseIntervalUnit}, + #{autoClosedByWf}, + #{signalFlag}, + #{createdDateTime}, + #{modifiedDateTime}, + + + + + INSERT INTO MESSAGE_TYPE + + + VALUES + + #{handle}, + #{site}, + #{messageType}, + #{description}, + #{severity}, + #{processWorkflowBo}, + #{enabled}, + #{subject}, + #{body}, + #{autoClose}, + #{autoCloseInterval}, + #{autoCloseIntervalUnit}, + #{autoClosedByWf}, + #{signalFlag}, + #{createdDateTime}, + #{modifiedDateTime}, + + + + + + + + + + UPDATE MESSAGE_TYPE + HANDLE=#{et.handle}, + SITE=#{et.site}, + MESSAGE_TYPE=#{et.messageType}, + DESCRIPTION=#{et.description}, + SEVERITY=#{et.severity}, + PROCESS_WORKFLOW_BO=#{et.processWorkflowBo}, + ENABLED=#{et.enabled}, + SUBJECT=#{et.subject}, + BODY=#{et.body}, + AUTO_CLOSE=#{et.autoClose}, + AUTO_CLOSE_INTERVAL=#{et.autoCloseInterval}, + AUTO_CLOSE_INTERVAL_UNIT=#{et.autoCloseIntervalUnit}, + AUTO_CLOSED_BY_WF=#{et.autoClosedByWf}, + SIGNAL_FLAG=#{et.signalFlag}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + + + + + HANDLE=#{ew.entity.handle} + AND SITE=#{ew.entity.site} + AND MESSAGE_TYPE=#{ew.entity.messageType} + AND DESCRIPTION=#{ew.entity.description} + AND SEVERITY=#{ew.entity.severity} + AND PROCESS_WORKFLOW_BO=#{ew.entity.processWorkflowBo} + AND ENABLED=#{ew.entity.enabled} + AND SUBJECT=#{ew.entity.subject} + AND BODY=#{ew.entity.body} + AND AUTO_CLOSE=#{ew.entity.autoClose} + AND AUTO_CLOSE_INTERVAL=#{ew.entity.autoCloseInterval} + AND AUTO_CLOSE_INTERVAL_UNIT=#{ew.entity.autoCloseIntervalUnit} + AND AUTO_CLOSED_BY_WF=#{ew.entity.autoClosedByWf} + AND SIGNAL_FLAG=#{ew.entity.signalFlag} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + + DELETE FROM MESSAGE_TYPE + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM MESSAGE_TYPE + + + + + HANDLE=#{ew.entity.handle} + + AND SITE=#{ew.entity.site} + AND MESSAGE_TYPE=#{ew.entity.messageType} + AND DESCRIPTION=#{ew.entity.description} + AND SEVERITY=#{ew.entity.severity} + AND PROCESS_WORKFLOW_BO=#{ew.entity.processWorkflowBo} + AND ENABLED=#{ew.entity.enabled} + AND SUBJECT=#{ew.entity.subject} + AND BODY=#{ew.entity.body} + AND AUTO_CLOSE=#{ew.entity.autoClose} + AND AUTO_CLOSE_INTERVAL=#{ew.entity.autoCloseInterval} + AND AUTO_CLOSE_INTERVAL_UNIT=#{ew.entity.autoCloseIntervalUnit} + AND AUTO_CLOSED_BY_WF=#{ew.entity.autoClosedByWf} + AND SIGNAL_FLAG=#{ew.entity.signalFlag} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + +