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