|
|
|
@ -1,48 +1,30 @@
|
|
|
|
|
package com.ruoyi.zongzhi.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
|
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.zongzhi.domain.TcTown;
|
|
|
|
|
import com.ruoyi.zongzhi.service.ITcTownService;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 区域Controller
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @author ruoyi
|
|
|
|
|
* @date 2023-08-10
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/zongzhi/town")
|
|
|
|
|
@Api(tags = "区域")
|
|
|
|
|
public class TcTownController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
public class TcTownController extends BaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ITcTownService tcTownService;
|
|
|
|
|
|
|
|
|
@ -51,8 +33,7 @@ public class TcTownController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public TableDataInfo list(TcTown tcTown)
|
|
|
|
|
{
|
|
|
|
|
public TableDataInfo list(TcTown tcTown) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<TcTown> list = tcTownService.selectTcTownList(tcTown);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
@ -64,8 +45,7 @@ public class TcTownController extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(HttpServletResponse response, TcTown tcTown)
|
|
|
|
|
{
|
|
|
|
|
public void export(HttpServletResponse response, TcTown tcTown) {
|
|
|
|
|
List<TcTown> list = tcTownService.selectTcTownList(tcTown);
|
|
|
|
|
ExcelUtil<TcTown> util = new ExcelUtil<TcTown>(TcTown.class);
|
|
|
|
|
util.exportExcel(response, list, "区域数据");
|
|
|
|
@ -77,8 +57,7 @@ public class TcTownController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/{id}")
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
|
|
return success(tcTownService.selectTcTownById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -87,8 +66,7 @@ public class TcTownController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
|
public AjaxResult add(@RequestBody TcTown tcTown)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult add(@RequestBody TcTown tcTown) {
|
|
|
|
|
return toAjax(tcTownService.insertTcTown(tcTown));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -97,8 +75,7 @@ public class TcTownController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@PutMapping
|
|
|
|
|
public AjaxResult edit(@RequestBody TcTown tcTown)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult edit(@RequestBody TcTown tcTown) {
|
|
|
|
|
return toAjax(tcTownService.updateTcTown(tcTown));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -106,22 +83,21 @@ public class TcTownController extends BaseController
|
|
|
|
|
* 删除区域
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
|
{
|
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
|
|
return toAjax(tcTownService.deleteTcTownByIds(ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导入excel
|
|
|
|
|
* 导入excel
|
|
|
|
|
*
|
|
|
|
|
* @param file
|
|
|
|
|
* @return
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/importData")
|
|
|
|
|
public AjaxResult importData(MultipartFile file) throws Exception
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult importData(MultipartFile file) throws Exception {
|
|
|
|
|
ExcelUtil<TcTown> util = new ExcelUtil<TcTown>(TcTown.class);
|
|
|
|
|
List<TcTown> tcTownList = util.importExcel(file.getInputStream());
|
|
|
|
|
String message = tcTownService.importUser(tcTownList);
|
|
|
|
@ -130,12 +106,12 @@ public class TcTownController extends BaseController
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 树形结构列表
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/new/tree")
|
|
|
|
|
@ApiOperation(value = "树形结构列表")
|
|
|
|
|
public AjaxResult treeselect(TcTown tcTown)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult treeselect(TcTown tcTown) {
|
|
|
|
|
List<TcTown> tcTowns = tcTownService.selectTcTownList(tcTown);
|
|
|
|
|
return AjaxResult.success(tcTownService.buildDeptTreeSelect(tcTowns));
|
|
|
|
|
}
|
|
|
|
|