init
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
package com.ruoyi.xq.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.xq.domain.AreaCode;
|
||||
import com.ruoyi.xq.service.AreaCodeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 行政区划
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-03-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/xq/areaCode")
|
||||
public class AreaCodeController extends BaseController {
|
||||
|
||||
private final AreaCodeService areaCodeService;
|
||||
|
||||
/**
|
||||
* 查询行政区划列表
|
||||
*/
|
||||
@SaCheckPermission("xq:areaCode:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AreaCode> list(AreaCode bo, PageQuery pageQuery) {
|
||||
Page<AreaCode> page = areaCodeService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行政区划详细信息
|
||||
*
|
||||
* @param code 主键
|
||||
*/
|
||||
@SaCheckPermission("xq:areaCode:query")
|
||||
@GetMapping("/{code}")
|
||||
public R<AreaCode> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Integer code) {
|
||||
return R.ok(areaCodeService.getById(code));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行政区划
|
||||
*/
|
||||
@SaCheckPermission("xq:areaCode:add")
|
||||
@Log(title = "行政区划", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody AreaCode bo) {
|
||||
return toAjax(areaCodeService.save(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行政区划
|
||||
*/
|
||||
@SaCheckPermission("xq:areaCode:edit")
|
||||
@Log(title = "行政区划", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AreaCode bo) {
|
||||
return toAjax(areaCodeService.updateById(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除行政区划
|
||||
*
|
||||
* @param codes 主键串
|
||||
*/
|
||||
@SaCheckPermission("xq:areaCode:remove")
|
||||
@Log(title = "行政区划", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{codes}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Integer[] codes) {
|
||||
return toAjax(areaCodeService.removeBatchByIds(Arrays.asList(codes)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user