
12 changed files with 196 additions and 12 deletions
@ -0,0 +1,50 @@ |
|||||
|
package com.yxt.supervise.monitor.api.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.domain.EntityWithId; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel(value = "有ID的实体", description = "有ID的实体") |
||||
|
@TableName("y_info") |
||||
|
public class YInfo extends EntityWithId { |
||||
|
// `id`使用继承的
|
||||
|
|
||||
|
@ApiModelProperty("记录创建时间") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
||||
|
private Date createTime = new Date(); // 记录创建时间
|
||||
|
|
||||
|
@ApiModelProperty("备注说明") |
||||
|
private String remarks; // 备注说明
|
||||
|
|
||||
|
@ApiModelProperty("信息状态") |
||||
|
private String state; |
||||
|
|
||||
|
@ApiModelProperty("是否删除") |
||||
|
private String isDelete; |
||||
|
|
||||
|
@ApiModelProperty("修改时间") |
||||
|
private String modifyTime; |
||||
|
|
||||
|
@ApiModelProperty("是否可用") |
||||
|
private String isEnable; |
||||
|
|
||||
|
@ApiModelProperty("创建人") |
||||
|
private String createBySid; |
||||
|
|
||||
|
@ApiModelProperty("更新人") |
||||
|
private String updateBySid; |
||||
|
|
||||
|
@ApiModelProperty("信息内容") |
||||
|
private String content; |
||||
|
|
||||
|
@ApiModelProperty("消息标题") |
||||
|
private String title; |
||||
|
|
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
package com.yxt.supervise.monitor.biz.info; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.yxt.supervise.monitor.api.entity.DeviceLog; |
||||
|
import com.yxt.supervise.monitor.api.entity.YInfo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface YInfoMapper extends BaseMapper<YInfo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.yxt.supervise.monitor.biz.info; |
||||
|
|
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.supervise.monitor.api.vo.PageVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Api(tags = "设备日志控制器") |
||||
|
@RestController("com.yxt.supervise.monitor.biz.info.YInfoRest") |
||||
|
@RequestMapping("/yInfo") |
||||
|
public class YInfoRest { |
||||
|
|
||||
|
@Autowired |
||||
|
private YInfoService yInfoService; |
||||
|
|
||||
|
|
||||
|
@ApiOperation("分页获取消息列表") |
||||
|
@GetMapping("/getInfoPage") |
||||
|
public ResultBean getInfoPage(@RequestParam Map<String, String> searchVo, |
||||
|
@ModelAttribute PageVo pageVo) { |
||||
|
ResultBean rb = ResultBean.fireSuccess(); |
||||
|
rb.setData(yInfoService.getInfoPage(searchVo, pageVo)); |
||||
|
return rb; |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("单条获取消息") |
||||
|
@GetMapping("/getInfoById") |
||||
|
public ResultBean getInfoById(String id) { |
||||
|
ResultBean rb = ResultBean.fireSuccess(); |
||||
|
rb.setData(yInfoService.getById(id)); |
||||
|
return rb; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
package com.yxt.supervise.monitor.biz.info; |
||||
|
|
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.yxt.supervise.monitor.api.entity.DeviceLog; |
||||
|
import com.yxt.supervise.monitor.api.entity.YInfo; |
||||
|
import com.yxt.supervise.monitor.api.vo.PageVo; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
public class YInfoService extends ServiceImpl<YInfoMapper, YInfo> { |
||||
|
|
||||
|
public IPage<YInfo> getInfoPage(Map<String, String> searchVo, PageVo pageVo) { |
||||
|
IPage<YInfo> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(); |
||||
|
page.setSize(pageVo.getSize()); |
||||
|
page.setCurrent((long) pageVo.getCurrent()); |
||||
|
|
||||
|
QueryWrapper<YInfo> queryWrapper = new QueryWrapper<>(); |
||||
|
|
||||
|
if (StrUtil.isNotBlank(searchVo.get("content"))) { |
||||
|
queryWrapper.like("content", searchVo.get("content")); |
||||
|
} |
||||
|
queryWrapper.eq("isDelete", 0); |
||||
|
|
||||
|
IPage<YInfo> athleteBOIPage = null; |
||||
|
try { |
||||
|
athleteBOIPage = baseMapper.selectPage(page, queryWrapper); |
||||
|
} catch (Exception e) { |
||||
|
System.out.println(e); |
||||
|
athleteBOIPage = null; |
||||
|
} |
||||
|
return athleteBOIPage; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue