| | |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TAppUser; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Api(tags = "人员管理") |
| | | @RestController |
| | | @RequestMapping("/t-app-user") |
| | | @RequestMapping("") |
| | | public class TAppUserController { |
| | | |
| | | private final TAppUserService appUserService; |
| | | private final TokenService tokenService; |
| | | private final PasswordEncoder passwordEncoder; |
| | | @Autowired |
| | | public TAppUserController(TAppUserService appUserService, TokenService tokenService) { |
| | | public TAppUserController(TAppUserService appUserService, TokenService tokenService, PasswordEncoder passwordEncoder) { |
| | | this.appUserService = appUserService; |
| | | this.tokenService = tokenService; |
| | | this.passwordEncoder = passwordEncoder; |
| | | } |
| | | |
| | | /** |
| | | * 添加人员管理管理管理 |
| | | */ |
| | | @ApiOperation(value = "添加人员管理",response = TAppUser.class) |
| | | @PostMapping(value = "/api/t-equipment/add") |
| | | @ApiOperation(value = "注册人员管理",notes = "请求参数:TAppUser对象",response = TAppUser.class) |
| | | @PostMapping(value = "/api/t-app-user/add") |
| | | public R<Boolean> add(@RequestBody String param) { |
| | | TAppUser dto = JSON.parseObject(param,TAppUser.class); |
| | | long count = appUserService.count(Wrappers.lambdaQuery(TAppUser.class).eq(TAppUser::getAccount, dto.getAccount())); |
| | | if (count>0) { |
| | | return R.fail("该账号已存在"); |
| | | } |
| | | dto.setState(0); |
| | | dto.setStatus(1); |
| | | passwordEncoder.encode(dto.getPassword()); |
| | | appUserService.save(dto); |
| | | return R.ok(); |
| | | } |
| | |
| | | * 查看人员管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看人员管理详情") |
| | | @GetMapping(value = "/open/t-equipment/getDetailById") |
| | | @GetMapping(value = "/open/t-app-user/getDetailById") |
| | | public R<TAppUser> getDetailById() { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = appUserService.getById(userId); |