提交代码

dev_xds
姜玉琦 2023-08-29 00:50:13 +08:00
parent b1f8540003
commit b2faaa9aba
6 changed files with 135 additions and 0 deletions

View File

@ -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));
}
}

View File

@ -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)

View File

@ -20,6 +20,14 @@ public interface WorkTrainMapper
*/
public WorkTrain selectWorkTrainById(Long id);
/**
*
*
* @param id
* @return
*/
public WorkTrain selectById(Long id);
/**
*
*

View File

@ -19,6 +19,14 @@ public interface IWorkTrainService
*/
public WorkTrain selectWorkTrainById(Long id);
/**
*
*
* @param id
* @return
*/
public WorkTrain selectById(Long id);
/**
*
*

View File

@ -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);
}
/**
*
*

View File

@ -133,6 +133,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
<trim prefix="(" suffix=")" suffixOverrides=",">