Compare commits
	
		
			No commits in common. "483199f0422d21a4263dc6b656b6d3c4932725b4" and "c2cb6324e1aa00465638cf4ea12d90f22d06f72c" have entirely different histories.
		
	
	
		
			483199f042
			...
			c2cb6324e1
		
	
		
| @ -9,7 +9,6 @@ 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; | ||||
| @ -21,8 +20,6 @@ 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 = "管理后台 - 维修工人") | ||||
| @ -34,30 +31,19 @@ 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<Boolean> createWorker(@RequestBody List<UserDTO> userList) { | ||||
|         workerService.saveWorkers(userList); | ||||
|         return success(true); | ||||
|     public CommonResult<String> createWorker(@Valid @RequestBody RepairWorkerSaveReqVO createReqVO) { | ||||
|         return success(workerService.createWorker(createReqVO)); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     @PutMapping("/update") | ||||
|     @Operation(summary = "更新维修工人") | ||||
|     public CommonResult<Boolean> updateWorker(@RequestBody RepairWorkerSaveReqVO updateReqVO) { | ||||
|     public CommonResult<Boolean> updateWorker(@Valid @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 Long userId; | ||||
|     private String userId; | ||||
|     /** | ||||
|      * 维修工人名称 | ||||
|      */ | ||||
|  | ||||
| @ -4,13 +4,11 @@ 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 接口 | ||||
| @ -19,14 +17,13 @@ import java.util.List; | ||||
|  */ | ||||
| public interface RepairWorkerService extends IService<RepairWorker> { | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 批量创建维修工人 | ||||
|      * @author PQZ | ||||
|      * @date 18:33 2024/10/9 | ||||
|      * @param userList 选中用户集合 | ||||
|     **/ | ||||
|     void saveWorkers(List<UserDTO> userList); | ||||
|      * 创建维修工人 | ||||
|      * | ||||
|      * @param createReqVO 创建信息 | ||||
|      * @return 编号 | ||||
|      */ | ||||
|     String createWorker(@Valid RepairWorkerSaveReqVO createReqVO); | ||||
| 
 | ||||
|     /** | ||||
|      * 更新维修工人 | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| 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; | ||||
| @ -8,7 +7,6 @@ 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; | ||||
| @ -16,8 +14,6 @@ import org.springframework.stereotype.Service; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| 
 | ||||
| import javax.annotation.Resource; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 维修工人 Service 实现类 | ||||
| @ -31,26 +27,13 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep | ||||
|     @Resource | ||||
|     private RepairWorkerMapper workerMapper; | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 批量创建维修工人 | ||||
|      * | ||||
|      * @param userList 选中用户集合 | ||||
|      * @author PQZ | ||||
|      * @date 18:33 2024/10/9 | ||||
|      **/ | ||||
|     @Override | ||||
|     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); | ||||
|         } | ||||
|     public String createWorker(RepairWorkerSaveReqVO createReqVO) { | ||||
|         // 插入 | ||||
|         RepairWorker worker = BeanUtils.toBean(createReqVO, RepairWorker.class); | ||||
|         workerMapper.insert(worker); | ||||
|         // 返回 | ||||
|         return worker.getId(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | ||||
| @ -8,4 +8,6 @@ import lombok.Data; | ||||
| @Data | ||||
| public class RepairWorkerSaveReqVO extends RepairWorker { | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -21,9 +21,6 @@ | ||||
|             <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> | ||||
|  | ||||
										
											
												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 17:32:50", | ||||
|   "updatedTime": "2024-10-9 18:10:10", | ||||
|   "dbConns": [], | ||||
|   "profile": { | ||||
|     "default": { | ||||
| @ -683,7 +683,7 @@ | ||||
|         "optionsFetcher": "" | ||||
|       } | ||||
|     }, | ||||
|     "menuWidth": "266px" | ||||
|     "menuWidth": "297px" | ||||
|   }, | ||||
|   "entities": [ | ||||
|     { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user