新增项目管理

hehai
zhiyong.ning 4 years ago
parent d2762b3b6d
commit ea48c4e74c
  1. 35
      src/main/java/com/msdw/tms/api/ExperimentalProjectControllerApi.java
  2. 119
      src/main/java/com/msdw/tms/controller/ExperimentalProjectController.java
  3. 17
      src/main/java/com/msdw/tms/dao/ExperimentalProjectDao.java
  4. 82
      src/main/java/com/msdw/tms/entity/ExperimentalProjectEntity.java
  5. 20
      src/main/java/com/msdw/tms/entity/vo/ExperimentalProjectEntityVO.java
  6. 14
      src/main/java/com/msdw/tms/service/ExperimentalProjectService.java
  7. 39
      src/main/java/com/msdw/tms/service/impl/ExperimentalProjectServiceImpl.java
  8. 35
      src/main/resources/mapper/tms/ExperimentalProjectDao.xml

@ -0,0 +1,35 @@
package com.msdw.tms.api;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalProjectEntity;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@Api(value = "实验项目",tags = "实验项目")
public interface ExperimentalProjectControllerApi {
@ApiOperation(value = "实验项目列表",notes = "实验项目列表查询")
R list(@ApiParam(name = "page", value = "页码", required = true) Integer page,
@ApiParam(name = "size", value = "每页显示的数据条数", required = true) Integer size,
@ApiParam(name = "roleId", value = "创建人角色", required = false) Integer roleId,
@ApiParam(name = "status", value = "状态:1、草稿箱 2、已发布", required = false) Integer status,
@ApiParam(name = "experimentalProjectName", value = "根据项目名称搜索内容", required = false) String experimentalProjectName);
@ApiOperation(value = "添加实验项目",notes = "添加实验项目")
R save(ExperimentalProjectEntity experimentalProjectEntity);
@ApiOperation(value = "修改实验项目",notes = "修改实验项目")
R update(ExperimentalProjectEntity ExperimentalProjectEntity);
@ApiOperation(value = "删除实验项目",notes = "删除实验项目")
R delete(Integer[] ids);
@ApiOperation(value = "根据id查询实验项目详情",notes = "根据id查询实验项目详情")
R getById(Integer id);
@ApiOperation(value = "根据实验项目名称查询",notes = "根据实验项目名称查询")
R getExperimentalProjectName(String experimentalProjectName);
}

@ -0,0 +1,119 @@
package com.msdw.tms.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.msdw.tms.api.ExperimentalProjectControllerApi;
import com.msdw.tms.api.ExperimentalTeachingControllerApi;
import com.msdw.tms.api.UserControllerApi;
import com.msdw.tms.common.utils.Constant;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.ExperimentalProjectEntity;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.vo.ExperimentalProjectEntityVO;
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO;
import com.msdw.tms.entity.vo.UserEntityVo;
import com.msdw.tms.service.ExperimentalProjectService;
import com.msdw.tms.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("tms/project")
public class ExperimentalProjectController implements ExperimentalProjectControllerApi {
@Autowired
private ExperimentalProjectService experimentalProjectService;
/**
* 根据实验项目名称查询
*/
@GetMapping("/getExperimentalProjectName")
public R getExperimentalProjectName(@RequestParam String experimentalProjectName) {
ExperimentalProjectEntity one = experimentalProjectService.getOne(new QueryWrapper<ExperimentalProjectEntity>().eq("experimental_project_name", experimentalProjectName)
.eq("isdel", Constant.IsDel.NOT_DEL));
return R.ok().put("experimental_project_name", one);
}
/**
* 根据id查询实验班级详情
*/
@GetMapping("/getById/{id}")
public R getById(@PathVariable("id") Integer id){
ExperimentalProjectEntity et = experimentalProjectService.getById(id);
return R.ok().put("ExperimentalTeaching", et);
}
// /**
// * 根据邀请码查询
// */
// @GetMapping("/getInvitationCode")
// public R getInvitationCode(@RequestParam Integer invitationCode) {
// ExperimentalProjectEntity one = experimentalProjectService.getOne(new QueryWrapper<ExperimentalProjectEntity>().eq("invitation_code", invitationCode)
// .eq("is_del", Constant.IsDel.NOT_DEL));
// return R.ok().put("InvitationCode", one);
// }
/**
* 查询
*/
@GetMapping("/list")
public R list(@RequestParam Integer page,
@RequestParam Integer size,
Integer roleId,Integer status,String experimentalProjectName){
ExperimentalProjectEntityVO vo = new ExperimentalProjectEntityVO();
if (roleId!=null){
vo.setRoleId(roleId);
}
if (status!=null){
vo.setStatus(status);
}
if (experimentalProjectName!=null&&experimentalProjectName!=""){
vo.setExperimentalProjectName(experimentalProjectName);
}
PageUtils list = experimentalProjectService.queryExperimentalProject(page,size,vo);
return R.ok().put("list",list);
}
/**
* 保存
*/
@PostMapping("/save")
public R save(@RequestBody ExperimentalProjectEntity experimentalProjectEntity){
experimentalProjectService.save(experimentalProjectEntity);
return R.ok();
}
/**
* 修改
*/
@PostMapping("/update")
public R update(@RequestBody ExperimentalProjectEntity experimentalProjectEntity){
experimentalProjectService.updateById(experimentalProjectEntity);
return R.ok();
}
/**
* 删除
*/
@PostMapping("/delete")
public R delete(@RequestBody Integer[] ids){
experimentalProjectService.removeByIds(Arrays.asList(ids));
return R.ok();
}
// /**
// * 修改
// */
// @PostMapping("/start")
// public R start(@RequestParam Integer id){
// experimentalProjectService.updateById(experimentalTeachingEntity);
//
// return R.ok();
// }
}

@ -0,0 +1,17 @@
package com.msdw.tms.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.msdw.tms.entity.ExperimentalProjectEntity;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ExperimentalProjectEntityVO;
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface ExperimentalProjectDao extends BaseMapper<ExperimentalProjectEntity> {
IPage<ExperimentalProjectEntity> queryExperimentalProject(Page page1, @Param("exp") ExperimentalProjectEntityVO vo);
}

@ -0,0 +1,82 @@
package com.msdw.tms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
*
*
* @author
* @email
* @date 2020-10-14 10:36:02
*/
@Accessors(chain = true)
@Data
@TableName("tms_experimental_project")
public class ExperimentalProjectEntity implements Serializable, Comparable {
private static final long serialVersionUID = 1L;
/**
* 实验项目id
*/
@TableId
private Integer id;
/**
* 实验项目名称
*/
private String experimentalProjectName;
/**
* 项目权限(1练习 2考核 3竞赛)
*/
private Integer projectPermissions;
/**
* 实验目标
*/
private String experimentGoal;
/**
* 案例描述
*/
private String caseDescription;
/**
* 实验提示
*/
private String experimentTips;
/**
* 知识点
*/
private String knowledgePoints;
/**
* 实验介绍
*/
private String experimentIntroduction;
/**
* 创建人
*/
private Integer roleId;
/**
* 创建时间
*/
private String createTime;
/**
* 删除(0未删除 1已删除)
*/
private Integer isdel;
/**
* 状态(1草稿箱 2发布)
*/
private Integer status;
@Override
public int compareTo(Object o) {
ExperimentalProjectEntity projectEntity = (ExperimentalProjectEntity) o;
return this.id - projectEntity.id;
}
}

@ -0,0 +1,20 @@
package com.msdw.tms.entity.vo;
import lombok.Data;
/**
* 实验教学实体
*
* @author Ning
*/
@Data
public class ExperimentalProjectEntityVO {
//创建人角色
private Integer roleId;
//状态
private Integer status;
//根据实验项目名称进行搜索
private String experimentalProjectName;
}

@ -0,0 +1,14 @@
package com.msdw.tms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.entity.ExperimentalProjectEntity;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ExperimentalProjectEntityVO;
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO;
public interface ExperimentalProjectService extends IService<ExperimentalProjectEntity> {
PageUtils queryExperimentalProject(Integer page, Integer size, ExperimentalProjectEntityVO vo);
}

@ -0,0 +1,39 @@
package com.msdw.tms.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.dao.ExperimentalProjectDao;
import com.msdw.tms.dao.ExperimentalTeachingDao;
import com.msdw.tms.entity.ExperimentalProjectEntity;
import com.msdw.tms.entity.ExperimentalTeachingEntity;
import com.msdw.tms.entity.vo.ExperimentalProjectEntityVO;
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO;
import com.msdw.tms.service.ExperimentalProjectService;
import com.msdw.tms.service.ExperimentalTeachingService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Service;
@Service("experimentalProjectService")
public class ExperimentalProjectServiceImpl extends ServiceImpl<ExperimentalProjectDao, ExperimentalProjectEntity> implements ExperimentalProjectService {
// @Override
// public PageUtils queryPage(Map<String, Object> params) {
//
// IPage<ExperimentalTeachingEntity> page = this.page(
// new Query<ExperimentalTeachingEntity>().getPage(params),
// new QueryWrapper<ExperimentalTeachingEntity>()
// );
// return new PageUtils(page);
// }
@Override
public PageUtils queryExperimentalProject(Integer page, Integer size, ExperimentalProjectEntityVO vo) {
Page<T> page1 = new Page<>(page, size);
ExperimentalProjectDao userDao = this.getBaseMapper();
IPage<ExperimentalProjectEntity> list = userDao.queryExperimentalProject(page1, vo);
PageUtils pageUtils = new PageUtils(list);
return pageUtils;
}
}

@ -0,0 +1,35 @@
<?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.msdw.tms.dao.ExperimentalProjectDao">
<select id="queryExperimentalProject" resultType="com.msdw.tms.entity.ExperimentalProjectEntity">
SELECT
id,
experimental_project_name,
project_permissions,
experiment_goal,
case_description,
experiment_tips,
knowledge_points,
experiment_introduction,
status,
create_time,
role_id
FROM
tms_experimental_project
WHERE
isdel = 0
<if test="exp.roleId!=null">
AND `role_id`=#{exp.roleId,jdbcType=INTEGER}
</if>
<if test="exp.status!=null">
AND `status`=#{exp.status,jdbcType=INTEGER}
</if>
<if test="exp.experimentalProjectName!=null">
AND experimental_project_name like concat('%',#{exp.experimentalProjectName},'%')
</if>
order by create_time desc
</select>
</mapper>
Loading…
Cancel
Save