1
This commit is contained in:
parent
b58e42788c
commit
a528c2b5f3
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 维修工人")
|
||||
@ -31,19 +34,30 @@ public class RepairWorkerController {
|
||||
@Resource
|
||||
private RepairWorkerService workerService;
|
||||
|
||||
|
||||
/**
|
||||
* 批量创建维修工人集合
|
||||
* @author PQZ
|
||||
* @date 18:32 2024/10/9
|
||||
* @param userList 选中的用户集合
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.String>
|
||||
**/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建维修工人")
|
||||
public CommonResult<String> createWorker(@Valid @RequestBody RepairWorkerSaveReqVO createReqVO) {
|
||||
return success(workerService.createWorker(createReqVO));
|
||||
public CommonResult<Boolean> createWorker(@RequestBody List<UserDTO> userList) {
|
||||
workerService.saveWorkers(userList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新维修工人")
|
||||
public CommonResult<Boolean> updateWorker(@Valid @RequestBody RepairWorkerSaveReqVO updateReqVO) {
|
||||
public CommonResult<Boolean> updateWorker(@RequestBody RepairWorkerSaveReqVO updateReqVO) {
|
||||
workerService.updateWorker(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除维修工人")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
|
@ -28,7 +28,7 @@ public class RepairWorker extends TenantBaseDO {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
private Long userId;
|
||||
/**
|
||||
* 维修工人名称
|
||||
*/
|
||||
|
@ -4,11 +4,13 @@ import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修工人 Service 接口
|
||||
@ -17,13 +19,14 @@ import javax.validation.Valid;
|
||||
*/
|
||||
public interface RepairWorkerService extends IService<RepairWorker> {
|
||||
|
||||
|
||||
/**
|
||||
* 创建维修工人
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createWorker(@Valid RepairWorkerSaveReqVO createReqVO);
|
||||
* 批量创建维修工人
|
||||
* @author PQZ
|
||||
* @date 18:33 2024/10/9
|
||||
* @param userList 选中用户集合
|
||||
**/
|
||||
void saveWorkers(List<UserDTO> userList);
|
||||
|
||||
/**
|
||||
* 更新维修工人
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper;
|
||||
@ -7,6 +8,7 @@ import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -14,6 +16,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修工人 Service 实现类
|
||||
@ -27,13 +31,26 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
@Resource
|
||||
private RepairWorkerMapper workerMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 批量创建维修工人
|
||||
*
|
||||
* @param userList 选中用户集合
|
||||
* @author PQZ
|
||||
* @date 18:33 2024/10/9
|
||||
**/
|
||||
@Override
|
||||
public String createWorker(RepairWorkerSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
RepairWorker worker = BeanUtils.toBean(createReqVO, RepairWorker.class);
|
||||
workerMapper.insert(worker);
|
||||
// 返回
|
||||
return worker.getId();
|
||||
public void saveWorkers(List<UserDTO> userList) {
|
||||
if (CollectionUtil.isNotEmpty(userList)){
|
||||
List<RepairWorker> saveList = new ArrayList<>();
|
||||
userList.forEach(item -> {
|
||||
RepairWorker worker = new RepairWorker();
|
||||
worker.setUserId(item.getId());
|
||||
worker.setUserName(item.getNickname());
|
||||
saveList.add(worker);
|
||||
});
|
||||
saveBatch(saveList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,6 +8,4 @@ import lombok.Data;
|
||||
@Data
|
||||
public class RepairWorkerSaveReqVO extends RepairWorker {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,9 @@
|
||||
<if test="entity.userName != null and entity.userName != ''">
|
||||
and main.user_name = #{entity.userName}
|
||||
</if>
|
||||
<if test="entity.workType != null and entity.workType != ''">
|
||||
and main.work_type = #{entity.workType}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
1
数据库设计/.back_蓝安集团一体化平台/T20241009173250.pdma.json
Normal file
1
数据库设计/.back_蓝安集团一体化平台/T20241009173250.pdma.json
Normal file
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
"avatar": "",
|
||||
"version": "4.9.2",
|
||||
"createdTime": "2024-10-9 10:34:15",
|
||||
"updatedTime": "2024-10-9 13:49:58",
|
||||
"updatedTime": "2024-10-9 17:32:50",
|
||||
"dbConns": [],
|
||||
"profile": {
|
||||
"default": {
|
||||
@ -683,7 +683,7 @@
|
||||
"optionsFetcher": ""
|
||||
}
|
||||
},
|
||||
"menuWidth": "297px"
|
||||
"menuWidth": "266px"
|
||||
},
|
||||
"entities": [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user