7 changed files with 67 additions and 29 deletions
			
			
		@ -0,0 +1,56 @@ | 
				
			|||||||
 | 
					package com.hnac.hzims.safeproduct.controller; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; | 
				
			||||||
 | 
					import com.hnac.hzims.safeproduct.constants.SafeProductConstant; | 
				
			||||||
 | 
					import io.swagger.annotations.Api; | 
				
			||||||
 | 
					import io.swagger.annotations.ApiOperation; | 
				
			||||||
 | 
					import lombok.AllArgsConstructor; | 
				
			||||||
 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			||||||
 | 
					import org.springblade.core.boot.ctrl.BladeController; | 
				
			||||||
 | 
					import org.springblade.core.secure.BladeUser; | 
				
			||||||
 | 
					import org.springblade.core.tool.api.R; | 
				
			||||||
 | 
					import org.springblade.system.feign.ISysClient; | 
				
			||||||
 | 
					import org.springblade.system.user.entity.User; | 
				
			||||||
 | 
					import org.springblade.system.user.feign.IUserClient; | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.GetMapping; | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RequestMapping; | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RequestParam; | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RestController; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** | 
				
			||||||
 | 
					 * 公用业务接口类 | 
				
			||||||
 | 
					 * | 
				
			||||||
 | 
					 * @author liwen | 
				
			||||||
 | 
					 * @date 2023-12-28 | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					@RestController | 
				
			||||||
 | 
					@AllArgsConstructor | 
				
			||||||
 | 
					@RequestMapping("/base") | 
				
			||||||
 | 
					@Api(value = "公用业务", tags = "公用业务接口") | 
				
			||||||
 | 
					public class BaseController extends BladeController { | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final ISysClient sysClient; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private final IUserClient userClient; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/getDeptName") | 
				
			||||||
 | 
					    @ApiOperation(value = "获取所属机构名") | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 1) | 
				
			||||||
 | 
					    public R<String> getDeptName() { | 
				
			||||||
 | 
					        BladeUser bladeUser = getUser(); | 
				
			||||||
 | 
					        String deptId = bladeUser.getDeptId(); | 
				
			||||||
 | 
					        if (StringUtils.isNotBlank(deptId)) { | 
				
			||||||
 | 
					            return sysClient.getDeptName(Long.valueOf(deptId)); | 
				
			||||||
 | 
					        } | 
				
			||||||
 | 
					        return R.data(null, "所属机构为空"); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @GetMapping("/getUserList") | 
				
			||||||
 | 
					    @ApiOperation(value = "获取用户列表") | 
				
			||||||
 | 
					    @ApiOperationSupport(order = 2) | 
				
			||||||
 | 
					    public R<List<User>> getUserList(@RequestParam String name) { | 
				
			||||||
 | 
					        return userClient.userListByCodeAndNameAndAccount(SafeProductConstant.TENANT_ID, null, name, null); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					} | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue