Browse Source

1、消息模板

develop
bobol 7 months ago
parent
commit
37514af847
  1. 131
      lzbi-module/src/main/java/com/lzbi/message/controller/DcMessageSendLogController.java
  2. 162
      lzbi-module/src/main/java/com/lzbi/message/controller/DcMessageTemplateController.java
  3. 74
      lzbi-module/src/main/java/com/lzbi/message/domain/DcMessageSendLog.java
  4. 39
      lzbi-module/src/main/java/com/lzbi/message/domain/DcMessageTemplate.java
  5. 37
      lzbi-module/src/main/java/com/lzbi/message/domain/DcMessageTemplateType.java
  6. 27
      lzbi-module/src/main/java/com/lzbi/message/domain/req/MessageTemplateChoiceTypeReq.java
  7. 63
      lzbi-module/src/main/java/com/lzbi/message/mapper/DcMessageSendLogMapper.java
  8. 63
      lzbi-module/src/main/java/com/lzbi/message/mapper/DcMessageTemplateMapper.java
  9. 63
      lzbi-module/src/main/java/com/lzbi/message/mapper/DcMessageTemplateTypeMapper.java
  10. 91
      lzbi-module/src/main/java/com/lzbi/message/service/DcMessageSendLogService.java
  11. 93
      lzbi-module/src/main/java/com/lzbi/message/service/DcMessageTemplateService.java
  12. 114
      lzbi-module/src/main/java/com/lzbi/message/service/DcMessageTemplateTypeService.java
  13. 103
      lzbi-module/src/main/resources/mapper/message/DcMessageSendLogMapper.xml
  14. 83
      lzbi-module/src/main/resources/mapper/message/DcMessageTemplateMapper.xml
  15. 59
      lzbi-module/src/main/resources/mapper/message/DcMessageTemplateTypeMapper.xml

131
lzbi-module/src/main/java/com/lzbi/message/controller/DcMessageSendLogController.java

@ -0,0 +1,131 @@
package com.lzbi.message.controller;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lzbi.common.annotation.Log;
import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.enums.BusinessType;
import com.lzbi.message.domain. DcMessageSendLog;
import com.lzbi.message.service.DcMessageSendLogService;
import com.lzbi.common.utils.poi.ExcelUtil;
import com.lzbi.common.core.page.TableDataInfo;
/**
* 消息发送日志Controller
*
* @author Enbo Li
* @date 2024-04-23
*/
@RestController
@RequestMapping("/message/DcMessageSendLog")
public class DcMessageSendLogController extends BaseController
{
@Autowired
private DcMessageSendLogService dcMessageSendLogService;
/**
* 查询消息发送日志列表
*/
@ApiOperation("查询消息发送日志列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageSendLog", value = "", dataType = "DcMessageSendLog", dataTypeClass = DcMessageSendLog.class),
})
@PreAuthorize("@ss.hasPermi('message:DcMessageSendLog:list')")
@GetMapping("/list")
public TableDataInfo list(DcMessageSendLog DcMessageSendLog)
{
startPage();
List< DcMessageSendLog> list = dcMessageSendLogService.selectDcMessageSendLogList(DcMessageSendLog);
return getDataTable(list);
}
/**
* 导出消息发送日志列表
*/
@ApiOperation("导出消息发送日志列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageSendLog", value = "", dataType = "DcMessageSendLog", dataTypeClass = DcMessageSendLog.class),
})
@PreAuthorize("@ss.hasPermi('message:DcMessageSendLog:export')")
@Log(title = "消息发送日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response,DcMessageSendLog DcMessageSendLog)
{
List<DcMessageSendLog> list = dcMessageSendLogService.selectDcMessageSendLogList(DcMessageSendLog);
ExcelUtil<DcMessageSendLog> util = new ExcelUtil<DcMessageSendLog>(DcMessageSendLog.class);
util.exportExcel(response, list, "消息发送日志数据");
}
/**
* 获取消息发送日志详细信息
*/
@ApiOperation("获取消息发送日志详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class),
})
@PreAuthorize("@ss.hasPermi('message:DcMessageSendLog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(dcMessageSendLogService.selectDcMessageSendLogById(id));
}
/**
* 新增消息发送日志
*/
@ApiOperation("新增消息发送日志")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageSendLog", value = "", dataType = "DcMessageSendLog", dataTypeClass = DcMessageSendLog.class),
})
@PreAuthorize("@ss.hasPermi('message:DcMessageSendLog:add')")
@Log(title = "消息发送日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcMessageSendLog DcMessageSendLog)
{
return toAjax(dcMessageSendLogService.insertDcMessageSendLog(DcMessageSendLog));
}
/**
* 修改消息发送日志
*/
@ApiOperation("修改消息发送日志")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageSendLog", value = "", dataType = "DcMessageSendLog", dataTypeClass = DcMessageSendLog.class),
})
@PreAuthorize("@ss.hasPermi('message:DcMessageSendLog:edit')")
@Log(title = "消息发送日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcMessageSendLog DcMessageSendLog)
{
return toAjax(dcMessageSendLogService.updateDcMessageSendLog(DcMessageSendLog));
}
/**
* 删除消息发送日志
*/
@ApiOperation("删除消息发送日志")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "", dataType = "Long", dataTypeClass =Long.class),
})
@PreAuthorize("@ss.hasPermi('message:DcMessageSendLog:remove')")
@Log(title = "消息发送日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcMessageSendLogService.deleteDcMessageSendLogByIds(ids));
}
}

162
lzbi-module/src/main/java/com/lzbi/message/controller/DcMessageTemplateController.java

@ -0,0 +1,162 @@
package com.lzbi.message.controller;
import com.lzbi.message.domain.req.MessageTemplateChoiceTypeReq;
import com.lzbi.message.service.DcMessageTemplateTypeService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lzbi.common.annotation.Log;
import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.enums.BusinessType;
import com.lzbi.message.domain. DcMessageTemplate;
import com.lzbi.message.service.DcMessageTemplateService;
import com.lzbi.common.utils.poi.ExcelUtil;
import com.lzbi.common.core.page.TableDataInfo;
/**
* 消息模板Controller
*
* @author Enbo Li
* @date 2024-04-23
*/
@RestController
@RequestMapping("/message/dcMessageTemplate")
public class DcMessageTemplateController extends BaseController
{
@Autowired
private DcMessageTemplateService dcMessageTemplateService;
@Autowired
private DcMessageTemplateTypeService dcMessageTemplateTypeService;
/**
* 查询消息模板列表
*/
@ApiOperation("查询消息模板列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageTemplate", value = "", dataType = "DcMessageTemplate", dataTypeClass = DcMessageTemplate.class),
})
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:list')")
@GetMapping("/list")
public TableDataInfo list(DcMessageTemplate DcMessageTemplate)
{
startPage();
List< DcMessageTemplate> list = dcMessageTemplateService.selectDcMessageTemplateList(DcMessageTemplate);
return getDataTable(list);
}
/**
* 导出消息模板列表
*/
@ApiOperation("导出消息模板列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageTemplate", value = "", dataType = "DcMessageTemplate", dataTypeClass = DcMessageTemplate.class),
})
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:export')")
@Log(title = "消息模板", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response,DcMessageTemplate DcMessageTemplate)
{
List<DcMessageTemplate> list = dcMessageTemplateService.selectDcMessageTemplateList(DcMessageTemplate);
ExcelUtil<DcMessageTemplate> util = new ExcelUtil<DcMessageTemplate>(DcMessageTemplate.class);
util.exportExcel(response, list, "消息模板数据");
}
/**
* 获取消息模板详细信息
*/
@ApiOperation("获取消息模板详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class),
})
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(dcMessageTemplateService.selectDcMessageTemplateById(id));
}
/**
* 获取类型列表
*/
@ApiOperation("获取类型列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class),
})
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:query')")
@GetMapping(value = "/type/{id}")
public AjaxResult getTypeList(@PathVariable("id") Long id)
{
return success(dcMessageTemplateTypeService.selectTypeListByMessageTemplateId(id));
}
/**
* 选择类型
*/
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:choice-type')")
@Log(title = "消息模板", businessType = BusinessType.INSERT)
@PostMapping("/choice-type")
public AjaxResult choiceType(@Validated @RequestBody MessageTemplateChoiceTypeReq messageTemplateChoiceTypeReq)
{
return toAjax(dcMessageTemplateTypeService.choiceType(messageTemplateChoiceTypeReq));
}
/**
* 新增消息模板
*/
@ApiOperation("新增消息模板")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageTemplate", value = "", dataType = "DcMessageTemplate", dataTypeClass = DcMessageTemplate.class),
})
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:add')")
@Log(title = "消息模板", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcMessageTemplate DcMessageTemplate)
{
return toAjax(dcMessageTemplateService.insertDcMessageTemplate(DcMessageTemplate));
}
/**
* 修改消息模板
*/
@ApiOperation("修改消息模板")
@ApiImplicitParams({
@ApiImplicitParam(name = "DcMessageTemplate", value = "", dataType = "DcMessageTemplate", dataTypeClass = DcMessageTemplate.class),
})
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:edit')")
@Log(title = "消息模板", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcMessageTemplate DcMessageTemplate)
{
return toAjax(dcMessageTemplateService.updateDcMessageTemplate(DcMessageTemplate));
}
/**
* 删除消息模板
*/
@ApiOperation("删除消息模板")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "", dataType = "Long", dataTypeClass =Long.class),
})
@PreAuthorize("@ss.hasPermi('message:dcMessageTemplate:remove')")
@Log(title = "消息模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcMessageTemplateService.deleteDcMessageTemplateByIds(ids));
}
}

74
lzbi-module/src/main/java/com/lzbi/message/domain/DcMessageSendLog.java

@ -0,0 +1,74 @@
package com.lzbi.message.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import lombok.experimental.Accessors;
import com.lzbi.common.annotation.Excel;
import com.lzbi.module.base.BaseModuleEntity;
/**
* 消息发送日志对象 dc_message_send_log
*
* @author Enbo Li
* @date 2024-04-23
*/
@Data
@Accessors(chain = true)
public class DcMessageSendLog extends BaseModuleEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 消息模板主键ID */
@Excel(name = "消息模板主键ID")
@ApiModelProperty(name = "消息模板主键ID",notes = "messageTemplateId")
private Long messageTemplateId;
/** 类型 */
@Excel(name = "类型")
@ApiModelProperty(name = "类型",notes = "type")
private String type;
/** 用户ID */
@Excel(name = "用户ID")
@ApiModelProperty(name = "用户ID",notes = "userId")
private Long userId;
/** 消息内容 */
@Excel(name = "消息内容")
@ApiModelProperty(name = "消息内容",notes = "messageContent")
private String messageContent;
/** 发送时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name = "发送时间",notes = "")
private Date sendTime;
/** 发送结果 */
@Excel(name = "发送结果")
@ApiModelProperty(name = "发送结果",notes = "sendResult")
private String sendResult;
/** 创建者 */
private String createdBy;
/** 创建时间 */
private Date createdTime;
/** 更新者 */
private String updatedBy;
/** 更新时间 */
private Date updatedTime;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
}

39
lzbi-module/src/main/java/com/lzbi/message/domain/DcMessageTemplate.java

@ -0,0 +1,39 @@
package com.lzbi.message.domain;
import com.lzbi.common.annotation.Excel;
import com.lzbi.module.base.BaseModuleEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 消息模板对象 dc_message_template
*
* @author Enbo Li
* @date 2024-04-23
*/
@Data
@Accessors(chain = true)
public class DcMessageTemplate extends BaseModuleEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 模板ID */
@Excel(name = "模板ID")
@ApiModelProperty(name = "模板ID",notes = "templateId")
private String templateId;
/** 模板名称 */
@Excel(name = "模板名称")
@ApiModelProperty(name = "模板名称",notes = "templateName")
private String templateName;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
}

37
lzbi-module/src/main/java/com/lzbi/message/domain/DcMessageTemplateType.java

@ -0,0 +1,37 @@
package com.lzbi.message.domain;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import lombok.experimental.Accessors;
import com.lzbi.common.annotation.Excel;
import com.lzbi.module.base.BaseModuleEntity;
/**
* 消息模板与类型中间对象 dc_message_template_type
*
* @author Enbo Li
* @date 2024-04-23
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class DcMessageTemplateType extends BaseModuleEntity
{
private static final long serialVersionUID = 1L;
/** 消息模板主键id */
@Excel(name = "消息模板主键id")
@ApiModelProperty(name = "消息模板主键id",notes = "messageTemplateId")
private Long messageTemplateId;
/** 类型(1、地面积水报警,2、地面积水报警确认3、巡检报警) */
@Excel(name = "类型", readConverterExp = "1=、地面积水报警,2、地面积水报警确认3、巡检报警")
@ApiModelProperty(name = "类型",notes = "")
private String type;
}

27
lzbi-module/src/main/java/com/lzbi/message/domain/req/MessageTemplateChoiceTypeReq.java

@ -0,0 +1,27 @@
package com.lzbi.message.domain.req;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @description: 消息模板选择类型请求
* @author: Enbo Li
* @date: 2024-04-23 16:21
*/
@Data
public class MessageTemplateChoiceTypeReq {
/**
* 消息模板id
*/
@NotNull(message = "消息模板id不能为空")
private Long messageTemplateId;
/**
* 类型
*/
@NotEmpty(message = "请选择类型")
private List<String> types;
}

63
lzbi-module/src/main/java/com/lzbi/message/mapper/DcMessageSendLogMapper.java

@ -0,0 +1,63 @@
package com.lzbi.message.mapper;
import java.util.List;
import com.lzbi.message.domain.DcMessageSendLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 消息发送日志Mapper接口
*
* @author Enbo Li
* @date 2024-04-23
*/
public interface DcMessageSendLogMapper extends BaseMapper<DcMessageSendLog>
{
/**
* 查询消息发送日志
*
* @param id 消息发送日志主键
* @return 消息发送日志
*/
public DcMessageSendLog selectDcMessageSendLogById(Long id);
/**
* 查询消息发送日志列表
*
* @param dcMessageSendLog 消息发送日志
* @return 消息发送日志集合
*/
public List<DcMessageSendLog> selectDcMessageSendLogList(DcMessageSendLog dcMessageSendLog);
/**
* 新增消息发送日志
*
* @param dcMessageSendLog 消息发送日志
* @return 结果
*/
public int insertDcMessageSendLog(DcMessageSendLog dcMessageSendLog);
/**
* 修改消息发送日志
*
* @param dcMessageSendLog 消息发送日志
* @return 结果
*/
public int updateDcMessageSendLog(DcMessageSendLog dcMessageSendLog);
/**
* 删除消息发送日志
*
* @param id 消息发送日志主键
* @return 结果
*/
public int deleteDcMessageSendLogById(Long id);
/**
* 批量删除消息发送日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDcMessageSendLogByIds(Long[] ids);
}

63
lzbi-module/src/main/java/com/lzbi/message/mapper/DcMessageTemplateMapper.java

@ -0,0 +1,63 @@
package com.lzbi.message.mapper;
import java.util.List;
import com.lzbi.message.domain.DcMessageTemplate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 消息模板Mapper接口
*
* @author Enbo Li
* @date 2024-04-23
*/
public interface DcMessageTemplateMapper extends BaseMapper<DcMessageTemplate>
{
/**
* 查询消息模板
*
* @param id 消息模板主键
* @return 消息模板
*/
public DcMessageTemplate selectDcMessageTemplateById(Long id);
/**
* 查询消息模板列表
*
* @param dcMessageTemplate 消息模板
* @return 消息模板集合
*/
public List<DcMessageTemplate> selectDcMessageTemplateList(DcMessageTemplate dcMessageTemplate);
/**
* 新增消息模板
*
* @param dcMessageTemplate 消息模板
* @return 结果
*/
public int insertDcMessageTemplate(DcMessageTemplate dcMessageTemplate);
/**
* 修改消息模板
*
* @param dcMessageTemplate 消息模板
* @return 结果
*/
public int updateDcMessageTemplate(DcMessageTemplate dcMessageTemplate);
/**
* 删除消息模板
*
* @param id 消息模板主键
* @return 结果
*/
public int deleteDcMessageTemplateById(Long id);
/**
* 批量删除消息模板
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDcMessageTemplateByIds(Long[] ids);
}

63
lzbi-module/src/main/java/com/lzbi/message/mapper/DcMessageTemplateTypeMapper.java

@ -0,0 +1,63 @@
package com.lzbi.message.mapper;
import java.util.List;
import com.lzbi.message.domain.DcMessageTemplateType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 消息模板与类型中间Mapper接口
*
* @author Enbo Li
* @date 2024-04-23
*/
public interface DcMessageTemplateTypeMapper extends BaseMapper<DcMessageTemplateType>
{
/**
* 查询消息模板与类型中间
*
* @param messageTemplateId 消息模板与类型中间主键
* @return 消息模板与类型中间
*/
public DcMessageTemplateType selectDcMessageTemplateTypeByMessageTemplateId(Long messageTemplateId);
/**
* 查询消息模板与类型中间列表
*
* @param dcMessageTemplateType 消息模板与类型中间
* @return 消息模板与类型中间集合
*/
public List<DcMessageTemplateType> selectDcMessageTemplateTypeList(DcMessageTemplateType dcMessageTemplateType);
/**
* 新增消息模板与类型中间
*
* @param dcMessageTemplateType 消息模板与类型中间
* @return 结果
*/
public int insertDcMessageTemplateType(DcMessageTemplateType dcMessageTemplateType);
/**
* 修改消息模板与类型中间
*
* @param dcMessageTemplateType 消息模板与类型中间
* @return 结果
*/
public int updateDcMessageTemplateType(DcMessageTemplateType dcMessageTemplateType);
/**
* 删除消息模板与类型中间
*
* @param messageTemplateId 消息模板与类型中间主键
* @return 结果
*/
public int deleteDcMessageTemplateTypeByMessageTemplateId(Long messageTemplateId);
/**
* 批量删除消息模板与类型中间
*
* @param messageTemplateIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteDcMessageTemplateTypeByMessageTemplateIds(Long[] messageTemplateIds);
}

91
lzbi-module/src/main/java/com/lzbi/message/service/DcMessageSendLogService.java

@ -0,0 +1,91 @@
package com.lzbi.message.service;
import java.util.List;
import com.lzbi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.lzbi.message.domain.DcMessageSendLog;
import com.lzbi.message.mapper.DcMessageSendLogMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 消息发送日志Service业务层处理
*
* @author Enbo Li
* @date 2024-04-23
*/
@Service
public class DcMessageSendLogService extends ServiceImpl<DcMessageSendLogMapper, DcMessageSendLog> implements IService<DcMessageSendLog>
{
/**
* 查询消息发送日志
*
* @param id 消息发送日志主键
* @return 消息发送日志
*/
public DcMessageSendLog selectDcMessageSendLogById(Long id)
{
return baseMapper.selectDcMessageSendLogById(id);
}
/**
* 查询消息发送日志列表
*
* @param dcMessageSendLog 消息发送日志
* @return 消息发送日志
*/
public List<DcMessageSendLog> selectDcMessageSendLogList(DcMessageSendLog dcMessageSendLog)
{
return baseMapper.selectDcMessageSendLogList(dcMessageSendLog);
}
/**
* 新增消息发送日志
*
* @param dcMessageSendLog 消息发送日志
* @return 结果
*/
public int insertDcMessageSendLog(DcMessageSendLog dcMessageSendLog)
{
dcMessageSendLog.setCreatedTime(DateUtils.getNowDate());
return baseMapper.insertDcMessageSendLog(dcMessageSendLog);
}
/**
* 修改消息发送日志
*
* @param dcMessageSendLog 消息发送日志
* @return 结果
*/
public int updateDcMessageSendLog(DcMessageSendLog dcMessageSendLog)
{
dcMessageSendLog.setUpdatedTime(DateUtils.getNowDate());
return baseMapper.updateDcMessageSendLog(dcMessageSendLog);
}
/**
* 批量删除消息发送日志
*
* @param ids 需要删除的消息发送日志主键
* @return 结果
*/
public int deleteDcMessageSendLogByIds(Long[] ids)
{
return baseMapper.deleteDcMessageSendLogByIds(ids);
}
/**
* 删除消息发送日志信息
*
* @param id 消息发送日志主键
* @return 结果
*/
public int deleteDcMessageSendLogById(Long id)
{
return baseMapper.deleteDcMessageSendLogById(id);
}
}

93
lzbi-module/src/main/java/com/lzbi/message/service/DcMessageTemplateService.java

@ -0,0 +1,93 @@
package com.lzbi.message.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lzbi.message.domain.DcMessageTemplate;
import com.lzbi.message.mapper.DcMessageTemplateMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
/**
* 消息模板Service业务层处理
*
* @author Enbo Li
* @date 2024-04-23
*/
@Service
public class DcMessageTemplateService extends ServiceImpl<DcMessageTemplateMapper, DcMessageTemplate> implements IService<DcMessageTemplate>
{
@Autowired
private DcMessageTemplateTypeService dcMessageTemplateTypeService;
/**
* 查询消息模板
*
* @param id 消息模板主键
* @return 消息模板
*/
public DcMessageTemplate selectDcMessageTemplateById(Long id)
{
return baseMapper.selectDcMessageTemplateById(id);
}
/**
* 查询消息模板列表
*
* @param dcMessageTemplate 消息模板
* @return 消息模板
*/
public List<DcMessageTemplate> selectDcMessageTemplateList(DcMessageTemplate dcMessageTemplate)
{
return baseMapper.selectDcMessageTemplateList(dcMessageTemplate);
}
/**
* 新增消息模板
*
* @param dcMessageTemplate 消息模板
* @return 结果
*/
public int insertDcMessageTemplate(DcMessageTemplate dcMessageTemplate)
{
return baseMapper.insertDcMessageTemplate(dcMessageTemplate);
}
/**
* 修改消息模板
*
* @param dcMessageTemplate 消息模板
* @return 结果
*/
public int updateDcMessageTemplate(DcMessageTemplate dcMessageTemplate)
{
return baseMapper.updateDcMessageTemplate(dcMessageTemplate);
}
/**
* 批量删除消息模板
*
* @param ids 需要删除的消息模板主键
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
public int deleteDcMessageTemplateByIds(Long[] ids)
{
dcMessageTemplateTypeService.deleteDcMessageTemplateTypeByMessageTemplateIds(ids);
return baseMapper.deleteDcMessageTemplateByIds(ids);
}
/**
* 删除消息模板信息
*
* @param id 消息模板主键
* @return 结果
*/
public int deleteDcMessageTemplateById(Long id)
{
return baseMapper.deleteDcMessageTemplateById(id);
}
}

114
lzbi-module/src/main/java/com/lzbi/message/service/DcMessageTemplateTypeService.java

@ -0,0 +1,114 @@
package com.lzbi.message.service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lzbi.message.domain.req.MessageTemplateChoiceTypeReq;
import org.springframework.stereotype.Service;
import com.lzbi.message.domain.DcMessageTemplateType;
import com.lzbi.message.mapper.DcMessageTemplateTypeMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.CollectionUtils;
/**
* 消息模板与类型中间Service业务层处理
*
* @author Enbo Li
* @date 2024-04-23
*/
@Service
public class DcMessageTemplateTypeService extends ServiceImpl<DcMessageTemplateTypeMapper, DcMessageTemplateType> implements IService<DcMessageTemplateType>
{
/**
* 查询消息模板与类型中间
*
* @param messageTemplateId 消息模板与类型中间主键
* @return 消息模板与类型中间
*/
public DcMessageTemplateType selectDcMessageTemplateTypeByMessageTemplateId(Long messageTemplateId)
{
return baseMapper.selectDcMessageTemplateTypeByMessageTemplateId(messageTemplateId);
}
/**
* 查询消息模板与类型中间列表
*
* @param dcMessageTemplateType 消息模板与类型中间
* @return 消息模板与类型中间
*/
public List<DcMessageTemplateType> selectDcMessageTemplateTypeList(DcMessageTemplateType dcMessageTemplateType)
{
return baseMapper.selectDcMessageTemplateTypeList(dcMessageTemplateType);
}
public List<String> selectTypeListByMessageTemplateId(Long messageTemplateId) {
DcMessageTemplateType dcMessageTemplateType = new DcMessageTemplateType();
dcMessageTemplateType.setMessageTemplateId(messageTemplateId);
List<DcMessageTemplateType> list = this.selectDcMessageTemplateTypeList(dcMessageTemplateType);
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
} else {
return list.stream().map(DcMessageTemplateType::getType).collect(Collectors.toList());
}
}
/**
* 新增消息模板与类型中间
*
* @param dcMessageTemplateType 消息模板与类型中间
* @return 结果
*/
public int insertDcMessageTemplateType(DcMessageTemplateType dcMessageTemplateType)
{
return baseMapper.insertDcMessageTemplateType(dcMessageTemplateType);
}
/**
* 修改消息模板与类型中间
*
* @param dcMessageTemplateType 消息模板与类型中间
* @return 结果
*/
public int updateDcMessageTemplateType(DcMessageTemplateType dcMessageTemplateType)
{
return baseMapper.updateDcMessageTemplateType(dcMessageTemplateType);
}
/**
* 批量删除消息模板与类型中间
*
* @param messageTemplateIds 需要删除的消息模板与类型中间主键
* @return 结果
*/
public int deleteDcMessageTemplateTypeByMessageTemplateIds(Long[] messageTemplateIds)
{
return baseMapper.deleteDcMessageTemplateTypeByMessageTemplateIds(messageTemplateIds);
}
/**
* 删除消息模板与类型中间信息
*
* @param messageTemplateId 消息模板与类型中间主键
* @return 结果
*/
public int deleteDcMessageTemplateTypeByMessageTemplateId(Long messageTemplateId)
{
return baseMapper.deleteDcMessageTemplateTypeByMessageTemplateId(messageTemplateId);
}
public boolean choiceType(MessageTemplateChoiceTypeReq messageTemplateChoiceTypeReq) {
Long messageTemplateId = messageTemplateChoiceTypeReq.getMessageTemplateId();
baseMapper.deleteDcMessageTemplateTypeByMessageTemplateId(messageTemplateId);
List<String> typeList = messageTemplateChoiceTypeReq.getTypes();
List<DcMessageTemplateType> dcMessageTemplateTypeList = typeList.stream().map(type -> new DcMessageTemplateType(messageTemplateId, type)).collect(Collectors.toList());
return this.saveBatch(dcMessageTemplateTypeList);
}
}

103
lzbi-module/src/main/resources/mapper/message/DcMessageSendLogMapper.xml

@ -0,0 +1,103 @@
<?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.lzbi.message.mapper.DcMessageSendLogMapper">
<resultMap type="com.lzbi.message.domain.DcMessageSendLog" id="DcMessageSendLogResult">
<result property="id" column="id" />
<result property="messageTemplateId" column="message_template_id" />
<result property="type" column="type" />
<result property="userId" column="user_id" />
<result property="messageContent" column="message_content" />
<result property="sendTime" column="send_time" />
<result property="sendResult" column="send_result" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectDcMessageSendLogVo">
select id, message_template_id, type, user_id, message_content, send_time, send_result, created_by, created_time, updated_by, updated_time, del_flag from dc_message_send_log
</sql>
<select id="selectDcMessageSendLogList" parameterType="DcMessageSendLog" resultMap="DcMessageSendLogResult">
<include refid="selectDcMessageSendLogVo"/>
<where>
<if test="messageTemplateId != null "> and message_template_id = #{messageTemplateId}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="messageContent != null and messageContent != ''"> and message_content = #{messageContent}</if>
<if test="sendTime != null "> and send_time = #{sendTime}</if>
<if test="sendResult != null and sendResult != ''"> and send_result = #{sendResult}</if>
</where>
</select>
<select id="selectDcMessageSendLogById" parameterType="Long" resultMap="DcMessageSendLogResult">
<include refid="selectDcMessageSendLogVo"/>
where id = #{id}
</select>
<insert id="insertDcMessageSendLog" parameterType="DcMessageSendLog">
insert into dc_message_send_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="messageTemplateId != null">message_template_id,</if>
<if test="type != null and type != ''">type,</if>
<if test="userId != null">user_id,</if>
<if test="messageContent != null">message_content,</if>
<if test="sendTime != null">send_time,</if>
<if test="sendResult != null">send_result,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="messageTemplateId != null">#{messageTemplateId},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="userId != null">#{userId},</if>
<if test="messageContent != null">#{messageContent},</if>
<if test="sendTime != null">#{sendTime},</if>
<if test="sendResult != null">#{sendResult},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateDcMessageSendLog" parameterType="DcMessageSendLog">
update dc_message_send_log
<trim prefix="SET" suffixOverrides=",">
<if test="messageTemplateId != null">message_template_id = #{messageTemplateId},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="messageContent != null">message_content = #{messageContent},</if>
<if test="sendTime != null">send_time = #{sendTime},</if>
<if test="sendResult != null">send_result = #{sendResult},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcMessageSendLogById" parameterType="Long">
delete from dc_message_send_log where id = #{id}
</delete>
<delete id="deleteDcMessageSendLogByIds" parameterType="String">
delete from dc_message_send_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

83
lzbi-module/src/main/resources/mapper/message/DcMessageTemplateMapper.xml

@ -0,0 +1,83 @@
<?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.lzbi.message.mapper.DcMessageTemplateMapper">
<resultMap type="com.lzbi.message.domain.DcMessageTemplate" id="DcMessageTemplateResult">
<result property="id" column="id" />
<result property="templateId" column="template_id" />
<result property="templateName" column="template_name" />
<result property="createdBy" column="create_by" />
<result property="createdTime" column="create_time" />
<result property="updatedBy" column="update_by" />
<result property="updatedTime" column="update_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectDcMessageTemplateVo">
select id, template_id, template_name, created_by, created_time, updated_by, updated_time, del_flag from dc_message_template
</sql>
<select id="selectDcMessageTemplateList" parameterType="DcMessageTemplate" resultMap="DcMessageTemplateResult">
<include refid="selectDcMessageTemplateVo"/>
<where>
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
</where>
</select>
<select id="selectDcMessageTemplateById" parameterType="Long" resultMap="DcMessageTemplateResult">
<include refid="selectDcMessageTemplateVo"/>
where id = #{id}
</select>
<insert id="insertDcMessageTemplate" parameterType="DcMessageTemplate">
insert into dc_message_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="templateId != null and templateId != ''">template_id,</if>
<if test="templateName != null and templateName != ''">template_name,</if>
<if test="createdBy != null">create_by,</if>
<if test="createdTime != null">create_time,</if>
<if test="updatedBy != null">update_by,</if>
<if test="updatedTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="templateId != null and templateId != ''">#{templateId},</if>
<if test="templateName != null and templateName != ''">#{templateName},</if>
<if test="createdBy != null">#{createBy},</if>
<if test="createdTime != null">#{createTime},</if>
<if test="updatedBy != null">#{updateBy},</if>
<if test="updatedTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateDcMessageTemplate" parameterType="DcMessageTemplate">
update dc_message_template
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null and templateId != ''">template_id = #{templateId},</if>
<if test="templateName != null and templateName != ''">template_name = #{templateName},</if>
<if test="createdBy != null">create_by = #{createBy},</if>
<if test="createdTime != null">create_time = #{createTime},</if>
<if test="updatedBy != null">update_by = #{updateBy},</if>
<if test="updatedTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcMessageTemplateById" parameterType="Long">
delete from dc_message_template where id = #{id}
</delete>
<delete id="deleteDcMessageTemplateByIds" parameterType="String">
update dc_message_template set del_flag = '2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

59
lzbi-module/src/main/resources/mapper/message/DcMessageTemplateTypeMapper.xml

@ -0,0 +1,59 @@
<?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.lzbi.message.mapper.DcMessageTemplateTypeMapper">
<resultMap type="com.lzbi.message.domain.DcMessageTemplateType" id="DcMessageTemplateTypeResult">
<result property="messageTemplateId" column="message_template_id" />
<result property="type" column="type" />
</resultMap>
<sql id="selectDcMessageTemplateTypeVo">
select message_template_id, type from dc_message_template_type
</sql>
<select id="selectDcMessageTemplateTypeList" parameterType="DcMessageTemplateType" resultMap="DcMessageTemplateTypeResult">
<include refid="selectDcMessageTemplateTypeVo"/>
<where>
<if test="messageTemplateId != null "> and message_template_id = #{messageTemplateId}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
</where>
</select>
<select id="selectDcMessageTemplateTypeByMessageTemplateId" parameterType="Long" resultMap="DcMessageTemplateTypeResult">
<include refid="selectDcMessageTemplateTypeVo"/>
where message_template_id = #{messageTemplateId}
</select>
<insert id="insertDcMessageTemplateType" parameterType="DcMessageTemplateType">
insert into dc_message_template_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="messageTemplateId != null">message_template_id,</if>
<if test="type != null and type != ''">type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="messageTemplateId != null">#{messageTemplateId},</if>
<if test="type != null and type != ''">#{type},</if>
</trim>
</insert>
<update id="updateDcMessageTemplateType" parameterType="DcMessageTemplateType">
update dc_message_template_type
<trim prefix="SET" suffixOverrides=",">
<if test="type != null and type != ''">type = #{type},</if>
</trim>
where message_template_id = #{messageTemplateId}
</update>
<delete id="deleteDcMessageTemplateTypeByMessageTemplateId" parameterType="Long">
delete from dc_message_template_type where message_template_id = #{messageTemplateId}
</delete>
<delete id="deleteDcMessageTemplateTypeByMessageTemplateIds" parameterType="String">
delete from dc_message_template_type where message_template_id in
<foreach item="messageTemplateId" collection="array" open="(" separator="," close=")">
#{messageTemplateId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save