package com.doumee.api.business;
|
|
import com.doumee.api.BaseController;
|
import com.doumee.core.annotation.excel.ExcelExporter;
|
import com.doumee.core.annotation.pr.PreventRepeat;
|
import com.doumee.core.model.ApiResponse;
|
import com.doumee.core.model.PageWrap;
|
import com.doumee.core.model.PageData;
|
import com.doumee.dao.business.model.ShopApply;
|
import com.doumee.dao.web.dto.ShopApplyDTO;
|
import com.doumee.service.business.ShopApplyService;
|
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.servlet.http.HttpServletResponse;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* @author 江蹄蹄
|
* @date 2023/03/21 15:48
|
*/
|
@Api(tags = "店铺申请信息表")
|
@RestController
|
@RequestMapping("/business/shopApply")
|
public class ShopApplyController extends BaseController {
|
|
@Autowired
|
private ShopApplyService shopApplyService;
|
|
@PreventRepeat
|
@ApiOperation("新建")
|
@PostMapping("/create")
|
@RequiresPermissions("business:shopapply:create")
|
public ApiResponse create(@RequestBody ShopApplyDTO shopApply) {
|
return ApiResponse.success(shopApplyService.create(shopApply));
|
}
|
|
@ApiOperation("根据ID删除")
|
@GetMapping("/delete/{id}")
|
@RequiresPermissions("business:shopapply:delete")
|
public ApiResponse deleteById(@PathVariable Integer id) {
|
shopApplyService.deleteById(id);
|
return ApiResponse.success(null);
|
}
|
|
@ApiOperation("批量删除")
|
@GetMapping("/delete/batch")
|
@RequiresPermissions("business:shopapply:delete")
|
public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
|
String [] idArray = ids.split(",");
|
List<Integer> idList = new ArrayList<>();
|
for (String id : idArray) {
|
idList.add(Integer.valueOf(id));
|
}
|
shopApplyService.deleteByIdInBatch(idList);
|
return ApiResponse.success(null);
|
}
|
|
@ApiOperation("通过/驳回")
|
@PostMapping("/updateById")
|
@RequiresPermissions("business:shopapply:update")
|
public ApiResponse updateById(@RequestBody ShopApply shopApply) {
|
shopApplyService.updateById(shopApply);
|
return ApiResponse.success(null);
|
}
|
|
@ApiOperation("分页查询")
|
@PostMapping("/page")
|
@RequiresPermissions("business:shopapply:query")
|
public ApiResponse<PageData<ShopApply>> findPage (@RequestBody PageWrap<ShopApply> pageWrap) {
|
return ApiResponse.success(shopApplyService.findPage(pageWrap));
|
}
|
|
@ApiOperation("导出Excel")
|
@PostMapping("/exportExcel")
|
@RequiresPermissions("business:shopapply:exportExcel")
|
public void exportExcel (@RequestBody PageWrap<ShopApply> pageWrap, HttpServletResponse response) {
|
ExcelExporter.build(ShopApply.class).export(shopApplyService.findPage(pageWrap).getRecords(), "店铺申请信息表", response);
|
}
|
|
@ApiOperation("根据ID查询")
|
@GetMapping("/{id}")
|
@RequiresPermissions("business:shopapply:query")
|
public ApiResponse findById(@PathVariable Integer id) {
|
return ApiResponse.success(shopApplyService.findById(id));
|
}
|
}
|