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