6 changed files with 180 additions and 0 deletions
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
package com.cloud.kicc.commonbiz.api.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.cloud.kicc.common.data.entity.CommonEntity; |
||||
import java.io.Serializable; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.Getter; |
||||
import lombok.Setter; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* <p> |
||||
* |
||||
* </p> |
||||
* |
||||
* @author entfrm开发团队-王翔 |
||||
* @since 2022-11-15 |
||||
*/ |
||||
@Data |
||||
@Accessors(chain = true) |
||||
@TableName("common_message") |
||||
@ApiModel(value = "Message对象", description = "") |
||||
public class Message extends CommonEntity { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty("主键id") |
||||
private String id; |
||||
|
||||
@ApiModelProperty("消息名称") |
||||
private String name; |
||||
|
||||
@ApiModelProperty("消息类型") |
||||
private String type; |
||||
|
||||
@ApiModelProperty("消息状态 0-未读 1-已读") |
||||
private String status; |
||||
|
||||
@ApiModelProperty("消息内容") |
||||
private String content; |
||||
|
||||
|
||||
} |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
package com.cloud.kicc.commonbiz.controller; |
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil; |
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.cloud.kicc.common.core.api.R; |
||||
import com.cloud.kicc.common.core.constant.AppConstants; |
||||
import com.cloud.kicc.commonbiz.api.entity.Message; |
||||
import com.cloud.kicc.commonbiz.service.IMessageService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.RequiredArgsConstructor; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* <p> |
||||
* 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author entfrm开发团队-王翔 |
||||
* @since 2022-11-15 |
||||
*/ |
||||
@Controller |
||||
@RequestMapping(AppConstants.APP_COMMON +"/message") |
||||
@RequiredArgsConstructor |
||||
@Api(tags = "消息模块") |
||||
public class MessageController { |
||||
|
||||
private final IMessageService iMessageService; |
||||
|
||||
private LambdaQueryWrapper<Message> getQueryWrapper(Message message) { |
||||
return new LambdaQueryWrapper<Message>() |
||||
.eq(StrUtil.isNotBlank(message.getStatus()), Message::getStatus, message.getStatus()) |
||||
.eq(StrUtil.isNotBlank(message.getType()), Message::getType, message.getType()); |
||||
} |
||||
|
||||
@GetMapping("/list") |
||||
@ApiOperation(value = "分页查询", notes = "分页查询") |
||||
public R list(Page page, Message message) { |
||||
IPage<Message> result = iMessageService.page(page, getQueryWrapper(message)); |
||||
return R.ok(result.getRecords(), result.getTotal()); |
||||
} |
||||
|
||||
@GetMapping("/{id:\\w+}") |
||||
@ApiOperation(value = "根据id获取", notes = "根据id获取") |
||||
public R getById(@PathVariable("id") String id) { |
||||
Message message = iMessageService.getById(id); |
||||
return R.ok(message); |
||||
} |
||||
|
||||
@PostMapping("/save") |
||||
@ApiOperation(value = "保存", notes = "保存") |
||||
public R save(@RequestBody Message message) { |
||||
iMessageService.save(message); |
||||
return R.ok(); |
||||
} |
||||
|
||||
@PutMapping("/update") |
||||
@ApiOperation(value = "修改", notes = "修改") |
||||
public R update(@RequestBody Message message) { |
||||
iMessageService.updateById(message); |
||||
return R.ok(); |
||||
} |
||||
|
||||
@DeleteMapping("/remove/{ids:[\\w,]+}") |
||||
@ApiOperation(value = "删除", notes = "删除") |
||||
public R remove(@PathVariable String[] ids) { |
||||
iMessageService.removeByIds(Arrays.asList(ids)); |
||||
return R.ok(); |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.cloud.kicc.commonbiz.mapper; |
||||
|
||||
import com.cloud.kicc.commonbiz.api.entity.Message; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author entfrm开发团队-王翔 |
||||
* @since 2022-11-15 |
||||
*/ |
||||
public interface MessageMapper extends BaseMapper<Message> { |
||||
|
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.cloud.kicc.commonbiz.service; |
||||
|
||||
import com.cloud.kicc.commonbiz.api.entity.Message; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务类 |
||||
* </p> |
||||
* |
||||
* @author entfrm开发团队-王翔 |
||||
* @since 2022-11-15 |
||||
*/ |
||||
public interface IMessageService extends IService<Message> { |
||||
|
||||
} |
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
package com.cloud.kicc.commonbiz.service.impl; |
||||
|
||||
import com.cloud.kicc.commonbiz.api.entity.Message; |
||||
import com.cloud.kicc.commonbiz.mapper.MessageMapper; |
||||
import com.cloud.kicc.commonbiz.service.IMessageService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author entfrm开发团队-王翔 |
||||
* @since 2022-11-15 |
||||
*/ |
||||
@Service |
||||
public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements IMessageService { |
||||
|
||||
} |
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
<?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.cloud.kicc.commonbiz.mapper.MessageMapper"> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue