提交 28ea39b6 作者: chenshiqiang

add base code

上级 306c8fde
package com.zzsn.event.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.EventCategory;
import com.zzsn.event.service.IEventCategoryService;
import com.zzsn.event.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
/**
* 事件分类
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Slf4j
@Api(tags="事件分类")
@RestController
@RequestMapping("/event/eventCategory")
public class EventCategoryController {
@Autowired
private IEventCategoryService eventCategoryService;
/**
* 分页列表查询
*
* @param eventCategory
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@ApiOperation(value="事件分类-分页列表查询", notes="事件分类-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(EventCategory eventCategory,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<EventCategory> queryWrapper = new QueryWrapper<>();
Page<EventCategory> page = new Page<EventCategory>(pageNo, pageSize);
IPage<EventCategory> pageList = eventCategoryService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param eventCategory
* @return
*/
@ApiOperation(value="事件分类-添加", notes="事件分类-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody EventCategory eventCategory) {
eventCategoryService.save(eventCategory);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param eventCategory
* @return
*/
@ApiOperation(value="事件分类-编辑", notes="事件分类-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody EventCategory eventCategory) {
eventCategoryService.updateById(eventCategory);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value="事件分类-通过id删除", notes="事件分类-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
eventCategoryService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value="事件分类-批量删除", notes="事件分类-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.eventCategoryService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value="事件分类-通过id查询", notes="事件分类-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
EventCategory eventCategory = eventCategoryService.getById(id);
return Result.OK(eventCategory);
}
}
package com.zzsn.event.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsn.event.entity.Event;
import com.zzsn.event.service.IEventService;
import com.zzsn.event.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
/**
* 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Slf4j
@Api(tags="事件")
@RestController
@RequestMapping("/event/event")
public class EventController {
@Autowired
private IEventService eventService;
/**
* 分页列表查询
*
* @param event
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@ApiOperation(value="事件-分页列表查询", notes="事件-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(Event event,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Event> queryWrapper = new QueryWrapper<>();
Page<Event> page = new Page<Event>(pageNo, pageSize);
IPage<Event> pageList = eventService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param event
* @return
*/
@ApiOperation(value="事件-添加", notes="事件-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody Event event) {
eventService.save(event);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param event
* @return
*/
@ApiOperation(value="事件-编辑", notes="事件-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody Event event) {
eventService.updateById(event);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value="事件-通过id删除", notes="事件-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
eventService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value="事件-批量删除", notes="事件-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.eventService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value="事件-通过id查询", notes="事件-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
Event event = eventService.getById(id);
return Result.OK(event);
}
}
package com.zzsn.event.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Data
@TableName("event")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="event对象", description="事件")
public class Event {
/**ID*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "ID")
private String id;
/**名称*/
@Excel(name = "名称", width = 15)
@ApiModelProperty(value = "名称")
private String eventName;
/**图标*/
@Excel(name = "图标", width = 15)
@ApiModelProperty(value = "图标")
private String eventIcon;
/**事件类型*/
@Excel(name = "事件类型", width = 15)
@ApiModelProperty(value = "事件类型")
private Integer eventType;
/**开始时间*/
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "开始时间")
private Date startTime;
/**结束时间*/
@Excel(name = "结束时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "结束时间")
private Date endTime;
/**事件地域*/
@Excel(name = "事件地域", width = 15)
@ApiModelProperty(value = "事件地域")
private String eventArea;
/**标签*/
@Excel(name = "标签", width = 15)
@ApiModelProperty(value = "标签")
private String eventLabel;
/**关键词*/
@Excel(name = "关键词", width = 15)
@ApiModelProperty(value = "关键词")
private String eventKeywords;
/**是否公开*/
@Excel(name = "是否公开", width = 15)
@ApiModelProperty(value = "是否公开")
private Integer facePublic;
/**事件描述*/
@Excel(name = "事件描述", width = 15)
@ApiModelProperty(value = "事件描述")
private String eventDescribe;
/**创建人id*/
@Excel(name = "创建人id", width = 15)
@ApiModelProperty(value = "创建人id")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**修改人id*/
@Excel(name = "修改人id", width = 15)
@ApiModelProperty(value = "修改人id")
private String updateBy;
}
package com.zzsn.event.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* @Description: 事件分类
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Data
@TableName("event_category")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="event_category对象", description="事件分类")
public class EventCategory {
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private Integer id;
/**事件分类名称*/
@Excel(name = "事件分类名称", width = 15)
@ApiModelProperty(value = "事件分类名称")
private String typeName;
/**父级id*/
@Excel(name = "父级id", width = 15)
@ApiModelProperty(value = "父级id")
private String pid;
/**是否有子节点0,没有 1,有*/
@Excel(name = "是否有子节点0,没有 1,有", width = 15)
@ApiModelProperty(value = "是否有子节点0,没有 1,有")
private String hasChild;
/**状态*/
@Excel(name = "状态", width = 15)
@ApiModelProperty(value = "状态")
private Integer status;
/**节点绝对路径*/
@Excel(name = "节点绝对路径", width = 15)
@ApiModelProperty(value = "节点绝对路径")
private String fullPath;
/**序号*/
@Excel(name = "序号", width = 15)
@ApiModelProperty(value = "序号")
private Integer orderNumber;
/**层级*/
@Excel(name = "层级", width = 15)
@ApiModelProperty(value = "层级")
private Integer level;
/**创建人*/
@Excel(name = "创建人", width = 15)
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**更新人*/
@Excel(name = "更新人", width = 15)
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新时间*/
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
}
package com.zzsn.event.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.zzsn.event.entity.EventCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 事件分类
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
public interface EventCategoryMapper extends BaseMapper<EventCategory> {
}
package com.zzsn.event.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.zzsn.event.entity.Event;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
public interface EventMapper extends BaseMapper<Event> {
}
<?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.zzsn.event.mapper.EventCategoryMapper">
</mapper>
\ No newline at end of file
<?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.zzsn.event.mapper.EventMapper">
</mapper>
\ No newline at end of file
package com.zzsn.event.service;
import com.zzsn.event.entity.EventCategory;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 事件分类
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
public interface IEventCategoryService extends IService<EventCategory> {
}
package com.zzsn.event.service;
import com.zzsn.event.entity.Event;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
public interface IEventService extends IService<Event> {
}
package com.zzsn.event.service.impl;
import com.zzsn.event.entity.EventCategory;
import com.zzsn.event.mapper.EventCategoryMapper;
import com.zzsn.event.service.IEventCategoryService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 事件分类
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Service
public class EventCategoryServiceImpl extends ServiceImpl<EventCategoryMapper, EventCategory> implements IEventCategoryService {
}
package com.zzsn.event.service.impl;
import com.zzsn.event.entity.Event;
import com.zzsn.event.mapper.EventMapper;
import com.zzsn.event.service.IEventService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 事件
* @Author: jeecg-boot
* @Date: 2024-03-14
* @Version: V1.0
*/
@Service
public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements IEventService {
}
package com.zzsn.event.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zzsn.event.constant.CommonConstant;
import lombok.Data;
import java.io.Serializable;
/**
* 接口返回数据格式
* @author scott
* @email jeecgos@163.com
* @date 2019年1月19日
*/
@Data
public class Result<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功标志
*/
private boolean success = true;
/**
* 返回处理消息
*/
private String message = "操作成功!";
/**
* 返回代码
*/
private Integer code = 0;
/**
* 返回数据对象 data
*/
private T result;
/**
* 时间戳
*/
private long timestamp = System.currentTimeMillis();
/**
* python接口返回
*/
private String handleMsg;
/**
* python接口返回状态
*/
private boolean isHandleSuccess;
/**
* python接口返回状态
*/
private String logs;
/**
* 返回数据对象 data
*/
private T resultData;
public Result() {
}
public Result<T> success(String message) {
this.message = message;
this.code = CommonConstant.SC_OK_200;
this.success = true;
return this;
}
@Deprecated
public static Result<Object> ok() {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setMessage("成功");
return r;
}
@Deprecated
public static Result<Object> ok(String msg) {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setMessage(msg);
return r;
}
@Deprecated
public static Result<Object> ok(Object data) {
Result<Object> r = new Result<Object>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
return r;
}
public static<T> Result<T> OK() {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setMessage("成功");
return r;
}
public static<T> Result<T> OK(T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setResult(data);
return r;
}
public static<T> Result<T> OK(String msg, T data) {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setCode(CommonConstant.SC_OK_200);
r.setMessage(msg);
r.setResult(data);
return r;
}
public static Result<Object> error(String msg) {
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
}
public static Result<Object> error(int code, String msg) {
Result<Object> r = new Result<Object>();
r.setCode(code);
r.setMessage(msg);
r.setSuccess(false);
return r;
}
public Result<T> error500(String message) {
this.message = message;
this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
this.success = false;
return this;
}
/**
* 无权限访问返回结果
*/
public static Result<Object> noauth(String msg) {
return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
}
@JsonIgnore
private String onlTable;
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论