parent
e35ca64653
commit
5c4fd76611
11 changed files with 272 additions and 3 deletions
@ -0,0 +1,27 @@ |
||||
package com.msdw.tms.api; |
||||
|
||||
import com.msdw.tms.common.utils.R; |
||||
import com.msdw.tms.entity.ExperimentalTeachingEntity; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
|
||||
@Api(value = "实验教学",tags = "实验教学") |
||||
public interface ExperimentalTeachingControllerApi { |
||||
|
||||
@ApiOperation(value = "实验教学列表",notes = "实验教学列表查询") |
||||
R list(@ApiParam(name = "page", value = "页码", required = true) Integer page, |
||||
@ApiParam(name = "size", value = "每页显示的数据条数", required = true) Integer size, |
||||
ExperimentalTeachingEntityVO request); |
||||
|
||||
@ApiOperation(value = "添加实验教学",notes = "添加实验教学") |
||||
R save(ExperimentalTeachingEntity experimentalTeachingEntity); |
||||
|
||||
@ApiOperation(value = "修改用户个人档案",notes = "修改用户个人档案") |
||||
R update(ExperimentalTeachingEntity experimentalTeachingEntity); |
||||
|
||||
@ApiOperation(value = "删除用户个人档案",notes = "删除用户个人档案") |
||||
R delete(Long[] ids); |
||||
} |
@ -0,0 +1,76 @@ |
||||
package com.msdw.tms.controller; |
||||
|
||||
import com.msdw.tms.api.ExperimentalTeachingControllerApi; |
||||
import com.msdw.tms.api.UserControllerApi; |
||||
import com.msdw.tms.common.utils.PageUtils; |
||||
import com.msdw.tms.common.utils.R; |
||||
import com.msdw.tms.entity.ExperimentalTeachingEntity; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; |
||||
import com.msdw.tms.entity.vo.UserEntityVo; |
||||
import com.msdw.tms.service.ExperimentalTeachingService; |
||||
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/exp") |
||||
public class ExperimentalTeachingController implements ExperimentalTeachingControllerApi { |
||||
|
||||
@Autowired |
||||
private ExperimentalTeachingService experimentalTeachingService; |
||||
|
||||
|
||||
/** |
||||
* 列表 |
||||
*/ |
||||
// @GetMapping("/page")
|
||||
// public R list(@RequestParam Map<String, Object> params){
|
||||
// PageUtils page = experimentalTeachingService.queryPage(params);
|
||||
// return R.ok().put("page", page);
|
||||
// }
|
||||
|
||||
/** |
||||
* 查询 |
||||
*/ |
||||
@GetMapping("/list") |
||||
public R list(@RequestParam Integer page, |
||||
@RequestParam Integer size, |
||||
ExperimentalTeachingEntityVO request){ |
||||
PageUtils list = experimentalTeachingService.queryExperimentalTeaching(page,size,request); |
||||
return R.ok().put("list",list); |
||||
} |
||||
/** |
||||
* 保存 |
||||
*/ |
||||
@PostMapping("/save") |
||||
public R save(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity){ |
||||
experimentalTeachingService.save(experimentalTeachingEntity); |
||||
return R.ok(); |
||||
} |
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
@PutMapping("/update") |
||||
public R update(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity){ |
||||
experimentalTeachingService.updateById(experimentalTeachingEntity); |
||||
|
||||
return R.ok(); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@DeleteMapping("/delete") |
||||
public R delete(@RequestBody Long[] ids){ |
||||
experimentalTeachingService.removeByIds(Arrays.asList(ids)); |
||||
|
||||
return R.ok(); |
||||
} |
||||
} |
@ -0,0 +1,20 @@ |
||||
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.common.utils.PageUtils; |
||||
import com.msdw.tms.entity.ExperimentalTeachingEntity; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; |
||||
import com.msdw.tms.entity.vo.UserEntityVo; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface ExperimentalTeachingDao extends BaseMapper<ExperimentalTeachingEntity> { |
||||
|
||||
IPage<ExperimentalTeachingEntity> queryExperimentalTeaching(Page page1,@Param("exp") ExperimentalTeachingEntityVO request); |
||||
} |
@ -0,0 +1,29 @@ |
||||
package com.msdw.tms.entity.vo; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* 实验教学实体 |
||||
* |
||||
* @author Ning |
||||
*/ |
||||
@Data |
||||
public class ExperimentalTeachingEntityVO { |
||||
|
||||
//发布类型
|
||||
private Integer type; |
||||
//启动时间
|
||||
private String startTime; |
||||
//结束时间
|
||||
private String stopTime; |
||||
//月份
|
||||
private Integer month; |
||||
//搜索内容
|
||||
private String searchContent; |
||||
//状态
|
||||
private Integer status; |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package com.msdw.tms.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.msdw.tms.common.utils.PageUtils; |
||||
import com.msdw.tms.entity.ExperimentalTeachingEntity; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; |
||||
import com.msdw.tms.entity.vo.UserEntityVo; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface ExperimentalTeachingService extends IService<ExperimentalTeachingEntity> { |
||||
|
||||
PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingEntityVO request); |
||||
|
||||
// PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
} |
@ -0,0 +1,48 @@ |
||||
package com.msdw.tms.service.impl; |
||||
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.msdw.tms.common.utils.Constant; |
||||
import com.msdw.tms.common.utils.PageUtils; |
||||
import com.msdw.tms.common.utils.Query; |
||||
import com.msdw.tms.dao.ExperimentalTeachingDao; |
||||
import com.msdw.tms.dao.UserDao; |
||||
import com.msdw.tms.entity.ExperimentalTeachingEntity; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.vo.ExperimentalTeachingEntityVO; |
||||
import com.msdw.tms.entity.vo.ProjectRecordVo; |
||||
import com.msdw.tms.entity.vo.UserEntityVo; |
||||
import com.msdw.tms.service.ExperimentalTeachingService; |
||||
import com.msdw.tms.service.UserService; |
||||
import org.apache.poi.ss.formula.functions.T; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("experimentalTeachingService") |
||||
public class ExperimentalTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ExperimentalTeachingService { |
||||
|
||||
|
||||
// @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 queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingEntityVO request) { |
||||
Page<T> page1 = new Page<>(page, size); |
||||
ExperimentalTeachingDao userDao = this.getBaseMapper(); |
||||
// PageUtils vo = userDao.queryExperimentalTeaching(page1,request);
|
||||
IPage<ExperimentalTeachingEntity> list = userDao.queryExperimentalTeaching(page1, request); |
||||
PageUtils pageUtils = new PageUtils(list); |
||||
return pageUtils; |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
<?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.ExperimentalTeachingDao"> |
||||
|
||||
<select id="queryExperimentalTeaching" resultType="com.msdw.tms.entity.ExperimentalTeachingEntity"> |
||||
SELECT |
||||
id, |
||||
experimental_class_name, |
||||
experimental_name, |
||||
project_id, |
||||
project_name, |
||||
experimental_number, |
||||
experiment_duration, |
||||
type, |
||||
start_time, |
||||
stop_time, |
||||
status, |
||||
invitation_code, |
||||
is_code, |
||||
user_id, |
||||
creation_time |
||||
FROM |
||||
tms_experimental_teaching |
||||
WHERE |
||||
is_del = 0 |
||||
<if test="exp.type != null"> |
||||
AND type=#{exp.type,jdbcType=INTEGER} |
||||
</if> |
||||
<if test='exp.month==1'> |
||||
AND creation_time>DATE_SUB(CURDATE(), INTERVAL 1 MONTH) |
||||
</if> |
||||
<if test='exp.month==3'> |
||||
AND creation_time>DATE_SUB(CURDATE(), INTERVAL 3 MONTH) |
||||
</if> |
||||
<if test='exp.month==6'> |
||||
AND creation_time>DATE_SUB(CURDATE(), INTERVAL 6 MONTH) |
||||
</if> |
||||
<if test='exp.startTime!=null and exp.stopTime!=null'> |
||||
AND creation_time between #{exp.startTime} and #{exp.stopTime} |
||||
</if> |
||||
<if test="exp.searchContent!=null"> |
||||
AND ( project_name like concat('%',#{exp.searchContent},'%') or experimental_class_name like concat('%',#{exp.searchContent},'%') ) |
||||
</if> |
||||
</select> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue