添加商户类型权限
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.gxwebsoft.common.core.web.*;
|
||||
import com.gxwebsoft.common.system.entity.Merchant;
|
||||
import com.gxwebsoft.common.system.entity.MerchantApply;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.MerchantApplyParam;
|
||||
import com.gxwebsoft.common.system.service.MerchantApplyService;
|
||||
import com.gxwebsoft.common.system.service.MerchantService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -24,9 +26,12 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/api/system/merchant-apply")
|
||||
public class MerchantApplyController extends BaseController {
|
||||
@Resource
|
||||
private MerchantService merchantService;
|
||||
@Resource
|
||||
private MerchantApplyService merchantApplyService;
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:list')")
|
||||
@ApiOperation("分页查询商户入驻申请")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<MerchantApply>> page(MerchantApplyParam param) {
|
||||
@@ -34,6 +39,7 @@ public class MerchantApplyController extends BaseController {
|
||||
return success(merchantApplyService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:list')")
|
||||
@ApiOperation("查询全部商户入驻申请")
|
||||
@GetMapping()
|
||||
public ApiResult<List<MerchantApply>> list(MerchantApplyParam param) {
|
||||
@@ -41,6 +47,7 @@ public class MerchantApplyController extends BaseController {
|
||||
return success(merchantApplyService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:list')")
|
||||
@ApiOperation("根据id查询商户入驻申请")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<MerchantApply> get(@PathVariable("id") Integer id) {
|
||||
@@ -51,12 +58,19 @@ public class MerchantApplyController extends BaseController {
|
||||
@ApiOperation("添加商户入驻申请")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MerchantApply merchantApply) {
|
||||
if (merchantService.count(new LambdaQueryWrapper<Merchant>().eq(Merchant::getMerchantName,merchantApply.getMerchantName())) > 0) {
|
||||
return fail("该租户名称已存在");
|
||||
}
|
||||
if (merchantService.count(new LambdaQueryWrapper<Merchant>().eq(Merchant::getPhone,merchantApply.getPhone())) > 0) {
|
||||
return fail("该手机号码已存在");
|
||||
}
|
||||
if (merchantApplyService.save(merchantApply)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:update')")
|
||||
@ApiOperation("修改商户入驻申请")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MerchantApply merchantApply) {
|
||||
@@ -66,6 +80,7 @@ public class MerchantApplyController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:remove')")
|
||||
@ApiOperation("删除商户入驻申请")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
@@ -75,6 +90,7 @@ public class MerchantApplyController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:save')")
|
||||
@ApiOperation("批量添加商户入驻申请")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<MerchantApply> list) {
|
||||
@@ -84,6 +100,7 @@ public class MerchantApplyController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:update')")
|
||||
@ApiOperation("批量修改商户入驻申请")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantApply> batchParam) {
|
||||
@@ -93,6 +110,7 @@ public class MerchantApplyController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantApply:remove')")
|
||||
@ApiOperation("批量删除商户入驻申请")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
@@ -101,5 +119,4 @@ public class MerchantApplyController extends BaseController {
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.gxwebsoft.common.system.param.MerchantTypeParam;
|
||||
import com.gxwebsoft.common.system.service.MerchantTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -28,6 +29,7 @@ public class MerchantTypeController extends BaseController {
|
||||
@Resource
|
||||
private MerchantTypeService merchantTypeService;
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:list')")
|
||||
@ApiOperation("分页查询商户类型")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<MerchantType>> page(MerchantTypeParam param) {
|
||||
@@ -35,6 +37,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return success(merchantTypeService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:list')")
|
||||
@ApiOperation("查询全部商户类型")
|
||||
@GetMapping()
|
||||
public ApiResult<List<MerchantType>> list(MerchantTypeParam param) {
|
||||
@@ -42,6 +45,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return success(merchantTypeService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:list')")
|
||||
@ApiOperation("根据id查询商户类型")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<MerchantType> get(@PathVariable("id") Integer id) {
|
||||
@@ -49,6 +53,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return success(merchantTypeService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:save')")
|
||||
@ApiOperation("添加商户类型")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MerchantType merchantType) {
|
||||
@@ -63,6 +68,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:update')")
|
||||
@ApiOperation("修改商户类型")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MerchantType merchantType) {
|
||||
@@ -72,6 +78,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:remove')")
|
||||
@ApiOperation("删除商户类型")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
@@ -81,6 +88,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:update')")
|
||||
@ApiOperation("批量添加商户类型")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<MerchantType> list) {
|
||||
@@ -90,6 +98,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:update')")
|
||||
@ApiOperation("批量修改商户类型")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MerchantType> batchParam) {
|
||||
@@ -99,6 +108,7 @@ public class MerchantTypeController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:merchantType:remove')")
|
||||
@ApiOperation("批量删除商户类型")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
|
||||
Reference in New Issue
Block a user