diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmMessageController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmMessageController.java new file mode 100644 index 0000000..a41dbf5 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/controller/BmMessageController.java @@ -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 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 list = bmMessageService.selectBmMessageList(bmMessage); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/domain/BmMessage.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/domain/BmMessage.java new file mode 100644 index 0000000..2d7c180 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/domain/BmMessage.java @@ -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; + + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/mapper/BmMessageMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/mapper/BmMessageMapper.java new file mode 100644 index 0000000..b6f2038 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/mapper/BmMessageMapper.java @@ -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 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); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/IBmMessageService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/IBmMessageService.java new file mode 100644 index 0000000..f4c8268 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/IBmMessageService.java @@ -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 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); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/BmMessageServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/BmMessageServiceImpl.java new file mode 100644 index 0000000..39e6dc0 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/basic/service/impl/BmMessageServiceImpl.java @@ -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 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); + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/basic/BmMessageMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/basic/BmMessageMapper.xml new file mode 100644 index 0000000..d8100ce --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/basic/BmMessageMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + select id, uuid, from_user, to_user, from_company, to_company, message_content, message_type, create_time, update_time from bm_message + + + + + + + + insert into bm_message + + uuid, + from_user, + to_user, + from_company, + to_company, + message_content, + message_type, + create_time, + update_time, + + + #{uuid}, + #{fromUser}, + #{toUser}, + #{fromCompany}, + #{toCompany}, + #{messageContent}, + #{messageType}, + #{createTime}, + #{updateTime}, + + + + + update bm_message + + uuid = #{uuid}, + from_user = #{fromUser}, + to_user = #{toUser}, + from_company = #{fromCompany}, + to_company = #{toCompany}, + message_content = #{messageContent}, + message_type = #{messageType}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from bm_message where id = #{id} + + + + delete from bm_message where id in + + #{id} + + + \ No newline at end of file