feat: 任务增删改查逻辑完成
parent
e2884835f0
commit
bd05550939
|
@ -1,73 +0,0 @@
|
||||||
package tech.unissense.pms.web.controller.business.examine.task;
|
|
||||||
|
|
||||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
|
||||||
import tech.unissense.pms.business.examine.task.service.ExamineTaskService;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 考核任务表 (ExamineTask)表控制层
|
|
||||||
*
|
|
||||||
* @author makejava
|
|
||||||
* @since 2025-01-02 10:18:28
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("examineTask")
|
|
||||||
public class ExamineTaskController {
|
|
||||||
/**
|
|
||||||
* 服务对象
|
|
||||||
*/
|
|
||||||
@Resource
|
|
||||||
private ExamineTaskService examineTaskService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 单条数据
|
|
||||||
*/
|
|
||||||
@GetMapping("{id}")
|
|
||||||
public ResponseEntity<ExamineTask> queryById(@PathVariable("id") Integer id) {
|
|
||||||
return ResponseEntity.ok(this.examineTaskService.queryById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实体
|
|
||||||
* @return 新增结果
|
|
||||||
*/
|
|
||||||
@PostMapping
|
|
||||||
public ResponseEntity<ExamineTask> add(ExamineTask examineTask) {
|
|
||||||
return ResponseEntity.ok(this.examineTaskService.insert(examineTask));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实体
|
|
||||||
* @return 编辑结果
|
|
||||||
*/
|
|
||||||
@PutMapping
|
|
||||||
public ResponseEntity<ExamineTask> edit(ExamineTask examineTask) {
|
|
||||||
return ResponseEntity.ok(this.examineTaskService.update(examineTask));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 删除是否成功
|
|
||||||
*/
|
|
||||||
@DeleteMapping
|
|
||||||
public ResponseEntity<Boolean> deleteById(Integer id) {
|
|
||||||
return ResponseEntity.ok(this.examineTaskService.deleteById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package tech.unissense.pms.web.controller.business.examine.task;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||||
|
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||||
|
import tech.unissense.pms.business.examine.task.service.TaskService;
|
||||||
|
import tech.unissense.pms.business.project.domain.Project;
|
||||||
|
import tech.unissense.pms.common.core.controller.BaseController;
|
||||||
|
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||||
|
import tech.unissense.pms.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static tech.unissense.pms.common.utils.PageUtils.startPage;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/task")
|
||||||
|
public class TaskSetUpController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaskService taskService;
|
||||||
|
|
||||||
|
// 新增任务
|
||||||
|
@PostMapping("/add")
|
||||||
|
public AjaxResult addTask(@RequestBody ExamineTask task) {
|
||||||
|
return AjaxResult.success(taskService.addTask(task));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页查询+模糊查询
|
||||||
|
@GetMapping("/get")
|
||||||
|
public TableDataInfo getTasks(@RequestBody TaskQueryDto queryDto) {
|
||||||
|
startPage();
|
||||||
|
List<ExamineTask> tasks = taskService.getTasks(queryDto);
|
||||||
|
return getDataTable(tasks);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑任务
|
||||||
|
@PutMapping("/update")
|
||||||
|
public AjaxResult updateTask( @RequestBody ExamineTask updatedTask) {
|
||||||
|
Integer id = updatedTask.getId();
|
||||||
|
if (id == null) {
|
||||||
|
return AjaxResult.error("任务 ID 不能为空");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(taskService.updateTask(updatedTask));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除任务
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public AjaxResult deleteTask(@PathVariable Integer id) {
|
||||||
|
taskService.deleteTask(id);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
//指标配置
|
||||||
|
@PostMapping("/target")
|
||||||
|
public AjaxResult getTarget(@PathVariable Integer id){
|
||||||
|
taskService.getTarget(id);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,7 +71,7 @@ spring:
|
||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 192.168.124.103
|
host: 192.168.124.202
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||||
* @since 2025-01-02 10:18:29
|
* @since 2025-01-02 10:18:29
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class ExamineTask implements Serializable {
|
public class ExamineTask implements Serializable {
|
||||||
private static final long serialVersionUID = -72205614757391876L;
|
private static final long serialVersionUID = -72205614757391876L;
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
@ -20,10 +20,14 @@ public class ExamineTask implements Serializable {
|
||||||
* 考核任务名
|
* 考核任务名
|
||||||
*/
|
*/
|
||||||
private String taskName;
|
private String taskName;
|
||||||
|
|
||||||
|
private Integer peopleNumber;
|
||||||
|
|
||||||
|
private String peopleNumberDetail;
|
||||||
/**
|
/**
|
||||||
* 考核任务状态 0:进行中 2:已过期
|
* 考核任务状态 0:进行中 2:已过期
|
||||||
*/
|
*/
|
||||||
private String taskStatus;
|
private Integer taskStatus;
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@ -32,8 +36,5 @@ public class ExamineTask implements Serializable {
|
||||||
* 截止时间
|
* 截止时间
|
||||||
*/
|
*/
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package tech.unissense.pms.business.examine.task.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TaskQueryDto {
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
|
private Integer taskStatus;
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -16,71 +17,12 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ExamineTaskMapper {
|
public interface ExamineTaskMapper {
|
||||||
|
|
||||||
/**
|
void addTask(ExamineTask task);
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
ExamineTask queryById(Integer id);
|
|
||||||
|
|
||||||
/**
|
List<ExamineTask> getTasks(TaskQueryDto queryDto);
|
||||||
* 查询指定行数据
|
|
||||||
*
|
|
||||||
* @param examineTask 查询条件
|
|
||||||
* @param pageable 分页对象
|
|
||||||
* @return 对象列表
|
|
||||||
*/
|
|
||||||
List<ExamineTask> queryAllByLimit(ExamineTask examineTask, @Param("pageable") Pageable pageable);
|
|
||||||
|
|
||||||
/**
|
void updateTask(ExamineTask updatedTask);
|
||||||
* 统计总行数
|
|
||||||
*
|
|
||||||
* @param examineTask 查询条件
|
|
||||||
* @return 总行数
|
|
||||||
*/
|
|
||||||
long count(ExamineTask examineTask);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insert(ExamineTask examineTask);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增数据(MyBatis原生foreach方法)
|
|
||||||
*
|
|
||||||
* @param entities List<ExamineTask> 实例对象列表
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insertBatch(@Param("entities") List<ExamineTask> entities);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
|
||||||
*
|
|
||||||
* @param entities List<ExamineTask> 实例对象列表
|
|
||||||
* @return 影响行数
|
|
||||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
|
||||||
*/
|
|
||||||
int insertOrUpdateBatch(@Param("entities") List<ExamineTask> entities);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int update(ExamineTask examineTask);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int deleteById(Integer id);
|
|
||||||
|
|
||||||
|
void deleteTask(Integer id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
package tech.unissense.pms.business.examine.task.service;
|
|
||||||
|
|
||||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 考核任务表 (ExamineTask)表服务接口
|
|
||||||
*
|
|
||||||
* @author makejava
|
|
||||||
* @since 2025-01-02 10:18:29
|
|
||||||
*/
|
|
||||||
public interface ExamineTaskService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
ExamineTask queryById(Integer id);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
ExamineTask insert(ExamineTask examineTask);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
ExamineTask update(ExamineTask examineTask);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 是否成功
|
|
||||||
*/
|
|
||||||
boolean deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package tech.unissense.pms.business.examine.task.service;
|
||||||
|
|
||||||
|
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||||
|
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TaskService {
|
||||||
|
ExamineTask addTask(ExamineTask task);
|
||||||
|
|
||||||
|
List<ExamineTask> getTasks(TaskQueryDto queryDto);
|
||||||
|
|
||||||
|
ExamineTask updateTask(ExamineTask updatedTask);
|
||||||
|
|
||||||
|
void deleteTask(Integer id);
|
||||||
|
|
||||||
|
void getTarget(Integer id);
|
||||||
|
}
|
|
@ -1,68 +0,0 @@
|
||||||
package tech.unissense.pms.business.examine.task.service.impl;
|
|
||||||
|
|
||||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
|
||||||
import tech.unissense.pms.business.examine.task.mapper.ExamineTaskMapper;
|
|
||||||
import tech.unissense.pms.business.examine.task.service.ExamineTaskService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 考核任务表 (ExamineTask)表服务实现类
|
|
||||||
*
|
|
||||||
* @author makejava
|
|
||||||
* @since 2025-01-02 10:18:29
|
|
||||||
*/
|
|
||||||
@Service("examineTaskService")
|
|
||||||
public class ExamineTaskServiceImpl implements ExamineTaskService {
|
|
||||||
@Resource
|
|
||||||
private ExamineTaskMapper examineTaskMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ExamineTask queryById(Integer id) {
|
|
||||||
return this.examineTaskMapper.queryById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ExamineTask insert(ExamineTask examineTask) {
|
|
||||||
this.examineTaskMapper.insert(examineTask);
|
|
||||||
return examineTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param examineTask 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ExamineTask update(ExamineTask examineTask) {
|
|
||||||
this.examineTaskMapper.update(examineTask);
|
|
||||||
return this.queryById(examineTask.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 是否成功
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean deleteById(Integer id) {
|
|
||||||
return this.examineTaskMapper.deleteById(id) > 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package tech.unissense.pms.business.examine.task.service.impl;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||||
|
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||||
|
import tech.unissense.pms.business.examine.task.mapper.ExamineTaskMapper;
|
||||||
|
import tech.unissense.pms.business.examine.task.service.TaskService;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class TaskServiceImpl implements TaskService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExamineTaskMapper examineTaskDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExamineTask addTask(ExamineTask task) {
|
||||||
|
examineTaskDao.addTask(task);
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExamineTask> getTasks(TaskQueryDto queryDto) {
|
||||||
|
return examineTaskDao.getTasks(queryDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExamineTask updateTask(ExamineTask updatedTask) {
|
||||||
|
examineTaskDao.updateTask(updatedTask);
|
||||||
|
return updatedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTask(Integer id) {
|
||||||
|
examineTaskDao.deleteTask(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTarget(Integer id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,122 +5,47 @@
|
||||||
<resultMap type="tech.unissense.pms.business.examine.task.domain.ExamineTask" id="ExamineTaskMap">
|
<resultMap type="tech.unissense.pms.business.examine.task.domain.ExamineTask" id="ExamineTaskMap">
|
||||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
|
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
|
||||||
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
|
<result property="peopleNumber" column="people_number" jdbcType="INTEGER"/>
|
||||||
|
<result property="peopleNumberDetail" column="people_number_detail" jdbcType="VARCHAR"/>
|
||||||
|
<result property="taskStatus" column="task_status" jdbcType="INTEGER"/>
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!--查询单个-->
|
<!-- 新增任务 -->
|
||||||
<select id="queryById" resultMap="ExamineTaskMap">
|
<insert id="addTask" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||||
select id,
|
INSERT INTO pms_examine_task (task_name, people_number, people_number_detail, task_status, create_time, end_time)
|
||||||
task_name,
|
VALUES (#{taskName}, #{peopleNumber}, #{peopleNumberDetail}, #{taskStatus}, #{createTime}, #{endTime})
|
||||||
task_status,
|
</insert>
|
||||||
create_time,
|
|
||||||
end_time
|
|
||||||
from pms_examine_task
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--查询指定行数据-->
|
<select id="getTasks" resultMap="ExamineTaskMap">
|
||||||
<select id="queryAllByLimit" resultMap="ExamineTaskMap">
|
SELECT * FROM pms_examine_task
|
||||||
select
|
|
||||||
id, task_name, task_status, create_time, end_time
|
|
||||||
from pms_examine_task
|
|
||||||
<where>
|
<where>
|
||||||
<if test="id != null">
|
|
||||||
and id = #{id}
|
|
||||||
</if>
|
|
||||||
<if test="taskName != null and taskName != ''">
|
<if test="taskName != null and taskName != ''">
|
||||||
and task_name = #{taskName}
|
AND task_name LIKE CONCAT('%', #{taskName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="taskStatus != null and taskStatus != ''">
|
<if test="taskStatus != null">
|
||||||
and task_status = #{taskStatus}
|
AND task_status = #{taskStatus}
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
and create_time = #{createTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
and end_time = #{endTime}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
limit #{pageable.offset}, #{pageable.pageSize}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!--统计总行数-->
|
|
||||||
<select id="count" resultType="java.lang.Long">
|
|
||||||
select count(1)
|
|
||||||
from pms_examine_task
|
|
||||||
<where>
|
|
||||||
<if test="id != null">
|
|
||||||
and id = #{id}
|
|
||||||
</if>
|
|
||||||
<if test="taskName != null and taskName != ''">
|
|
||||||
and task_name = #{taskName}
|
|
||||||
</if>
|
|
||||||
<if test="taskStatus != null and taskStatus != ''">
|
|
||||||
and task_status = #{taskStatus}
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
and create_time = #{createTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
and end_time = #{endTime}
|
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--新增所有列-->
|
<update id="updateTask">
|
||||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
UPDATE pms_examine_task
|
||||||
insert into pms_examine_task(task_name, task_status, create_time, end_time)
|
|
||||||
values (#{taskName}, #{taskStatus}, #{createTime}, #{endTime})
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
||||||
insert into pms_examine_task(task_name, task_status, create_time, end_time)
|
|
||||||
values
|
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
|
||||||
(#{entity.taskName}, #{entity.taskStatus}, #{entity.createTime}, #{entity.endTime})
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
||||||
insert into pms_examine_task(task_name, task_status, create_time, end_time)
|
|
||||||
values
|
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
|
||||||
(#{entity.taskName}, #{entity.taskStatus}, #{entity.createTime}, #{entity.endTime})
|
|
||||||
</foreach>
|
|
||||||
on duplicate key update
|
|
||||||
task_name = values(task_name),
|
|
||||||
task_status = values(task_status),
|
|
||||||
create_time = values(create_time),
|
|
||||||
end_time = values(end_time)
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<!--通过主键修改数据-->
|
|
||||||
<update id="update">
|
|
||||||
update pms_examine_task
|
|
||||||
<set>
|
<set>
|
||||||
<if test="taskName != null and taskName != ''">
|
<if test="taskName != null">task_name = #{taskName},</if>
|
||||||
task_name = #{taskName},
|
<if test="peopleNumber != null">people_number = #{peopleNumber},</if>
|
||||||
</if>
|
<if test="peopleNumberDetail != null">people_number_detail = #{peopleNumberDetail},</if>
|
||||||
<if test="taskStatus != null and taskStatus != ''">
|
<if test="taskStatus != null">task_status = #{taskStatus},</if>
|
||||||
task_status = #{taskStatus},
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
</if>
|
<if test="endTime != null">end_time = #{endTime},</if>
|
||||||
<if test="createTime != null">
|
|
||||||
create_time = #{createTime},
|
|
||||||
</if>
|
|
||||||
<if test="endTime != null">
|
|
||||||
end_time = #{endTime},
|
|
||||||
</if>
|
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
WHERE id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!--通过主键删除-->
|
<delete id="deleteTask">
|
||||||
<delete id="deleteById">
|
DELETE FROM pms_examine_task
|
||||||
delete
|
WHERE id = #{id}
|
||||||
from pms_examine_task
|
|
||||||
where id = #{id}
|
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue