隐患排查标准库

pull/1/head
wangpeng 2024-01-26 08:33:24 +08:00
parent 8756c26b98
commit 75933a92d8
17 changed files with 1771 additions and 0 deletions

View File

@ -0,0 +1,197 @@
package com.zcloud.controller.hiddenDangerCheckStandardLibrary;
import com.alibaba.fastjson.JSONArray;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.bus.HiddenCheckService;
import com.zcloud.service.bus.HiddenSchemeService;
import com.zcloud.service.bus.HiddenService;
import com.zcloud.service.bus.ImgFilesService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonService;
import com.zcloud.util.*;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/hiddenDangerCheckStandardCommon")
public class CommonController extends BaseController {
@Autowired
private CommonService commonService;
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/add")
@RequiresPermissions("hiddenDangerCheckStandardCommon:add")
@ResponseBody
public Object add() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("COMMON_ID", this.get32UUID());
commonService.save(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param out
* @throws Exception
*/
@RequestMapping(value = "/delete")
@RequiresPermissions("hiddenDangerCheckStandardCommon:del")
@ResponseBody
public Object delete() throws Exception {
Map<String, String> map = new HashMap<String, String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("DELETEOR_ID", Jurisdiction.getUSER_ID());
pd.put("DELETEOR_NAME", Jurisdiction.getName());
pd.put("DELETE_TIME", DateUtil.getTime());
commonService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/edit")
@RequiresPermissions("hiddenDangerCheckStandardCommon:edit")
@ResponseBody
public Object edit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
commonService.edit(pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param page
* @throws Exception
*/
@RequestMapping(value = "/list")
@RequiresPermissions("hiddenDangerCheckStandardCommon:list")
@ResponseBody
public Object list(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
page.setPd(pd);
List<PageData> varList = commonService.list(page); //列出Common列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/goEdit")
@RequiresPermissions("hiddenDangerCheckStandardCommon:edit")
@ResponseBody
public Object goEdit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = commonService.findById(pd); //根据ID读取
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
*
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/deleteAll")
@RequiresPermissions("hiddenDangerCheckStandardCommon:del")
@ResponseBody
public Object deleteAll() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String DATA_IDS = pd.getString("DATA_IDS");
if (Tools.notEmpty(DATA_IDS)) {
String ArrayDATA_IDS[] = DATA_IDS.split(",");
PageData del = new PageData();
del.put("ArrayDATA_IDS", ArrayDATA_IDS);
commonService.deleteAll(del);
errInfo = "success";
} else {
errInfo = "error";
}
map.put("result", errInfo); //返回结果
return map;
}
/**excel
* @param
* @throws Exception
*/
@RequestMapping(value="/excelModel")
public void exportExcelModel(HttpServletResponse response) throws Exception{
FileDownload.fileDownload(response, PathUtil.getProjectpath() + Const.FILEPATHFILE + "hiddenDangerCheckStandardTemplate.xls", "隐患排查标准模板.xls");
}
@RequestMapping("importExcel")
@ResponseBody
public Object importExcel(@RequestParam(value = "FILE") MultipartFile[] excel) throws Exception{
Map<String, String> map = new HashMap<String, String>();
PageData pd = new PageData();
pd = this.getPageData();
try {
map = commonService.importExcel(pd,excel);
return map;
} catch (Exception e) {
map.put("result", "fail"); // 返回结果
map.put("resultStr", "");
return map;
}
}
}

View File

@ -592,4 +592,22 @@ public class DictionariesController extends BaseController {
map.put("result", errInfo); //返回结果
return map;
}
/**
* @return
* @throws Exception
*/
@RequestMapping(value="/getDictTreeMoreLevel")
@ResponseBody
public Object getDictTreeMoreLevel() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String DICTIONARIES_ID = pd.getString("DICTIONARIES_ID");
List<PageData> varList = dictionariesService.getDictTreeMoreLevel(DICTIONARIES_ID); //用传过来的ID获取此ID下的子列表数据
map.put("list", varList);
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -0,0 +1,58 @@
package com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
public interface CommonItemMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**
* @param page
* @throws Exception
*/
List<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd);
}

View File

@ -0,0 +1,58 @@
package com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
public interface CommonMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**
* @param page
* @throws Exception
*/
List<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd);
}

View File

@ -0,0 +1,60 @@
package com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
public interface DictionaryMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**
* @param page
* @throws Exception
*/
List<PageData> datalistPage(Page page);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd);
Integer getCount(PageData pd);
}

View File

@ -0,0 +1,58 @@
package com.zcloud.service.hiddenDangerCheckStandardLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
public interface CommonItemService {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd)throws Exception;
}

View File

@ -0,0 +1,62 @@
package com.zcloud.service.hiddenDangerCheckStandardLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
public interface CommonService {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd)throws Exception;
Map<String, String> importExcel(PageData pd, MultipartFile[] excel) throws Exception;
}

View File

@ -0,0 +1,64 @@
package com.zcloud.service.hiddenDangerCheckStandardLibrary;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
public interface DictionaryService {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
void deleteAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
Integer getCount(PageData pd)throws Exception;
}

View File

@ -0,0 +1,104 @@
package com.zcloud.service.hiddenDangerCheckStandardLibrary.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.CommonItemMapper;
import com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.CommonMapper;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonItemService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonService;
import com.zcloud.util.Warden;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class CommonItemServiceImpl implements CommonItemService {
@Resource
private CommonService commonService;
@Resource
private CommonItemMapper commonItemMapper;
/**
*
*
* @param pd
* @throws Exception
*/
public void save(PageData pd) throws Exception {
Warden.initDate(pd);
commonItemMapper.save(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void delete(PageData pd) throws Exception {
commonItemMapper.delete(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
Warden.updateDate(pd);
commonItemMapper.edit(pd);
}
/**
*
*
* @param page
* @throws Exception
*/
public List<PageData> list(Page page) throws Exception {
return commonItemMapper.datalistPage(page);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd) throws Exception {
return commonItemMapper.listAll(pd);
}
/**
* id
*
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd) throws Exception {
return commonItemMapper.findById(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void deleteAll(PageData pd) throws Exception {
commonItemMapper.deleteAll(pd);
}
}

View File

@ -0,0 +1,265 @@
package com.zcloud.service.hiddenDangerCheckStandardLibrary.impl;
import com.alibaba.excel.EasyExcel;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.CommonMapper;
import com.zcloud.service.depository.impl.HiddenLibraryWarden;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonItemService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.CommonService;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.DictionaryService;
import com.zcloud.service.system.DictionariesService;
import com.zcloud.util.ObjectExcelRead;
import com.zcloud.util.Tools;
import com.zcloud.util.UuidUtil;
import com.zcloud.util.Warden;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class CommonServiceImpl implements CommonService {
@Resource
private CommonMapper commonMapper;
@Autowired
private CommonItemService commonItemService;
@Autowired
private DictionaryService dictionaryService;
/**
*
*
* @param pd
* @throws Exception
*/
public void save(PageData pd) throws Exception {
Warden.initDate(pd);
commonMapper.save(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void delete(PageData pd) throws Exception {
commonMapper.delete(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
Warden.updateDate(pd);
commonMapper.edit(pd);
}
/**
*
*
* @param page
* @throws Exception
*/
public List<PageData> list(Page page) throws Exception {
return commonMapper.datalistPage(page);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd) throws Exception {
return commonMapper.listAll(pd);
}
/**
* id
*
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd) throws Exception {
return commonMapper.findById(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void deleteAll(PageData pd) throws Exception {
commonMapper.deleteAll(pd);
}
@Override
public Map<String, String> importExcel(PageData pd, MultipartFile[] excel) throws Exception {
Map<String, String> result = new HashMap<String, String>();
String errInfo = "success";
List<Map<Integer, String>> excelInfo = EasyExcel.read(excel[0].getInputStream()).sheet().doReadSync();
System.out.println(excelInfo);
Map<String, PageData> dictAll = new HashMap<>();
List<PageData> dictList = dictionaryService.listAll(new PageData());
dictList.forEach(dict -> {
dictAll.put(dict.getString("DICTIONARY_NAME")+"_"+dict.getString("DICTIONARY_LEVEL"), dict);
});
List<String> header = new ArrayList<>();
header.add("检查类别"); //0
header.add("检查项目"); //1
header.add("检查内容"); //2
header.add("检查标准"); //3
header.add("参考依据"); //4
header.add("检查合格项"); //5
header.add("检查不合格项"); //6
header.add("操作类型"); //7
List<PageData> dictSaveList = new ArrayList<>();
List<PageData> dataList = new ArrayList<>();
int succeeNum = 1;
StringBuffer errorStr = new StringBuffer();
for (int i = 0; i < excelInfo.size(); i++) {
succeeNum++;
PageData data = new PageData();
data.put("COMMON_ITEM_ID",UuidUtil.get32UUID());
data.put("COMMON_ITEM_SORT",(i+1));
Map<Integer, String> mapExcel = excelInfo.get(i);
PageData dict1 = new PageData();
PageData dict2 = new PageData();
PageData dict3 = new PageData();
for (int j = 0; j < header.size(); j++) {
if (Tools.isEmpty(mapExcel.get(j)) && j < 7) {
errorStr.append("<p>第" + succeeNum + "行的\"" + header.get(j) + "\"无数据</p>");
continue;
}
if (j == 7) {
if (Tools.isEmpty(mapExcel.get(j))) {
errorStr.append("<p>第" + succeeNum + "行的\"" + header.get(j) + "\"无数据</p>");
continue;
} else if (!"选择".equals(mapExcel.get(j).trim()) && !"填写".equals(mapExcel.get(j).trim())) {
errorStr.append("<p>第" + succeeNum + "行的\"" + header.get(j) + "\"数据内容不正确,请选择正确选项</p>");
continue;
}
}
if (j<3) {
setItemDict(dictAll, mapExcel, j, data, dictSaveList, dict1, dict2, dict3);
} else {
switch (j) {
case 3:
data.put("CHECK_STANDARD", mapExcel.get(j).trim());
break;
case 4:
data.put("REFERENCE_BASIS", mapExcel.get(j).trim());
break;
case 5:
data.put("CHECK_QUALIFIED", mapExcel.get(j).trim());
break;
case 6:
data.put("CHECK_UNQUALIFIED", mapExcel.get(j).trim());
break;
case 7:
data.put("OPERATION_TYPE", "填写".equals(mapExcel.get(j).trim()) ? 2 : 1);
break;
}
}
}
dataList.add(data);
}
if (Tools.isEmpty(errorStr.toString())) {
pd.put("COMMON_ID",UuidUtil.get32UUID());
this.save(pd);
for (PageData dict : dictSaveList) {
dictionaryService.save(dict);
}
for (PageData entity : dataList) {
entity.put("COMMON_ID",pd.getString("COMMON_ID"));
commonItemService.save(entity);
}
errorStr.append("成功导入" + dataList.size() + "条数据!");
} else {
errInfo = "error";
}
result.put("result", "success"); //返回结果
result.put("resultType", errInfo); //返回message类型
result.put("isExcel","1"); //返回类型
result.put("resultStr", errorStr.toString());
return result;
}
private void setItemDict(Map<String, PageData> dictAll, Map<Integer, String> map, int j, PageData data, List<PageData> dictSaveList,
PageData dict1, PageData dict2, PageData dict3) {
if (dictAll.containsKey(map.get(j).trim()+"_"+(j+1))) {
switch(j) {
case 0:
dict1 = dictAll.get(map.get(j).trim()+"_"+(j+1));
data.put("CHECK_CATEGORY",dict1.getString("DICTIONARY_ID"));
break;
case 1:
dict2 = dictAll.get(map.get(j).trim()+"_"+(j+1));
data.put("CHECK_ITEM",dict2.getString("DICTIONARY_ID"));
break;
case 2:
dict3 = dictAll.get(map.get(j).trim()+"_"+(j+1));
data.put("CHECK_CONTENT",dict3.getString("DICTIONARY_ID"));
break;
}
} else {
if (j == 0) {
dict1.put("DICTIONARY_ID", UuidUtil.get32UUID());
dict1.put("DICTIONARY_NAME", map.get(j));
dict1.put("PARENT_ID", "0");
dict1.put("PARENT_IDS", dict1.getString("DICTIONARY_ID"));
dict1.put("DICTIONARY_NAMES", dict1.getString("DICTIONARY_NAME"));
dict1.put("DICTIONARY_LEVEL", 1);
dictSaveList.add(dict1);
dictAll.put(dict1.getString("DICTIONARY_NAME")+"_"+dict1.getString("DICTIONARY_LEVEL"), dict1);
data.put("CHECK_CATEGORY",dictAll.get(map.get(j)+"_"+(j+1)).getString("DICTIONARY_ID"));
} else if (j == 1) {
dict2.put("DICTIONARY_ID", UuidUtil.get32UUID());
dict2.put("DICTIONARY_NAME", map.get(j));
dict2.put("PARENT_ID", dict1.getString("DICTIONARY_ID"));
dict2.put("PARENT_IDS", dict1.getString("DICTIONARY_ID")+","+dict2.getString("DICTIONARY_ID"));
dict2.put("DICTIONARY_NAMES", dict1.getString("DICTIONARY_NAME")+","+dict2.getString("DICTIONARY_NAME"));
dict2.put("DICTIONARY_LEVEL", 2);
dictSaveList.add(dict2);
dictAll.put(dict2.getString("DICTIONARY_NAME")+"_"+dict2.getString("DICTIONARY_LEVEL"), dict2);
data.put("CHECK_ITEM",dictAll.get(map.get(j)+"_"+(j+1)).getString("DICTIONARY_ID"));
} else if (j == 2) {
dict3.put("DICTIONARY_ID", UuidUtil.get32UUID());
dict3.put("DICTIONARY_NAME", map.get(j));
dict3.put("PARENT_ID", dict1.getString("DICTIONARY_ID"));
dict3.put("PARENT_IDS", dict1.getString("DICTIONARY_ID")+","+dict2.getString("DICTIONARY_ID")+","+dict3.getString("DICTIONARY_ID"));
dict3.put("DICTIONARY_NAMES", dict1.getString("DICTIONARY_NAME")+","+dict2.getString("DICTIONARY_NAME")+","+dict3.getString("DICTIONARY_NAME"));
dict3.put("DICTIONARY_LEVEL", 3);
dictSaveList.add(dict3);
dictAll.put(dict3.getString("DICTIONARY_NAME")+"_"+dict3.getString("DICTIONARY_LEVEL"), dict3);
data.put("CHECK_CONTENT",dictAll.get(map.get(j)+"_"+(j+1)).getString("DICTIONARY_ID"));
}
}
}
}

View File

@ -0,0 +1,109 @@
package com.zcloud.service.hiddenDangerCheckStandardLibrary.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.DictionaryMapper;
import com.zcloud.service.hiddenDangerCheckStandardLibrary.DictionaryService;
import com.zcloud.util.Tools;
import com.zcloud.util.Warden;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
*
* wangpeng
* 2024-01-25
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class DictionaryServiceImpl implements DictionaryService {
@Resource
private DictionaryMapper dictionaryMapper;
/**
*
*
* @param pd
* @throws Exception
*/
public void save(PageData pd) throws Exception {
Warden.initDate(pd);
if (Tools.isEmpty(pd.getString("DICTIONARY_SORT"))) {
Integer count = this.getCount(pd);
pd.put("DICTIONARY_SORT", count+1);
}
dictionaryMapper.save(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void delete(PageData pd) throws Exception {
dictionaryMapper.delete(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
Warden.updateDate(pd);
dictionaryMapper.edit(pd);
}
/**
*
*
* @param page
* @throws Exception
*/
public List<PageData> list(Page page) throws Exception {
return dictionaryMapper.datalistPage(page);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd) throws Exception {
return dictionaryMapper.listAll(pd);
}
/**
* id
*
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd) throws Exception {
return dictionaryMapper.findById(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void deleteAll(PageData pd) throws Exception {
dictionaryMapper.deleteAll(pd);
}
@Override
public Integer getCount(PageData pd) throws Exception {
return dictionaryMapper.getCount(pd);
}
}

View File

@ -115,4 +115,12 @@ public interface DictionariesService {
public List<PageData> getTreeFromBelow(List<PageData> nextList,PageData pd,int level, PageData agent,int num)throws Exception;
List<PageData> findByCondition(PageData condition);
/**
* id
* @param parentId
* @return
* @throws Exception
*/
public List<PageData> getDictTreeMoreLevel(String parentId) throws Exception;
}

View File

@ -307,4 +307,34 @@ public class DictionariesServiceImpl implements DictionariesService {
// }
return null;
}
@Override
public List<PageData> getDictTreeMoreLevel(String parentId) throws Exception {
List<PageData> varList = dictionariesMapper.listSubDictByParentIdAndSunCount(parentId);
List<PageData> pdList = new ArrayList<PageData>();
for(PageData d :varList){
PageData pdf = new PageData();
pdf.put("value", d.getString("DICTIONARIES_ID"));
pdf.put("label", d.getString("NAME"));
if (Integer.parseInt(d.getString("zcount")) > 0) {
setDictTreeMoreLevelChild(pdf, d);
}
pdList.add(pdf);
}
return pdList;
}
private void setDictTreeMoreLevelChild(PageData parent, PageData dict) {
List<PageData> varList = dictionariesMapper.listSubDictByParentIdAndSunCount(dict.getString("DICTIONARIES_ID"));
List<PageData> childList = new ArrayList<PageData>();
for(PageData d :varList){
PageData pdf = new PageData();
pdf.put("value", d.getString("DICTIONARIES_ID"));
pdf.put("label", d.getString("NAME"));
if (Integer.parseInt(d.getString("zcount")) > 0) {
setDictTreeMoreLevelChild(pdf, d);
}
childList.add(pdf);
}
parent.put("children", childList);
}
}

View File

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.CommonItemMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_COMMON_ITEM
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.COMMON_ID,
f.CHECK_CATEGORY,
f.CHECK_ITEM,
f.CHECK_CONTENT,
f.CHECK_STANDARD,
f.REFERENCE_BASIS,
f.CHECK_QUALIFIED,
f.CHECK_UNQUALIFIED,
f.OPERATION_TYPE,
f.COMMON_ITEM_SORT,
f.ISDELETE,
f.CREATOR_ID,
f.CREATOR_NAME,
f.CREATED_TIME,
f.OPERATOR_ID,
f.OPERATOR_NAME,
f.OPERATE_TIME,
f.DELETEOR_ID,
f.DELETEOR_NAME,
f.DELETE_TIME,
f.COMMON_ITEM_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
COMMON_ID,
CHECK_CATEGORY,
CHECK_ITEM,
CHECK_CONTENT,
CHECK_STANDARD,
REFERENCE_BASIS,
CHECK_QUALIFIED,
CHECK_UNQUALIFIED,
OPERATION_TYPE,
COMMON_ITEM_SORT,
ISDELETE,
CREATOR_ID,
CREATOR_NAME,
CREATED_TIME,
OPERATOR_ID,
OPERATOR_NAME,
OPERATE_TIME,
DELETEOR_ID,
DELETEOR_NAME,
DELETE_TIME,
COMMON_ITEM_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{COMMON_ID},
#{CHECK_CATEGORY},
#{CHECK_ITEM},
#{CHECK_CONTENT},
#{CHECK_STANDARD},
#{REFERENCE_BASIS},
#{CHECK_QUALIFIED},
#{CHECK_UNQUALIFIED},
#{OPERATION_TYPE},
#{COMMON_ITEM_SORT},
#{ISDELETE},
#{CREATOR_ID},
#{CREATOR_NAME},
#{CREATED_TIME},
#{OPERATOR_ID},
#{OPERATOR_NAME},
#{OPERATE_TIME},
#{DELETEOR_ID},
#{DELETEOR_NAME},
#{DELETE_TIME},
#{COMMON_ITEM_ID}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETEOR_ID = #{DELETEOR_ID},
DELETEOR_NAME = #{DELETEOR_NAME},
DELETE_TIME = #{DELETE_TIME}
where
COMMON_ITEM_ID = #{COMMON_ITEM_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="COMMON_ID != null and COMMON_ID != ''">
COMMON_ID = #{COMMON_ID},
</if>
<if test="CHECK_CATEGORY != null and CHECK_CATEGORY != ''">
CHECK_CATEGORY = #{CHECK_CATEGORY},
</if>
<if test="CHECK_ITEM != null and CHECK_ITEM != ''">
CHECK_ITEM = #{CHECK_ITEM},
</if>
<if test="CHECK_CONTENT != null and CHECK_CONTENT != ''">
CHECK_CONTENT = #{CHECK_CONTENT},
</if>
<if test="CHECK_STANDARD != null and CHECK_STANDARD != ''">
CHECK_STANDARD = #{CHECK_STANDARD},
</if>
<if test="REFERENCE_BASIS != null and REFERENCE_BASIS != ''">
REFERENCE_BASIS = #{REFERENCE_BASIS},
</if>
<if test="CHECK_QUALIFIED != null and CHECK_QUALIFIED != ''">
CHECK_QUALIFIED = #{CHECK_QUALIFIED},
</if>
<if test="CHECK_UNQUALIFIED != null and CHECK_UNQUALIFIED != ''">
CHECK_UNQUALIFIED = #{CHECK_UNQUALIFIED},
</if>
<if test="OPERATION_TYPE != null and OPERATION_TYPE != ''">
OPERATION_TYPE = #{OPERATION_TYPE},
</if>
<if test="COMMON_ITEM_SORT != null">
COMMON_ITEM_SORT = #{COMMON_ITEM_SORT},
</if>
<if test="ISDELETE != null and ISDELETE != ''">
ISDELETE = #{ISDELETE},
</if>
<if test="CREATOR_ID != null and CREATOR_ID != ''">
CREATOR_ID = #{CREATOR_ID},
</if>
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
CREATOR_NAME = #{CREATOR_NAME},
</if>
<if test="CREATED_TIME != null and CREATED_TIME != ''">
CREATED_TIME = #{CREATED_TIME},
</if>
<if test="OPERATOR_ID != null and OPERATOR_ID != ''">
OPERATOR_ID = #{OPERATOR_ID},
</if>
<if test="OPERATOR_NAME != null and OPERATOR_NAME != ''">
OPERATOR_NAME = #{OPERATOR_NAME},
</if>
<if test="OPERATE_TIME != null and OPERATE_TIME != ''">
OPERATE_TIME = #{OPERATE_TIME},
</if>
<if test="DELETEOR_ID != null and DELETEOR_ID != ''">
DELETEOR_ID = #{DELETEOR_ID},
</if>
<if test="DELETEOR_NAME != null and DELETEOR_NAME != ''">
DELETEOR_NAME = #{DELETEOR_NAME},
</if>
<if test="DELETE_TIME != null and DELETE_TIME != ''">
DELETE_TIME = #{DELETE_TIME},
</if>
COMMON_ITEM_ID = COMMON_ITEM_ID
where
COMMON_ITEM_ID = #{COMMON_ITEM_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.COMMON_ITEM_ID = #{COMMON_ITEM_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
dca.DICTIONARY_NAME CHECK_CATEGORY_NAME,
di.DICTIONARY_NAME CHECK_ITEM_NAME,
dco.DICTIONARY_NAME CHECK_CONTENT_NAME,
<include refid="Field"></include>
from
<include refid="tableName"></include> f
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dca on dca.DICTIONARY_ID = f.CHECK_CATEGORY and dca.DICTIONARY_LEVEL = 1
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY di on di.DICTIONARY_ID = f.CHECK_ITEM and di.DICTIONARY_LEVEL = 2
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dco on dco.DICTIONARY_ID = f.CHECK_CONTENT and dco.DICTIONARY_LEVEL = 3
where f.ISDELETE = '0'
<if test="pd.COMMON_ID != null and pd.COMMON_ID != ''">
and f.COMMON_ID = #{pd.COMMON_ID}
</if>
<if test="pd.CHECK_CATEGORY != null and pd.CHECK_CATEGORY != ''">
and f.CHECK_CATEGORY = #{pd.CHECK_CATEGORY}
</if>
<if test="pd.CHECK_CATEGORY != null and pd.CHECK_CATEGORY != ''">
and f.HIDDEN_DESCR like CONCAT(CONCAT('%', #{pd.HIDDEN_DESCR}),'%')
</if>
<if test="pd.HIDDEN_DESCR != null and pd.HIDDEN_DESCR != ''">
and f.HIDDEN_DESCR like CONCAT(CONCAT('%', #{pd.HIDDEN_DESCR}),'%')
</if>
order by dca.DICTIONARY_SORT asc, di.DICTIONARY_SORT asc, dco.DICTIONARY_SORT asc, f.ITEM_SORT asc
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
dca.DICTIONARY_NAME CHECK_CATEGORY_NAME,
di.DICTIONARY_NAME CHECK_ITEM_NAME,
dco.DICTIONARY_NAME CHECK_CONTENT_NAME,
<include refid="Field"></include>
from
<include refid="tableName"></include> f
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dca on dca.DICTIONARY_ID = f.CHECK_CATEGORY and dca.DICTIONARY_LEVEL = 1
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY di on di.DICTIONARY_ID = f.CHECK_ITEM and di.DICTIONARY_LEVEL = 2
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY dco on dco.DICTIONARY_ID = f.CHECK_CONTENT and dco.DICTIONARY_LEVEL = 3
where f.ISDELETE = '0'
<if test="pd.COMMON_ID != null and pd.COMMON_ID != ''">
and f.COMMON_ID = #{pd.COMMON_ID}
</if>
order by dca.DICTIONARY_SORT asc, di.DICTIONARY_SORT asc, dco.DICTIONARY_SORT asc, f.ITEM_SORT asc
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETEOR_ID = #{DELETEOR_ID},
DELETEOR_NAME = #{DELETEOR_NAME},
DELETE_TIME = #{DELETE_TIME}
where
COMMON_ITEM_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.CommonMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_COMMON
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.INDUSTRY_TYPE,
f.INDUSTRY_TYPE_TREE,
f.INDUSTRY_TYPE_NAMES,
f.CHECK_STANDARD_NAME,
f.ISDELETE,
f.CREATOR_ID,
f.CREATOR_NAME,
f.CREATED_TIME,
f.OPERATOR_ID,
f.OPERATOR_NAME,
f.OPERATE_TIME,
f.DELETEOR_ID,
f.DELETEOR_NAME,
f.DELETE_TIME,
f.COMMON_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
INDUSTRY_TYPE,
INDUSTRY_TYPE_TREE,
INDUSTRY_TYPE_NAMES,
CHECK_STANDARD_NAME,
ISDELETE,
CREATOR_ID,
CREATOR_NAME,
CREATED_TIME,
OPERATOR_ID,
OPERATOR_NAME,
OPERATE_TIME,
DELETEOR_ID,
DELETEOR_NAME,
DELETE_TIME,
COMMON_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{INDUSTRY_TYPE},
#{INDUSTRY_TYPE_TREE},
#{INDUSTRY_TYPE_NAMES},
#{CHECK_STANDARD_NAME},
#{ISDELETE},
#{CREATOR_ID},
#{CREATOR_NAME},
#{CREATED_TIME},
#{OPERATOR_ID},
#{OPERATOR_NAME},
#{OPERATE_TIME},
#{DELETEOR_ID},
#{DELETEOR_NAME},
#{DELETE_TIME},
#{COMMON_ID}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETEOR_ID = #{DELETEOR_ID},
DELETEOR_NAME = #{DELETEOR_NAME},
DELETE_TIME = #{DELETE_TIME}
where
COMMON_ID = #{COMMON_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="INDUSTRY_TYPE != null and INDUSTRY_TYPE != ''">
INDUSTRY_TYPE = #{INDUSTRY_TYPE},
</if>
<if test="INDUSTRY_TYPE_TREE != null and INDUSTRY_TYPE_TREE != ''">
INDUSTRY_TYPE_TREE = #{INDUSTRY_TYPE_TREE},
</if>
<if test="INDUSTRY_TYPE_NAMES != null and INDUSTRY_TYPE_NAMES != ''">
INDUSTRY_TYPE_NAMES = #{INDUSTRY_TYPE_NAMES},
</if>
<if test="CHECK_STANDARD_NAME != null and CHECK_STANDARD_NAME != ''">
CHECK_STANDARD_NAME = #{CHECK_STANDARD_NAME},
</if>
<if test="ISDELETE != null and ISDELETE != ''">
ISDELETE = #{ISDELETE},
</if>
<if test="CREATOR_ID != null and CREATOR_ID != ''">
CREATOR_ID = #{CREATOR_ID},
</if>
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
CREATOR_NAME = #{CREATOR_NAME},
</if>
<if test="CREATED_TIME != null and CREATED_TIME != ''">
CREATED_TIME = #{CREATED_TIME},
</if>
<if test="OPERATOR_ID != null and OPERATOR_ID != ''">
OPERATOR_ID = #{OPERATOR_ID},
</if>
<if test="OPERATOR_NAME != null and OPERATOR_NAME != ''">
OPERATOR_NAME = #{OPERATOR_NAME},
</if>
<if test="OPERATE_TIME != null and OPERATE_TIME != ''">
OPERATE_TIME = #{OPERATE_TIME},
</if>
<if test="DELETEOR_ID != null and DELETEOR_ID != ''">
DELETEOR_ID = #{DELETEOR_ID},
</if>
<if test="DELETEOR_NAME != null and DELETEOR_NAME != ''">
DELETEOR_NAME = #{DELETEOR_NAME},
</if>
<if test="DELETE_TIME != null and DELETE_TIME != ''">
DELETE_TIME = #{DELETE_TIME},
</if>
COMMON_ID = COMMON_ID
where
COMMON_ID = #{COMMON_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.COMMON_ID = #{COMMON_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.INDUSTRY_TYPE != null and pd.INDUSTRY_TYPE != ''">
and f.INDUSTRY_TYPE = #{pd.INDUSTRY_TYPE}
</if>
<if test="pd.INDUSTRY_TYPE_TREE != null and pd.INDUSTRY_TYPE_TREE != ''">
and f.INDUSTRY_TYPE_TREE like CONCAT(CONCAT('%', #{pd.INDUSTRY_TYPE_TREE}),'%')
</if>
<if test="pd.CHECK_STANDARD_NAME != null and pd.CHECK_STANDARD_NAME != ''">
and f.CHECK_STANDARD_NAME like CONCAT(CONCAT('%', #{pd.CHECK_STANDARD_NAME}),'%')
</if>
order by date(f.OPERATE_TIME) desc
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETEOR_ID = #{DELETEOR_ID},
DELETEOR_NAME = #{DELETEOR_NAME},
DELETE_TIME = #{DELETE_TIME}
where
COMMON_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.hiddenDangerCheckStandardLibrary.DictionaryMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_DICTIONARY
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.DICTIONARY_NAME,
f.PARENT_ID,
f.PARENT_IDS,
f.DICTIONARY_NAMES,
f.DICTIONARY_LEVEL,
f.DICTIONARY_SORT,
f.ISDELETE,
f.CREATOR_ID,
f.CREATOR_NAME,
f.CREATED_TIME,
f.OPERATOR_ID,
f.OPERATOR_NAME,
f.OPERATE_TIME,
f.DELETEOR_ID,
f.DELETEOR_NAME,
f.DELETE_TIME,
f.DICTIONARY_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
DICTIONARY_NAME,
PARENT_ID,
PARENT_IDS,
DICTIONARY_NAMES,
DICTIONARY_LEVEL,
DICTIONARY_SORT,
ISDELETE,
CREATOR_ID,
CREATOR_NAME,
CREATED_TIME,
OPERATOR_ID,
OPERATOR_NAME,
OPERATE_TIME,
DELETEOR_ID,
DELETEOR_NAME,
DELETE_TIME,
DICTIONARY_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{DICTIONARY_NAME},
#{PARENT_ID},
#{PARENT_IDS},
#{DICTIONARY_NAMES},
#{DICTIONARY_LEVEL},
#{DICTIONARY_SORT},
#{ISDELETE},
#{CREATOR_ID},
#{CREATOR_NAME},
#{CREATED_TIME},
#{OPERATOR_ID},
#{OPERATOR_NAME},
#{OPERATE_TIME},
#{DELETEOR_ID},
#{DELETEOR_NAME},
#{DELETE_TIME},
#{DICTIONARY_ID}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETEOR_ID = #{DELETEOR_ID},
DELETEOR_NAME = #{DELETEOR_NAME},
DELETE_TIME = #{DELETE_TIME}
where
DICTIONARY_ID = #{DICTIONARY_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="DICTIONARY_NAME != null and DICTIONARY_NAME != ''">
DICTIONARY_NAME = #{DICTIONARY_NAME},
</if>
<if test="PARENT_ID != null and PARENT_ID != ''">
PARENT_ID = #{PARENT_ID},
</if>
<if test="PARENT_IDS != null and PARENT_IDS != ''">
PARENT_IDS = #{PARENT_IDS},
</if>
<if test="DICTIONARY_NAMES != null and DICTIONARY_NAMES != ''">
DICTIONARY_NAMES = #{DICTIONARY_NAMES},
</if>
<if test="DICTIONARY_LEVEL != null">
DICTIONARY_LEVEL = #{DICTIONARY_LEVEL},
</if>
<if test="DICTIONARY_SORT != null">
DICTIONARY_SORT = #{DICTIONARY_SORT},
</if>
<if test="ISDELETE != null and ISDELETE != ''">
ISDELETE = #{ISDELETE},
</if>
<if test="CREATOR_ID != null and CREATOR_ID != ''">
CREATOR_ID = #{CREATOR_ID},
</if>
<if test="CREATOR_NAME != null and CREATOR_NAME != ''">
CREATOR_NAME = #{CREATOR_NAME},
</if>
<if test="CREATED_TIME != null and CREATED_TIME != ''">
CREATED_TIME = #{CREATED_TIME},
</if>
<if test="OPERATOR_ID != null and OPERATOR_ID != ''">
OPERATOR_ID = #{OPERATOR_ID},
</if>
<if test="OPERATOR_NAME != null and OPERATOR_NAME != ''">
OPERATOR_NAME = #{OPERATOR_NAME},
</if>
<if test="OPERATE_TIME != null and OPERATE_TIME != ''">
OPERATE_TIME = #{OPERATE_TIME},
</if>
<if test="DELETEOR_ID != null and DELETEOR_ID != ''">
DELETEOR_ID = #{DELETEOR_ID},
</if>
<if test="DELETEOR_NAME != null and DELETEOR_NAME != ''">
DELETEOR_NAME = #{DELETEOR_NAME},
</if>
<if test="DELETE_TIME != null and DELETE_TIME != ''">
DELETE_TIME = #{DELETE_TIME},
</if>
DICTIONARY_ID = DICTIONARY_ID
where
DICTIONARY_ID = #{DICTIONARY_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.DICTIONARY_ID = #{DICTIONARY_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
<if test="pd.DICTIONARY_NAME != null and pd.DICTIONARY_NAME != ''">
and f.DICTIONARY_NAME like CONCAT(CONCAT('%', #{pd.DICTIONARY_NAME}),'%')
</if>
order by f.DICTIONARY_SORT asc
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
order by f.DICTIONARY_SORT asc
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETEOR_ID = #{DELETEOR_ID},
DELETEOR_NAME = #{DELETEOR_NAME},
DELETE_TIME = #{DELETE_TIME}
where
DICTIONARY_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- * 获取最大题号,导入时候使用-->
<select id="getCount" parameterType="pd" resultType="Integer" >
SELECT
COUNT(*)
FROM
<include refid="tableName"></include> f
WHERE
<if test="DICTIONARY_LEVEL != null">
DICTIONARY_LEVEL = #{DICTIONARY_LEVEL}
</if>
</select>
</mapper>