提交代码
parent
b1f8540003
commit
b2faaa9aba
|
@ -0,0 +1,90 @@
|
|||
package com.ruoyi.web.project.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.yanzhu.jh.work.domain.WorkTrain;
|
||||
import com.yanzhu.jh.work.service.IWorkTrainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @version : V1.0
|
||||
* @ClassName: ProjectTrainController
|
||||
* @Description: 专项培训||应急演练
|
||||
* @Auther: JiangYuQi
|
||||
* @Date: 2020/7/7 18:03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wechat/projectTrain")
|
||||
public class ProjectTrainController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWorkTrainService workTrainService;
|
||||
|
||||
/**
|
||||
* 查询项目专项培训||应急演练列表
|
||||
* @param workTrain
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(WorkTrain workTrain){
|
||||
if(workTrain.getDeptId()==0){
|
||||
workTrain.setDeptId(null);
|
||||
}
|
||||
return success(workTrainService.selectWorkTrainList(workTrain));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询专项培训||应急演练详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/info")
|
||||
public AjaxResult info(Long id){
|
||||
return success(workTrainService.selectById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增专项培训
|
||||
* @param workTrain
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addTrain")
|
||||
@Log(title = "专项培训", businessType = BusinessType.INSERT)
|
||||
public AjaxResult addTrain(@RequestBody WorkTrain workTrain){
|
||||
return success(workTrainService.insertWorkTrain(workTrain));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增应急演练
|
||||
* @param workTrain
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addEmergencyDrill")
|
||||
@Log(title = "应急演练", businessType = BusinessType.INSERT)
|
||||
public AjaxResult addEmergencyDrill(@RequestBody WorkTrain workTrain){
|
||||
return success(workTrainService.insertWorkTrain(workTrain));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除专项培训
|
||||
*/
|
||||
@Log(title = "专项培训", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/removeTrain")
|
||||
public AjaxResult removeTrain(@RequestParam Long id)
|
||||
{
|
||||
return toAjax(workTrainService.deleteWorkTrainById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应急演练
|
||||
*/
|
||||
@Log(title = "应急演练", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/removeEmergencyDrill")
|
||||
public AjaxResult removeEmergencyDrill(@RequestParam Long id)
|
||||
{
|
||||
return toAjax(workTrainService.deleteWorkTrainById(id));
|
||||
}
|
||||
}
|
|
@ -27,6 +27,8 @@ public class WorkTrainDept extends BaseEntity
|
|||
@Excel(name = "是否组织部门")
|
||||
private String isMain;
|
||||
|
||||
private String deptName;
|
||||
|
||||
public void setTrainId(Long trainId)
|
||||
{
|
||||
this.trainId = trainId;
|
||||
|
@ -56,6 +58,14 @@ public class WorkTrainDept extends BaseEntity
|
|||
return isMain;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -20,6 +20,14 @@ public interface WorkTrainMapper
|
|||
*/
|
||||
public WorkTrain selectWorkTrainById(Long id);
|
||||
|
||||
/**
|
||||
* 查询演练培训
|
||||
*
|
||||
* @param id 演练培训主键
|
||||
* @return 演练培训
|
||||
*/
|
||||
public WorkTrain selectById(Long id);
|
||||
|
||||
/**
|
||||
* 查询演练培训列表
|
||||
*
|
||||
|
|
|
@ -19,6 +19,14 @@ public interface IWorkTrainService
|
|||
*/
|
||||
public WorkTrain selectWorkTrainById(Long id);
|
||||
|
||||
/**
|
||||
* 查询演练培训
|
||||
*
|
||||
* @param id 演练培训主键
|
||||
* @return 演练培训
|
||||
*/
|
||||
public WorkTrain selectById(Long id);
|
||||
|
||||
/**
|
||||
* 查询演练培训列表
|
||||
*
|
||||
|
|
|
@ -50,6 +50,16 @@ public class WorkTrainServiceImpl implements IWorkTrainService
|
|||
return workTrainMapper.selectWorkTrainById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询演练培训
|
||||
*
|
||||
* @param id 演练培训主键
|
||||
* @return 演练培训
|
||||
*/
|
||||
public WorkTrain selectById(Long id) {
|
||||
return workTrainMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询演练培训列表
|
||||
*
|
||||
|
|
|
@ -132,6 +132,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join work_train_dept b on b.train_id = a.id and b.is_main ='N'
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="Long" resultMap="WorkTrainWorkTrainDeptResult">
|
||||
select a.id, a.project_id, a.project_name, a.main_image, a.train_type, a.train_title, a.train_nature, a.train_participants, a.begin_date, a.end_date, a.train_content, a.train_file, a.is_del, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,
|
||||
b.train_id as sub_train_id, b.dept_id as sub_dept_id, b.is_main as sub_is_main, d.dept_name as sub_dept_name
|
||||
from work_train a
|
||||
left join work_train_dept b on b.train_id = a.id
|
||||
left join sys_dept d on b.dept_id = d.dept_id
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertWorkTrain" parameterType="WorkTrain" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into work_train
|
||||
|
|
Loading…
Reference in New Issue