| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.business.model.dto.CompanyCreatOrUpdateRequest; |
| | | import com.doumee.service.business.CompanyService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * @author AA |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("新建") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("company:company:create") |
| | | public ApiResponse create(@RequestBody Company company) { |
| | | @RequiresPermissions("business:company:create") |
| | | public ApiResponse create(@RequestBody @Valid CompanyCreatOrUpdateRequest company) { |
| | | return ApiResponse.success(companyService.create(company)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID删除") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("company:company:delete") |
| | | @RequiresPermissions("business:company:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | companyService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | |
| | | |
| | | @ApiOperation("批量删除") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("company:company:delete") |
| | | @RequiresPermissions("business:company:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | companyService.deleteByIdInBatch(this.getIdList(ids)); |
| | | return ApiResponse.success(null); |
| | |
| | | |
| | | @ApiOperation("根据ID修改") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("company:company:update") |
| | | @RequiresPermissions("business:company:update") |
| | | public ApiResponse updateById(@RequestBody Company company) { |
| | | companyService.updateById(company); |
| | | return ApiResponse.success(null); |
| | |
| | | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("company:company:query") |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse<PageData<Company>> findPage (@RequestBody PageWrap<Company> pageWrap) { |
| | | return ApiResponse.success(companyService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("company:company:query") |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(companyService.findById(id)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param pageWrap 分页对象 |
| | | * @return PageData<Company> |
| | | */ |
| | | @ApiOperation("平台查询企业信息-分页查询") |
| | | @PostMapping("/findPlatformPage") |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse<PageData<Company>> findPlatformPage(@RequestBody PageWrap<Company> pageWrap){ |
| | | return ApiResponse.success(companyService.findPlatformPage(pageWrap)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 主键查询 |
| | | * |
| | | * @param companyId 主键 |
| | | * @return Company |
| | | */ |
| | | @ApiOperation("根据企业企业id 查询企业用户") |
| | | @PostMapping("/findPlatformById") |
| | | @RequiresPermissions("business:company:query") |
| | | public ApiResponse<Company> findPlatformById(@RequestParam Integer companyId){ |
| | | return ApiResponse.success(companyService.findPlatformById(companyId)); |
| | | } |
| | | |
| | | /** |
| | | * 主键更新 |
| | | * |
| | | * @param company 实体对象 |
| | | */ |
| | | @ApiOperation("根据ID修改-编辑") |
| | | @PostMapping("/update") |
| | | @RequiresPermissions("business:company:update") |
| | | public ApiResponse update(@RequestBody CompanyCreatOrUpdateRequest company){ |
| | | companyService.updateById(company); |
| | | return ApiResponse.success(null); |
| | | } |
| | | } |