短信库管理初始接口

This commit is contained in:
youxilong 2024-02-28 15:20:32 +08:00
parent 087d9516bf
commit 5f28ec44da
5 changed files with 615 additions and 0 deletions

View File

@ -0,0 +1,91 @@
package com.xinelu.manage.controller.textmessage;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.textmessage.TextMessage;
import com.xinelu.manage.service.textmessage.ITextMessageService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 短信模板信息Controller
*
* @author xinelu
* @date 2024-02-28
*/
@RestController
@RequestMapping("/manage/message")
public class TextMessageController extends BaseController {
@Resource
private ITextMessageService textMessageService;
/**
* 查询短信模板信息列表
*/
@PreAuthorize("@ss.hasPermi('manage:message:list')")
@GetMapping("/list")
public TableDataInfo list(TextMessage textMessage) {
startPage();
List<TextMessage> list = textMessageService.selectTextMessageList(textMessage);
return getDataTable(list);
}
/**
* 导出短信模板信息列表
*/
@PreAuthorize("@ss.hasPermi('manage:message:export')")
@Log(title = "短信模板信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TextMessage textMessage) {
List<TextMessage> list = textMessageService.selectTextMessageList(textMessage);
ExcelUtil<TextMessage> util = new ExcelUtil<TextMessage>(TextMessage.class);
util.exportExcel(response, list, "短信模板信息数据");
}
/**
* 获取短信模板信息详细信息
*/
@PreAuthorize("@ss.hasPermi('manage:message:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(textMessageService.selectTextMessageById(id));
}
/**
* 新增短信模板信息
*/
@PreAuthorize("@ss.hasPermi('manage:message:add')")
@Log(title = "短信模板信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TextMessage textMessage) {
return toAjax(textMessageService.insertTextMessage(textMessage));
}
/**
* 修改短信模板信息
*/
@PreAuthorize("@ss.hasPermi('manage:message:edit')")
@Log(title = "短信模板信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TextMessage textMessage) {
return toAjax(textMessageService.updateTextMessage(textMessage));
}
/**
* 删除短信模板信息
*/
@PreAuthorize("@ss.hasPermi('manage:message:remove')")
@Log(title = "短信模板信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(textMessageService.deleteTextMessageByIds(ids));
}
}

View File

@ -0,0 +1,132 @@
package com.xinelu.manage.domain.textmessage;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 短信模板信息对象 text_message
*
* @author xinelu
* @date 2024-02-28
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "短信模板信息对象", description = "text_message")
public class TextMessage extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 所属科室id
*/
@ApiModelProperty(value = "所属科室id")
@Excel(name = "所属科室id")
private Long departmentId;
/**
* 所属科室名称
*/
@ApiModelProperty(value = "所属科室名称")
@Excel(name = "所属科室名称")
private String departmentName;
/**
* 病种id
*/
@ApiModelProperty(value = "病种id")
@Excel(name = "病种id")
private Long diseaseTypeId;
/**
* 病种名称
*/
@ApiModelProperty(value = "病种名称")
@Excel(name = "病种名称")
private String diseaseTypeName;
/**
* 短信模板名称
*/
@ApiModelProperty(value = "短信模板名称")
@Excel(name = "短信模板名称")
private String textMessageName;
/**
* 短信ID
*/
@ApiModelProperty(value = "短信ID")
@Excel(name = "短信ID")
private String textMessageId;
/**
* 短信内容
*/
@ApiModelProperty(value = "短信内容")
@Excel(name = "短信内容")
private String textMessageContent;
/**
* 短信通道水滴平台WATER_DROPLET_PLATFORM
*/
@ApiModelProperty(value = "短信通道水滴平台WATER_DROPLET_PLATFORM")
@Excel(name = "短信通道水滴平台WATER_DROPLET_PLATFORM")
private String textMessageChannel;
/**
* 短信状态上架GROUNDING下架OFF_SHELF
*/
@ApiModelProperty(value = "短信状态上架GROUNDING下架OFF_SHELF")
@Excel(name = "短信状态上架GROUNDING下架OFF_SHELF")
private String textMessageStatus;
/**
* 短信排序
*/
@ApiModelProperty(value = "短信排序")
@Excel(name = "短信排序")
private Integer textMessageSort;
/**
* 短信备注
*/
@ApiModelProperty(value = "短信备注")
@Excel(name = "短信备注")
private String textMessageRemark;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("departmentId", getDepartmentId())
.append("departmentName", getDepartmentName())
.append("diseaseTypeId", getDiseaseTypeId())
.append("diseaseTypeName", getDiseaseTypeName())
.append("textMessageName", getTextMessageName())
.append("textMessageId", getTextMessageId())
.append("textMessageContent", getTextMessageContent())
.append("textMessageChannel", getTextMessageChannel())
.append("textMessageStatus", getTextMessageStatus())
.append("textMessageSort", getTextMessageSort())
.append("textMessageRemark", getTextMessageRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.mapper.textmessage;
import com.xinelu.manage.domain.textmessage.TextMessage;
import java.util.List;
/**
* 短信模板信息Mapper接口
*
* @author xinelu
* @date 2024-02-28
*/
public interface TextMessageMapper {
/**
* 查询短信模板信息
*
* @param id 短信模板信息主键
* @return 短信模板信息
*/
public TextMessage selectTextMessageById(Long id);
/**
* 查询短信模板信息列表
*
* @param textMessage 短信模板信息
* @return 短信模板信息集合
*/
public List<TextMessage> selectTextMessageList(TextMessage textMessage);
/**
* 新增短信模板信息
*
* @param textMessage 短信模板信息
* @return 结果
*/
public int insertTextMessage(TextMessage textMessage);
/**
* 修改短信模板信息
*
* @param textMessage 短信模板信息
* @return 结果
*/
public int updateTextMessage(TextMessage textMessage);
/**
* 删除短信模板信息
*
* @param id 短信模板信息主键
* @return 结果
*/
public int deleteTextMessageById(Long id);
/**
* 批量删除短信模板信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTextMessageByIds(Long[] ids);
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.textmessage.impl;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.manage.domain.textmessage.TextMessage;
import com.xinelu.manage.mapper.textmessage.TextMessageMapper;
import com.xinelu.manage.service.textmessage.ITextMessageService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 短信模板信息Service业务层处理
*
* @author xinelu
* @date 2024-02-28
*/
@Service
public class TextMessageServiceImpl implements ITextMessageService {
@Resource
private TextMessageMapper textMessageMapper;
/**
* 查询短信模板信息
*
* @param id 短信模板信息主键
* @return 短信模板信息
*/
@Override
public TextMessage selectTextMessageById(Long id) {
return textMessageMapper.selectTextMessageById(id);
}
/**
* 查询短信模板信息列表
*
* @param textMessage 短信模板信息
* @return 短信模板信息
*/
@Override
public List<TextMessage> selectTextMessageList(TextMessage textMessage) {
return textMessageMapper.selectTextMessageList(textMessage);
}
/**
* 新增短信模板信息
*
* @param textMessage 短信模板信息
* @return 结果
*/
@Override
public int insertTextMessage(TextMessage textMessage) {
textMessage.setCreateTime(DateUtils.getNowDate());
return textMessageMapper.insertTextMessage(textMessage);
}
/**
* 修改短信模板信息
*
* @param textMessage 短信模板信息
* @return 结果
*/
@Override
public int updateTextMessage(TextMessage textMessage) {
textMessage.setUpdateTime(DateUtils.getNowDate());
return textMessageMapper.updateTextMessage(textMessage);
}
/**
* 批量删除短信模板信息
*
* @param ids 需要删除的短信模板信息主键
* @return 结果
*/
@Override
public int deleteTextMessageByIds(Long[] ids) {
return textMessageMapper.deleteTextMessageByIds(ids);
}
/**
* 删除短信模板信息信息
*
* @param id 短信模板信息主键
* @return 结果
*/
@Override
public int deleteTextMessageById(Long id) {
return textMessageMapper.deleteTextMessageById(id);
}
}

View File

@ -0,0 +1,241 @@
<?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.xinelu.manage.mapper.textmessage.TextMessageMapper">
<resultMap type="TextMessage" id="TextMessageResult">
<result property="id" column="id"/>
<result property="departmentId" column="department_id"/>
<result property="departmentName" column="department_name"/>
<result property="diseaseTypeId" column="disease_type_id"/>
<result property="diseaseTypeName" column="disease_type_name"/>
<result property="textMessageName" column="text_message_name"/>
<result property="textMessageId" column="text_message_id"/>
<result property="textMessageContent" column="text_message_content"/>
<result property="textMessageChannel" column="text_message_channel"/>
<result property="textMessageStatus" column="text_message_status"/>
<result property="textMessageSort" column="text_message_sort"/>
<result property="textMessageRemark" column="text_message_remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectTextMessageVo">
select id,
department_id,
department_name,
disease_type_id,
disease_type_name,
text_message_name,
text_message_id,
text_message_content,
text_message_channel,
text_message_status,
text_message_sort,
text_message_remark,
create_by,
create_time,
update_by,
update_time
from text_message
</sql>
<select id="selectTextMessageList" parameterType="TextMessage" resultMap="TextMessageResult">
<include refid="selectTextMessageVo"/>
<where>
<if test="departmentId != null ">
and department_id =
#{departmentId}
</if>
<if test="departmentName != null and departmentName != ''">
and department_name like concat('%',
#{departmentName},
'%'
)
</if>
<if test="diseaseTypeId != null ">
and disease_type_id =
#{diseaseTypeId}
</if>
<if test="diseaseTypeName != null and diseaseTypeName != ''">
and disease_type_name like concat('%',
#{diseaseTypeName},
'%'
)
</if>
<if test="textMessageName != null and textMessageName != ''">
and text_message_name like concat('%',
#{textMessageName},
'%'
)
</if>
<if test="textMessageId != null and textMessageId != ''">
and text_message_id =
#{textMessageId}
</if>
<if test="textMessageContent != null and textMessageContent != ''">
and text_message_content =
#{textMessageContent}
</if>
<if test="textMessageChannel != null and textMessageChannel != ''">
and text_message_channel =
#{textMessageChannel}
</if>
<if test="textMessageStatus != null and textMessageStatus != ''">
and text_message_status =
#{textMessageStatus}
</if>
<if test="textMessageSort != null ">
and text_message_sort =
#{textMessageSort}
</if>
<if test="textMessageRemark != null and textMessageRemark != ''">
and text_message_remark =
#{textMessageRemark}
</if>
</where>
</select>
<select id="selectTextMessageById" parameterType="Long"
resultMap="TextMessageResult">
<include refid="selectTextMessageVo"/>
where id = #{id}
</select>
<insert id="insertTextMessage" parameterType="TextMessage" useGeneratedKeys="true"
keyProperty="id">
insert into text_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="departmentId != null">department_id,
</if>
<if test="departmentName != null">department_name,
</if>
<if test="diseaseTypeId != null">disease_type_id,
</if>
<if test="diseaseTypeName != null">disease_type_name,
</if>
<if test="textMessageName != null">text_message_name,
</if>
<if test="textMessageId != null">text_message_id,
</if>
<if test="textMessageContent != null">text_message_content,
</if>
<if test="textMessageChannel != null">text_message_channel,
</if>
<if test="textMessageStatus != null">text_message_status,
</if>
<if test="textMessageSort != null">text_message_sort,
</if>
<if test="textMessageRemark != null">text_message_remark,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="departmentId != null">#{departmentId},
</if>
<if test="departmentName != null">#{departmentName},
</if>
<if test="diseaseTypeId != null">#{diseaseTypeId},
</if>
<if test="diseaseTypeName != null">#{diseaseTypeName},
</if>
<if test="textMessageName != null">#{textMessageName},
</if>
<if test="textMessageId != null">#{textMessageId},
</if>
<if test="textMessageContent != null">#{textMessageContent},
</if>
<if test="textMessageChannel != null">#{textMessageChannel},
</if>
<if test="textMessageStatus != null">#{textMessageStatus},
</if>
<if test="textMessageSort != null">#{textMessageSort},
</if>
<if test="textMessageRemark != null">#{textMessageRemark},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateTextMessage" parameterType="TextMessage">
update text_message
<trim prefix="SET" suffixOverrides=",">
<if test="departmentId != null">department_id =
#{departmentId},
</if>
<if test="departmentName != null">department_name =
#{departmentName},
</if>
<if test="diseaseTypeId != null">disease_type_id =
#{diseaseTypeId},
</if>
<if test="diseaseTypeName != null">disease_type_name =
#{diseaseTypeName},
</if>
<if test="textMessageName != null">text_message_name =
#{textMessageName},
</if>
<if test="textMessageId != null">text_message_id =
#{textMessageId},
</if>
<if test="textMessageContent != null">text_message_content =
#{textMessageContent},
</if>
<if test="textMessageChannel != null">text_message_channel =
#{textMessageChannel},
</if>
<if test="textMessageStatus != null">text_message_status =
#{textMessageStatus},
</if>
<if test="textMessageSort != null">text_message_sort =
#{textMessageSort},
</if>
<if test="textMessageRemark != null">text_message_remark =
#{textMessageRemark},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTextMessageById" parameterType="Long">
delete
from text_message
where id = #{id}
</delete>
<delete id="deleteTextMessageByIds" parameterType="String">
delete from text_message where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>