This commit is contained in:
parent
c98f2cf6d1
commit
d8663f11a8
|
|
@ -0,0 +1,117 @@
|
||||||
|
package com.bonus.material.basic.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import com.bonus.common.log.enums.OperaType;
|
||||||
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
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.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.material.basic.domain.BmMessage;
|
||||||
|
import com.bonus.material.basic.service.IBmMessageService;
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息Controller
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2024-12-20
|
||||||
|
*/
|
||||||
|
@Api(tags = "消息接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/bm_message")
|
||||||
|
public class BmMessageController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IBmMessageService bmMessageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询消息列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询消息列表")
|
||||||
|
@RequiresPermissions("basic:message:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(BmMessage bmMessage) {
|
||||||
|
startPage();
|
||||||
|
List<BmMessage> list = bmMessageService.selectBmMessageList(bmMessage);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出消息列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "导出消息列表")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("basic:message:export")
|
||||||
|
@SysLog(title = "消息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出消息")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BmMessage bmMessage) {
|
||||||
|
List<BmMessage> list = bmMessageService.selectBmMessageList(bmMessage);
|
||||||
|
ExcelUtil<BmMessage> util = new ExcelUtil<BmMessage>(BmMessage.class);
|
||||||
|
util.exportExcel(response, list, "消息数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取消息详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取消息详细信息")
|
||||||
|
@RequiresPermissions("basic:message:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(bmMessageService.selectBmMessageById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增消息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增消息")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("basic:message:add")
|
||||||
|
@SysLog(title = "消息", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增消息")
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BmMessage bmMessage) {
|
||||||
|
try {
|
||||||
|
return toAjax(bmMessageService.insertBmMessage(bmMessage));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("系统错误, " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改消息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改消息")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("basic:message:edit")
|
||||||
|
@SysLog(title = "消息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改消息")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
public AjaxResult edit(@RequestBody BmMessage bmMessage) {
|
||||||
|
try {
|
||||||
|
return toAjax(bmMessageService.updateBmMessage(bmMessage));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error("系统错误, " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除消息
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除消息")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("basic:message:remove")
|
||||||
|
@SysLog(title = "消息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除消息")
|
||||||
|
@PostMapping("/del/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(bmMessageService.deleteBmMessageByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.bonus.material.basic.domain;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】对象 bm_message
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2024-12-20
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class BmMessage extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键id */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** uuid */
|
||||||
|
@Excel(name = "uuid")
|
||||||
|
@ApiModelProperty(value = "uuid")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
|
/** 来自userId */
|
||||||
|
@Excel(name = "来自userId")
|
||||||
|
@ApiModelProperty(value = "来自userId")
|
||||||
|
private String fromUser;
|
||||||
|
|
||||||
|
/** 发给userId */
|
||||||
|
@Excel(name = "发给userId")
|
||||||
|
@ApiModelProperty(value = "发给userId")
|
||||||
|
private String toUser;
|
||||||
|
|
||||||
|
/** 来自companyId */
|
||||||
|
@Excel(name = "来自companyId")
|
||||||
|
@ApiModelProperty(value = "来自companyId")
|
||||||
|
private String fromCompany;
|
||||||
|
|
||||||
|
/** 发给companyId */
|
||||||
|
@Excel(name = "发给companyId")
|
||||||
|
@ApiModelProperty(value = "发给companyId")
|
||||||
|
private String toCompany;
|
||||||
|
|
||||||
|
/** 消息内容 */
|
||||||
|
@Excel(name = "消息内容")
|
||||||
|
@ApiModelProperty(value = "消息内容")
|
||||||
|
private String messageContent;
|
||||||
|
|
||||||
|
/** 消息类型 */
|
||||||
|
@Excel(name = "消息类型")
|
||||||
|
@ApiModelProperty(value = "消息类型")
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.bonus.material.basic.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.bonus.material.basic.domain.BmMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Mapper接口
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2024-12-20
|
||||||
|
*/
|
||||||
|
public interface BmMessageMapper {
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
public BmMessage selectBmMessageById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】集合
|
||||||
|
*/
|
||||||
|
public List<BmMessage> selectBmMessageList(BmMessage bmMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBmMessage(BmMessage bmMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBmMessage(BmMessage bmMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBmMessageById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBmMessageByIds(Long[] ids);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.bonus.material.basic.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.bonus.material.basic.domain.BmMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Service接口
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2024-12-20
|
||||||
|
*/
|
||||||
|
public interface IBmMessageService {
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
public BmMessage selectBmMessageById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】集合
|
||||||
|
*/
|
||||||
|
public List<BmMessage> selectBmMessageList(BmMessage bmMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBmMessage(BmMessage bmMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBmMessage(BmMessage bmMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的【请填写功能名称】主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBmMessageByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】信息
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBmMessageById(Long id);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
package com.bonus.material.basic.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.bonus.material.basic.mapper.BmMessageMapper;
|
||||||
|
import com.bonus.material.basic.domain.BmMessage;
|
||||||
|
import com.bonus.material.basic.service.IBmMessageService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【请填写功能名称】Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2024-12-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BmMessageServiceImpl implements IBmMessageService {
|
||||||
|
@Autowired
|
||||||
|
private BmMessageMapper bmMessageMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BmMessage selectBmMessageById(Long id) {
|
||||||
|
return bmMessageMapper.selectBmMessageById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询【请填写功能名称】列表
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 【请填写功能名称】
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BmMessage> selectBmMessageList(BmMessage bmMessage) {
|
||||||
|
return bmMessageMapper.selectBmMessageList(bmMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBmMessage(BmMessage bmMessage) {
|
||||||
|
bmMessage.setCreateTime(DateUtils.getNowDate());
|
||||||
|
try {
|
||||||
|
return bmMessageMapper.insertBmMessage(bmMessage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException("错误信息描述");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param bmMessage 【请填写功能名称】
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBmMessage(BmMessage bmMessage) {
|
||||||
|
bmMessage.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
try {
|
||||||
|
return bmMessageMapper.updateBmMessage(bmMessage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException("错误信息描述");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除【请填写功能名称】
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBmMessageByIds(Long[] ids) {
|
||||||
|
return bmMessageMapper.deleteBmMessageByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除【请填写功能名称】信息
|
||||||
|
*
|
||||||
|
* @param id 【请填写功能名称】主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBmMessageById(Long id) {
|
||||||
|
return bmMessageMapper.deleteBmMessageById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
<?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.bonus.material.basic.mapper.BmMessageMapper">
|
||||||
|
<resultMap type="com.bonus.material.basic.domain.BmMessage" id="BmMessageResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="uuid" column="uuid" />
|
||||||
|
<result property="fromUser" column="from_user" />
|
||||||
|
<result property="toUser" column="to_user" />
|
||||||
|
<result property="fromCompany" column="from_company" />
|
||||||
|
<result property="toCompany" column="to_company" />
|
||||||
|
<result property="messageContent" column="message_content" />
|
||||||
|
<result property="messageType" column="message_type" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBmMessageVo">
|
||||||
|
select id, uuid, from_user, to_user, from_company, to_company, message_content, message_type, create_time, update_time from bm_message
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBmMessageList" parameterType="com.bonus.material.basic.domain.BmMessage" resultMap="BmMessageResult">
|
||||||
|
<include refid="selectBmMessageVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="uuid != null and uuid != ''"> and uuid = #{uuid}</if>
|
||||||
|
<if test="fromUser != null and fromUser != ''"> and from_user = #{fromUser}</if>
|
||||||
|
<if test="toUser != null and toUser != ''"> and to_user = #{toUser}</if>
|
||||||
|
<if test="fromCompany != null and fromCompany != ''"> and from_company = #{fromCompany}</if>
|
||||||
|
<if test="toCompany != null and toCompany != ''"> and to_company = #{toCompany}</if>
|
||||||
|
<if test="messageContent != null and messageContent != ''"> and message_content = #{messageContent}</if>
|
||||||
|
<if test="messageType != null and messageType != ''"> and message_type = #{messageType}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBmMessageById" parameterType="Long" resultMap="BmMessageResult">
|
||||||
|
<include refid="selectBmMessageVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBmMessage" parameterType="com.bonus.material.basic.domain.BmMessage" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into bm_message
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="uuid != null">uuid,</if>
|
||||||
|
<if test="fromUser != null">from_user,</if>
|
||||||
|
<if test="toUser != null">to_user,</if>
|
||||||
|
<if test="fromCompany != null">from_company,</if>
|
||||||
|
<if test="toCompany != null">to_company,</if>
|
||||||
|
<if test="messageContent != null">message_content,</if>
|
||||||
|
<if test="messageType != null">message_type,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="uuid != null">#{uuid},</if>
|
||||||
|
<if test="fromUser != null">#{fromUser},</if>
|
||||||
|
<if test="toUser != null">#{toUser},</if>
|
||||||
|
<if test="fromCompany != null">#{fromCompany},</if>
|
||||||
|
<if test="toCompany != null">#{toCompany},</if>
|
||||||
|
<if test="messageContent != null">#{messageContent},</if>
|
||||||
|
<if test="messageType != null">#{messageType},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBmMessage" parameterType="com.bonus.material.basic.domain.BmMessage">
|
||||||
|
update bm_message
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="uuid != null">uuid = #{uuid},</if>
|
||||||
|
<if test="fromUser != null">from_user = #{fromUser},</if>
|
||||||
|
<if test="toUser != null">to_user = #{toUser},</if>
|
||||||
|
<if test="fromCompany != null">from_company = #{fromCompany},</if>
|
||||||
|
<if test="toCompany != null">to_company = #{toCompany},</if>
|
||||||
|
<if test="messageContent != null">message_content = #{messageContent},</if>
|
||||||
|
<if test="messageType != null">message_type = #{messageType},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBmMessageById" parameterType="Long">
|
||||||
|
delete from bm_message where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBmMessageByIds" parameterType="String">
|
||||||
|
delete from bm_message where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue