|
@@ -0,0 +1,72 @@
|
|
1
|
+package com.yunzhi.marketing.controller;
|
|
2
|
+
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
4
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
5
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
6
|
+import com.yunzhi.marketing.base.BaseController;
|
|
7
|
+import com.yunzhi.marketing.base.ResponseBean;
|
|
8
|
+import com.yunzhi.marketing.common.StringUtils;
|
|
9
|
+import com.yunzhi.marketing.dto.TaOrgCityDTO;
|
|
10
|
+import com.yunzhi.marketing.entity.TaOrgCity;
|
|
11
|
+import com.yunzhi.marketing.entity.TaSalesBatch;
|
|
12
|
+import com.yunzhi.marketing.mapper.TaOrgCityMapper;
|
|
13
|
+import io.swagger.annotations.Api;
|
|
14
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
15
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
16
|
+import io.swagger.annotations.ApiOperation;
|
|
17
|
+import org.springframework.beans.BeanUtils;
|
|
18
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
19
|
+import org.springframework.web.bind.annotation.*;
|
|
20
|
+
|
|
21
|
+import javax.servlet.http.HttpServletRequest;
|
|
22
|
+
|
|
23
|
+@RestController
|
|
24
|
+@RequestMapping("/api")
|
|
25
|
+@Api(value = "立森-开城市接口全部用新的以前的不管他了", tags = "立森-开城市接口全部用新的以前的不管他了")
|
|
26
|
+public class TaOrgCityController extends BaseController {
|
|
27
|
+
|
|
28
|
+ @Autowired
|
|
29
|
+ private TaOrgCityMapper taOrgCityMapper;
|
|
30
|
+
|
|
31
|
+ @ApiOperation(value = "获取此项目的城市集合", notes = "获取此项目的城市集合")
|
|
32
|
+ @ApiImplicitParams({
|
|
33
|
+ @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "pageNum", value = "第几页"),
|
|
34
|
+ @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "pageSize", value = "一页多少行"),
|
|
35
|
+ @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "parentid", value = "父级id 不传查询所以 100000 查询的是省级机构"),
|
|
36
|
+ })
|
|
37
|
+ @GetMapping(value = "/admin/city/list")
|
|
38
|
+ public ResponseBean adminTdCityList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
39
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
|
40
|
+ @RequestParam(value = "parentid", required = false) String parentid,
|
|
41
|
+ HttpServletRequest request) {
|
|
42
|
+ ResponseBean responseBean = new ResponseBean<>();
|
|
43
|
+ IPage<TaOrgCity> pg = new Page<>(pageNum, pageSize);
|
|
44
|
+ Integer orgId = getOrgId(request);
|
|
45
|
+ LambdaQueryWrapper<TaOrgCity> queryWrapper = new LambdaQueryWrapper<>();
|
|
46
|
+ queryWrapper.eq(TaOrgCity::getOrgId,orgId);
|
|
47
|
+ queryWrapper.eq(TaOrgCity::getStatus,1);
|
|
48
|
+ queryWrapper.eq(!StringUtils.isEmpty(parentid),TaOrgCity::getParentid,parentid);
|
|
49
|
+ IPage<TaOrgCity> taOrgCityIPage = taOrgCityMapper.selectPage(pg, queryWrapper);
|
|
50
|
+ responseBean.addSuccess(taOrgCityIPage);
|
|
51
|
+ return responseBean;
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ @ApiOperation(value = "添加此项目的城市", notes = "添加此项目的城市")
|
|
55
|
+ @PostMapping(value = "/admin/city/add")
|
|
56
|
+ public ResponseBean addCity(@RequestBody TaOrgCityDTO taOrgCityDTO, HttpServletRequest request) {
|
|
57
|
+ ResponseBean responseBean = new ResponseBean<>();
|
|
58
|
+ TaOrgCity taOrgCity = new TaOrgCity();
|
|
59
|
+ BeanUtils.copyProperties(taOrgCityDTO,taOrgCity);
|
|
60
|
+ taOrgCity.setOrgId(getOrgId(request));
|
|
61
|
+ taOrgCity.setStatus(1);
|
|
62
|
+ taOrgCityMapper.insert(taOrgCity);
|
|
63
|
+ responseBean.addSuccess(taOrgCity);
|
|
64
|
+ return responseBean;
|
|
65
|
+ }
|
|
66
|
+
|
|
67
|
+ @ApiOperation(value = "删除此项目的城市", notes = "添加此项目的城市")
|
|
68
|
+ @DeleteMapping(value = "/admin/org/city/{id}")
|
|
69
|
+ public ResponseBean deleteCity(@PathVariable Integer id, HttpServletRequest request) {
|
|
70
|
+ return ResponseBean.success(taOrgCityMapper.deleteById(id));
|
|
71
|
+ }
|
|
72
|
+}
|