dongdingding
parent
a3551454eb
commit
aca60186e0
@ -0,0 +1,98 @@
|
||||
package com.ruoyi.jjh.ent.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.jjh.ent.entity.JMemorandum;
|
||||
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
|
||||
import com.ruoyi.jjh.ent.service.JMemorandumService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 备忘录(JMemorandum)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-26 10:34:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/jjh/jMemorandum")
|
||||
@Api(tags = "备忘录表")
|
||||
public class JMemorandumController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private JMemorandumService jMemorandumService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jMemorandumRequest 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@ApiOperation(value = "分页查询所有数据", response = JMemorandum.class)
|
||||
@GetMapping
|
||||
public AjaxResult selectAll(Page<JMemorandum> page, JMemorandumRequest jMemorandumRequest) {
|
||||
return success(jMemorandumService.page(page,jMemorandumRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@ApiOperation(value = "通过主键查询单条数据", response = JMemorandum.class)
|
||||
@GetMapping("{id}")
|
||||
public AjaxResult selectOne(@PathVariable Serializable id) {
|
||||
return success(this.jMemorandumService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param jMemorandum 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation(value = "新增数据")
|
||||
@PostMapping
|
||||
public AjaxResult insert(@RequestBody JMemorandum jMemorandum) {
|
||||
jMemorandum.setCreateTime(new Date());
|
||||
return success(this.jMemorandumService.save(jMemorandum));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param jMemorandum 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@ApiOperation(value = "修改数据")
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody JMemorandum jMemorandum) {
|
||||
jMemorandum.setUpdateTime(new Date());
|
||||
return success(this.jMemorandumService.updateById(jMemorandum));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@ApiOperation(value = "删除数据")
|
||||
@DeleteMapping
|
||||
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
|
||||
return success(this.jMemorandumService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,127 @@
|
||||
package com.ruoyi.jjh.ent.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.poi.ProjectExcelUtil;
|
||||
import com.ruoyi.jjh.ent.entity.JProject;
|
||||
import com.ruoyi.jjh.ent.service.JProjectService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目表(JProject)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-25 11:49:34
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/jjh/jProject")
|
||||
@Api(tags = "项目表")
|
||||
public class JProjectController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private JProjectService jProjectService;
|
||||
|
||||
/**
|
||||
* 分页查询项目
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jProject 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@ApiOperation(value = "分页查询项目", response = JProject.class)
|
||||
@GetMapping
|
||||
public AjaxResult selectAll(Page<JProject> page, JProject jProject) {
|
||||
return success(jProjectService.page(page,jProject));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@ApiOperation(value = "通过主键查询单条项目", response = JProject.class)
|
||||
@GetMapping("{id}")
|
||||
public AjaxResult selectOne(@PathVariable Serializable id) {
|
||||
return success(this.jProjectService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param jProject 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation(value = "新增项目")
|
||||
@PostMapping
|
||||
public AjaxResult insert(@RequestBody JProject jProject) {
|
||||
return success(this.jProjectService.save(jProject));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param jProject 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@ApiOperation(value = "修改项目")
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody JProject jProject) {
|
||||
return success(this.jProjectService.updateById(jProject));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@ApiOperation(value = "删除项目")
|
||||
@DeleteMapping
|
||||
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
|
||||
return success(this.jProjectService.removeByIds(idList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入excel项目数据
|
||||
*
|
||||
*/
|
||||
@ApiOperation(value = "导入excel项目数据")
|
||||
@PostMapping(value = "/export",consumes ="multipart/form-data")
|
||||
public AjaxResult importProject(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
HttpServletRequest req = ServletUtils.getRequest();
|
||||
// String token = req.getHeader("Authentication");
|
||||
// if (StrUtil.isEmpty(token)) {
|
||||
// throw new BaseException("用户未登录");
|
||||
// }
|
||||
ProjectExcelUtil<JProject> util = new ProjectExcelUtil<>(JProject.class);
|
||||
List<JProject> proList = util.importExcel(file.getInputStream());
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
if(proList == null && proList.isEmpty()){
|
||||
throw new ServiceException("项目导入数据不能为空");
|
||||
}else {
|
||||
if (!proList.isEmpty()) {
|
||||
jProjectService.saveBatch(proList);
|
||||
successMsg.append("导入成功");
|
||||
} else {
|
||||
successMsg.append("导入失败,文件为空");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(successMsg);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package com.ruoyi.jjh.ent.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 备忘录(JMemorandum)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-26 10:34:03
|
||||
*/
|
||||
@ApiModel("备忘录表")
|
||||
@TableName(value = "j_memorandum")
|
||||
@Data
|
||||
public class JMemorandum {
|
||||
/**
|
||||
* Id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("Id")
|
||||
private Long id;
|
||||
/**
|
||||
* 项目表关联id
|
||||
*/
|
||||
@ApiModelProperty("项目表关联id")
|
||||
private Long projectId;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
@ApiModelProperty("名字")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 主题/关键字
|
||||
*/
|
||||
@ApiModelProperty("主题/关键字")
|
||||
private String keywords;
|
||||
/**
|
||||
* 备忘内容
|
||||
*/
|
||||
@ApiModelProperty("备忘内容")
|
||||
|
||||
private String content;
|
||||
|
||||
private Long createId;
|
||||
|
||||
private String createBy;
|
||||
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
private Long updateId;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.ruoyi.jjh.ent.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 项目表(JProject)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-25 11:49:34
|
||||
*/
|
||||
@ApiModel("项目表")
|
||||
@TableName(value = "j_project")
|
||||
@Data
|
||||
public class JProject{
|
||||
/**
|
||||
* Id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("Id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Excel(name = "项目名称")
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
|
||||
/**
|
||||
* 项目分类
|
||||
*/
|
||||
// @Excel(name = "项目分类", readConverterExp = "0=省现代服务业重点项目,1=两业融合试点单位")
|
||||
@Excel(name = "项目分类")
|
||||
@ApiModelProperty("项目分类")
|
||||
private String projectClassify;
|
||||
|
||||
/**
|
||||
* 申报单位
|
||||
*/
|
||||
@Excel(name = "申报单位")
|
||||
@ApiModelProperty("申报单位")
|
||||
private String declareUnit;
|
||||
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
@Excel(name = "年份")
|
||||
private String projectYear;
|
||||
|
||||
/**
|
||||
* 其余字段和数据
|
||||
*/
|
||||
@Excel(name = "其余字段和数据")
|
||||
@ApiModelProperty("其余字段和数据")
|
||||
private String otherJson;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty("状态")
|
||||
private Integer status;
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.ruoyi.jjh.ent.entity.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author du
|
||||
* @since 2024/3/26 10:48
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("备忘录请求类")
|
||||
public class JMemorandumRequest {
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
@ApiModelProperty("名字")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("开始时间")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("结束时间")
|
||||
private Date endTime;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.jjh.ent.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.jjh.ent.entity.JMemorandum;
|
||||
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 备忘录(JMemorandum)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-26 10:34:03
|
||||
*/
|
||||
public interface JMemorandumMapper extends BaseMapper<JMemorandum> {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jMemorandumRequest 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
Page<JMemorandum> page(Page<JMemorandum> page, @Param("req") JMemorandumRequest jMemorandumRequest);
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.jjh.ent.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.jjh.ent.entity.JProject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 项目表(JProject)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-25 11:49:34
|
||||
*/
|
||||
public interface JProjectMapper extends BaseMapper<JProject> {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jProject 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
Page<JProject> page(Page<JProject> page,@Param("req") JProject jProject);
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.jjh.ent.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.jjh.ent.entity.JMemorandum;
|
||||
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
|
||||
|
||||
/**
|
||||
* 备忘录(JMemorandum)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-26 10:34:03
|
||||
*/
|
||||
public interface JMemorandumService extends IService<JMemorandum> {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jMemorandumRequest 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
Page<JMemorandum> page(Page<JMemorandum> page, JMemorandumRequest jMemorandumRequest);
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.jjh.ent.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.jjh.ent.entity.JProject;
|
||||
|
||||
|
||||
/**
|
||||
* 项目表(JProject)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-25 11:49:34
|
||||
*/
|
||||
public interface JProjectService extends IService<JProject> {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jProject 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
Page<JProject> page(Page<JProject> page, JProject jProject);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.ruoyi.jjh.ent.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.jjh.ent.entity.request.JMemorandumRequest;
|
||||
import com.ruoyi.jjh.ent.mapper.JMemorandumMapper;
|
||||
import com.ruoyi.jjh.ent.entity.JMemorandum;
|
||||
import com.ruoyi.jjh.ent.service.JMemorandumService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 备忘录(JMemorandum)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-26 10:34:03
|
||||
*/
|
||||
@Service("jMemorandumService")
|
||||
public class JMemorandumServiceImpl extends ServiceImpl<JMemorandumMapper, JMemorandum> implements JMemorandumService {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jMemorandumRequest 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@Override
|
||||
public Page<JMemorandum> page(Page<JMemorandum> page, JMemorandumRequest jMemorandumRequest) {
|
||||
return baseMapper.page(page,jMemorandumRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.jjh.ent.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.jjh.ent.mapper.JProjectMapper;
|
||||
import com.ruoyi.jjh.ent.entity.JProject;
|
||||
import com.ruoyi.jjh.ent.service.JProjectService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目表(JProject)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-03-25 11:49:34
|
||||
*/
|
||||
@Service("jProjectService")
|
||||
public class JProjectServiceImpl extends ServiceImpl<JProjectMapper, JProject> implements JProjectService {
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jProject 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@Override
|
||||
public Page<JProject> page(Page<JProject> page, JProject jProject) {
|
||||
return baseMapper.page(page,jProject);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,183 +0,0 @@
|
||||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* swagger 用户测试方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api("用户信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/user")
|
||||
public class TestController extends BaseController
|
||||
{
|
||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||
{
|
||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户列表")
|
||||
@GetMapping("/list")
|
||||
public R<List<UserEntity>> userList()
|
||||
{
|
||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||
return R.ok(userList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户详细")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||
@GetMapping("/{userId}")
|
||||
public R<UserEntity> getUser(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
return R.ok(users.get(userId));
|
||||
}
|
||||
else
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
|
||||
})
|
||||
@PostMapping("/save")
|
||||
public R<String> save(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户ID不能为空");
|
||||
}
|
||||
users.put(user.getUserId(), user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@PutMapping("/update")
|
||||
public R<String> update(@RequestBody UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户ID不能为空");
|
||||
}
|
||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
users.remove(user.getUserId());
|
||||
users.put(user.getUserId(), user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户信息")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
|
||||
@DeleteMapping("/{userId}")
|
||||
public R<String> delete(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
users.remove(userId);
|
||||
return R.ok();
|
||||
}
|
||||
else
|
||||
{
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel(value = "UserEntity", description = "用户实体")
|
||||
class UserEntity
|
||||
{
|
||||
@ApiModelProperty("用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("用户密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("用户手机")
|
||||
private String mobile;
|
||||
|
||||
public UserEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserEntity(Integer userId, String username, String password, String mobile)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public Integer getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getMobile()
|
||||
{
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile)
|
||||
{
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?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.ruoyi.jjh.ent.mapper.JMemorandumMapper">
|
||||
|
||||
<select id="page" resultType="com.ruoyi.jjh.ent.entity.JMemorandum">
|
||||
select * from j_memorandum
|
||||
<where>
|
||||
<if test="req.name != null and req.name != '' ">
|
||||
and name like concat('%',#{req.name},'%') or keywords like concat('%',#{req.name},'%')
|
||||
</if>
|
||||
<if test="req.startTime != null ">
|
||||
and create_time >= #{req.startTime}
|
||||
</if>
|
||||
<if test="req.endTime != null">
|
||||
and create_time <= #{req.endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,27 @@
|
||||
<?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.ruoyi.jjh.ent.mapper.JProjectMapper">
|
||||
|
||||
<select id="page" resultType="com.ruoyi.jjh.ent.entity.JProject">
|
||||
select * from j_project
|
||||
<where>
|
||||
<if test="req.projectName != null and req.projectName != '' ">
|
||||
and project_name like concat('%',#{req.projectName},'%')
|
||||
</if>
|
||||
<if test="req.projectClassify != null and req.projectClassify != '' ">
|
||||
and project_classify = #{req.projectClassify}
|
||||
</if>
|
||||
<if test="req.declareUnit != null and req.declareUnit != '' ">
|
||||
and declare_unit like concat('%',#{req.declareUnit},'%')
|
||||
</if>
|
||||
<if test="req.status != null and req.status != '' ">
|
||||
and status = #{req.status}
|
||||
</if>
|
||||
<if test="req.projectYear != null">
|
||||
and project_year = #{req.projectYear}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue