|
@@ -3,8 +3,11 @@ package com.onemap.apply.controller.supervise;
|
|
|
import java.util.List;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.onemap.apply.domain.supervise.TSuperviseYwlxDo;
|
|
|
import com.onemap.apply.domain.supervise.TSuperviseYwlxFieldDo;
|
|
|
import com.onemap.apply.service.supervise.ITSuperviseYwlxFieldService;
|
|
|
+import com.onemap.apply.service.supervise.ITSuperviseYwlxService;
|
|
|
+import com.onemap.common.core.utils.StringUtils;
|
|
|
import com.onemap.common.core.utils.poi.ExcelUtil;
|
|
|
import com.onemap.common.core.web.controller.BaseController;
|
|
|
import com.onemap.common.core.web.domain.AjaxResult;
|
|
@@ -31,6 +34,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
public class TSuperviseYwlxFieldController extends BaseController {
|
|
|
@Autowired
|
|
|
private ITSuperviseYwlxFieldService tSuperviseYwlxFieldService;
|
|
|
+ @Autowired
|
|
|
+ private ITSuperviseYwlxService tSuperviseYwlxService;
|
|
|
|
|
|
/**
|
|
|
* 查询模板字段列表
|
|
@@ -67,6 +72,17 @@ public class TSuperviseYwlxFieldController extends BaseController {
|
|
|
@Log(title = "模板字段", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody TSuperviseYwlxFieldDo tSuperviseYwlxField) {
|
|
|
+ if (tSuperviseYwlxField == null) {
|
|
|
+ return AjaxResult.error("参数缺失");
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(tSuperviseYwlxField.getYwlx())) {
|
|
|
+ return AjaxResult.error("参数缺失");
|
|
|
+ }
|
|
|
+ TSuperviseYwlxDo bean = tSuperviseYwlxService.selectTSuperviseYwlxMapperByYwlx(tSuperviseYwlxField.getYwlx());
|
|
|
+ if (bean == null) {
|
|
|
+ return AjaxResult.error("业务类型参数缺失");
|
|
|
+ }
|
|
|
+ tSuperviseYwlxService.addOnemapTableColumn(bean.getSjy(), tSuperviseYwlxField.getFieldname());
|
|
|
return toAjax(tSuperviseYwlxFieldService.insertTSuperviseYwlxField(tSuperviseYwlxField));
|
|
|
}
|
|
|
|
|
@@ -85,6 +101,15 @@ public class TSuperviseYwlxFieldController extends BaseController {
|
|
|
@Log(title = "模板字段", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
public AjaxResult remove(@PathVariable String[] ids) {
|
|
|
+ for (String id : ids) {
|
|
|
+ TSuperviseYwlxFieldDo bean = tSuperviseYwlxFieldService.selectTSuperviseYwlxFieldById(id);
|
|
|
+ if (bean != null) {
|
|
|
+ TSuperviseYwlxDo bean1 = tSuperviseYwlxService.selectTSuperviseYwlxMapperByYwlx(bean.getYwlx());
|
|
|
+ if (bean1 != null) {
|
|
|
+ tSuperviseYwlxService.dropOnemapTableColumn(bean1.getSjy(), bean.getFieldname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return toAjax(tSuperviseYwlxFieldService.deleteTSuperviseYwlxFieldByIds(ids));
|
|
|
}
|
|
|
}
|