New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.enterprise.AddEnterpriseDTO; |
| | | import com.panzhihua.common.model.dtos.community.enterprise.EditEnterpriseDTO; |
| | | import com.panzhihua.common.model.dtos.community.enterprise.PageEnterpriseDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActEnterpriseVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @title: ComActEnterpriseApi |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 社区企业管理 |
| | | * @author: hans |
| | | * @date: 2022/05/31 10:22 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = {"社区企业管理"}) |
| | | @RestController |
| | | @RequestMapping("/enterprise") |
| | | public class ComActEnterpriseApi extends BaseController { |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation("获取社区企业详情") |
| | | @ApiImplicitParam(name = "id", value = "社区企业id", required = true) |
| | | @GetMapping("/detail") |
| | | public R detailEnterprise(@RequestParam("id") Long id) { |
| | | return communityService.detailEnterprise(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询社区企业", response = ComActEnterpriseVO.class) |
| | | @PostMapping("/page") |
| | | public R pageEnterprise(@RequestBody @Valid PageEnterpriseDTO pageEnterpriseDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (nonNull(loginUserInfo)) { |
| | | pageEnterpriseDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | } else if (isNull(pageEnterpriseDTO.getCommunityId())) { |
| | | return R.fail("未指定社区"); |
| | | } |
| | | return communityService.pageEnterprise(pageEnterpriseDTO); |
| | | } |
| | | } |