| | |
| | | package org.springblade.modules.system.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.PropertyNamingStrategy; |
| | | import com.alibaba.fastjson.serializer.SerializeConfig; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.*; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.cache.CacheNames; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | |
| | | * @author Chill |
| | | */ |
| | | @NonDS |
| | | @ApiIgnore |
| | | //@ApiIgnore |
| | | @RestController |
| | | @RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME+"/user") |
| | | @RequestMapping(AppConstant.APPLICATION_SYSTEM_NAME + "/user") |
| | | @AllArgsConstructor |
| | | @Api(value = "用户管理", tags = "用户管理") |
| | | public class UserController { |
| | | |
| | | private final IUserService userService; |
| | |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "查看详情", notes = "传入id") |
| | | @GetMapping("/detail") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | // @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<UserVO> detail(User user) { |
| | | User detail = userService.getOne(Condition.getQueryWrapper(user)); |
| | | return R.data(UserWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "查看详情返回String", notes = "传入id") |
| | | @GetMapping("/details") |
| | | // @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<String> details(User user) { |
| | | UserVO detail = userService.getuserById(user.getId()); |
| | | SerializeConfig config = new SerializeConfig(); |
| | | config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase; |
| | | String json1 = JSON.toJSONString(detail, config); |
| | | return R.data(json1); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | @GetMapping("/searchUser") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "搜索用户", notes = "传入name") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<List<UserVO>> searchUser(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) { |
| | | IPage<User> pages = userService.selectUserPage(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId())); |
| | | return R.data(UserWrapper.build().listVO(pages.getRecords())); |
| | | } |
| | | |
| | | @GetMapping("/searchUserByDistrictId") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "通过小区Id搜索用户", notes = "传入districtId") |
| | | // @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<List<UserVO>> searchUserByDistrictId(String districtId) { |
| | | List<User> resutl = userService.searchUserByDistrictId(districtId); |
| | | return R.data(UserWrapper.build().listVO(resutl)); |
| | | } |
| | | |
| | | /** |
| | | * 自定义用户列表 |
| | | */ |
| | |
| | | }) |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "列表", notes = "传入account和realName") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | // @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<UserVO>> page(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) { |
| | | IPage<User> pages = userService.selectUserPage(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId())); |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 按条件查询用户信息 |
| | | * |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @GetMapping("/getUserListByParam") |
| | | public R getUserListByParam(UserVO user) { |
| | | return R.data(userService.getUserListByParam(user)); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getUserInfo") |
| | | public R getUserInfo(){ |
| | | //根据保安员编码查询保安员信息 |
| | | return R.data(userService.getUserInfo(AuthUtil.getUserId())); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @GetMapping("/getUserInfoByCode") |
| | | @ApiOperation(value = "查询物业人员/网格人员", notes = "houseCode") |
| | | public R getUserInfoByCode(@RequestParam("houseCode") String houseCode, @RequestParam(value = "type", defaultValue = "2") String type) { |
| | | return R.data(userService.getUserInfoByCode(houseCode, type)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询物业人员/网格人员 |
| | | */ |
| | | @GetMapping("/getUserInfoByDistrictId") |
| | | @ApiOperation(value = "查询物业人员/网格人员", notes = "houseCode") |
| | | public R getUserInfoByDistrictId(@RequestParam("districtId") String districtId, @RequestParam(value = "building", required = false) String building) { |
| | | return R.data(userService.getUserInfoByDistrictId(districtId, building)); |
| | | } |
| | | |
| | | /** |
| | | * 处理漏绑定的user_dept |
| | | */ |
| | | @GetMapping("/handleUserDept") |
| | | public R handleUserDept() { |
| | | return R.data(userService.handleUserDept()); |
| | | } |
| | | |
| | | } |