TenantPreJoinController.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package com.ym.mec.web.controller;
  2. import com.ym.mec.biz.dal.dto.TenantPreJoinDto;
  3. import com.ym.mec.biz.dal.entity.TenantPreJoin;
  4. import com.ym.mec.biz.dal.vo.TenantPreJoinVo;
  5. import com.ym.mec.biz.service.TenantPreJoinService;
  6. import com.ym.mec.common.controller.BaseController;
  7. import com.ym.mec.common.entity.HttpResponseResult;
  8. import com.ym.mec.common.page.PageInfo;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import org.springframework.security.access.prepost.PreAuthorize;
  12. import org.springframework.web.bind.annotation.*;
  13. import javax.annotation.Resource;
  14. import javax.validation.Valid;
  15. import java.util.Map;
  16. /**
  17. * 机构入驻表(预加入)(TenantPreJoin)表控制层
  18. *
  19. * @author hgw
  20. * @since 2022-02-09 14:38:08
  21. */
  22. @Api(tags = "机构入驻")
  23. @RestController
  24. @RequestMapping("${app-config.url.web:}/tenantPreJoin")
  25. public class TenantPreJoinController extends BaseController {
  26. /**
  27. * 服务对象
  28. */
  29. @Resource
  30. private TenantPreJoinService tenantPreJoinService;
  31. // @Resource
  32. // private SysUserFeignService sysUserFeignService;
  33. @ApiOperation("分页查询")
  34. @PostMapping("/queryPage")
  35. @PreAuthorize("@pcs.hasPermissions('tenantPreJoin/queryPage')")
  36. public HttpResponseResult<PageInfo<TenantPreJoinVo>> queryPage(@RequestBody Map<String, Object> param) {
  37. //如果不是超管,那么只能看到推荐人自己的机构
  38. //2022年4月26日 需求要求变更为平台账号就看所有数据
  39. // SysUser sysUser = sysUserFeignService.queryUserInfo();
  40. // if(!sysUser.getIsSuperAdmin()){
  41. // param.put("recommender",sysUser.getId());
  42. // }
  43. return succeed(tenantPreJoinService.queryPage(param));
  44. }
  45. @ApiOperation("添加")
  46. @PostMapping("/add")
  47. public HttpResponseResult add(@Valid @RequestBody TenantPreJoinDto dto) {
  48. tenantPreJoinService.insert(dto);
  49. return succeed();
  50. }
  51. @ApiOperation("删除")
  52. @GetMapping("/delete/{id}")
  53. public HttpResponseResult delete(@PathVariable("id") Integer id) {
  54. TenantPreJoin byId = tenantPreJoinService.getById(id);
  55. if (byId == null) {
  56. return failed("数据不存在");
  57. }
  58. byId.setDelFlag(true);
  59. tenantPreJoinService.updateById(byId);
  60. return succeed();
  61. }
  62. }