隐患排查添加导入

pull/4/head
zhangyanli 2024-02-04 17:04:34 +08:00
parent 741d2f1077
commit 4f9ca7c9c9
16 changed files with 1444 additions and 451 deletions

View File

@ -0,0 +1,34 @@
package com.zcloud.controller.hiddenDangerCheckStandard;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.PageData;
import com.zcloud.service.hiddenDangerCheckStandard.CustomTermLibraryService;
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.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/customLabelFactory")
public class CustomTermLibraryController extends BaseController {
@Autowired
private CustomTermLibraryService customTermLibraryService;
@RequestMapping(value = "/termList")
@ResponseBody
public Object list() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = customTermLibraryService.listAll(pd); //列出LabelFacory列表
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
}

View File

@ -0,0 +1,64 @@
package com.zcloud.mapper.datasource.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2022-12-27
* www.zcloudchina.com
*/
public interface CustomLabelFactoryMapper {
/**
* @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 ArrayDATA_IDS
* @throws Exception
*/
void deleteAll(String[] ArrayDATA_IDS);
List<PageData> findByAncestors(PageData condition);
void deleteByAncestors(PageData leafInfo);
List<PageData> findAllAncestors(PageData condition);
}

View File

@ -0,0 +1,59 @@
package com.zcloud.mapper.datasource.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2023-10-13
* www.zcloudchina.com
*/
public interface CustomTermLibraryMapper {
/**
* @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 ArrayDATA_IDS
* @throws Exception
*/
void deleteAll(String[] ArrayDATA_IDS);
}

View File

@ -0,0 +1,64 @@
package com.zcloud.service.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2022-12-27
* www.zcloudchina.com
*/
public interface CustomLabelFactoryService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
List<PageData> getTree(PageData condition) throws Exception;
List<PageData> saveTree(PageData pd) throws Exception;
List<PageData> findAllAncestors(PageData condition) throws Exception;
}

View File

@ -106,7 +106,7 @@ public interface CustomService {
*/
List<PageData> getListByCorplistPage(Page page)throws Exception;
void saveBaoBaoType(PageData pd) throws Exception;
}

View File

@ -0,0 +1,59 @@
package com.zcloud.service.hiddenDangerCheckStandard;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2023-10-13
* www.zcloudchina.com
*/
public interface CustomTermLibraryService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
}

View File

@ -0,0 +1,249 @@
package com.zcloud.service.hiddenDangerCheckStandard.impl;
import com.alibaba.fastjson.JSONArray;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomLabelFactoryMapper;
import com.zcloud.service.hiddenDangerCheckStandard.CustomLabelFactoryService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Warden;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
*
* luoxiaobao
* 2022-12-27
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class CustomLabelFacoryServiceImpl implements CustomLabelFactoryService {
@Resource
private CustomLabelFactoryMapper customLabelFactoryMapper;
/**
*
*
* @param pd
* @throws Exception
*/
public void save(PageData pd) throws Exception {
customLabelFactoryMapper.save(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void delete(PageData pd) throws Exception {
customLabelFactoryMapper.delete(pd);
}
/**
*
*
* @param pd
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
customLabelFactoryMapper.edit(pd);
}
/**
*
*
* @param page
* @throws Exception
*/
public List<PageData> list(Page page) throws Exception {
return customLabelFactoryMapper.datalistPage(page);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd) throws Exception {
return customLabelFactoryMapper.listAll(pd);
}
/**
* id
*
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd) throws Exception {
return customLabelFactoryMapper.findById(pd);
}
/**
*
*
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS) throws Exception {
customLabelFactoryMapper.deleteAll(ArrayDATA_IDS);
}
@Override
public List<PageData> getTree(PageData request) throws Exception {
List<PageData> result = new ArrayList<>();
PageData condition = new PageData();
List<PageData> labels = customLabelFactoryMapper.findByAncestors(condition);
for (PageData label : labels) {
if ("1".equals(label.getString("IS_ANCESTORS_FLAG"))){
condition.clear();
condition.put("BUS_LABEL_FACTORY_ID",label.getString("BUS_LABEL_FACTORY_ID"));
PageData ancestors = customLabelFactoryMapper.findById(condition);
analysis(labels, ancestors);
if (ancestors != null) {
result.add(ancestors);
}
}
}
result = result.stream().sorted(Comparator.comparing(o -> new BigDecimal(String.valueOf(o.get("SORT").toString())))).collect(Collectors.toList());
return result;
}
@Override
@Transactional
public List<PageData> saveTree(PageData pd) throws Exception {
// 组织
List<PageData> _tree = Warden.getList(pd.getString("tree"));
PageData condition = new PageData();
// 删除所有标签
condition.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID());
condition.put("TYPE",pd.getString("TYPE"));
customLabelFactoryMapper.deleteByAncestors(condition);
List<PageData> result = new ArrayList<>();
for (PageData leaf : _tree) {
Warden.initDate(leaf);
leaf.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
if (leaf.get("BUS_LABEL_FACTORY_ID").toString().length() > 30) {
if ("1".equals(leaf.getString("IS_ANCESTORS_FLAG"))) {
leaf.put("NAME", leaf.getString("NAME"));
customLabelFactoryMapper.save(leaf);
} else {
leaf.put("ANCESTORS_ID", leaf.getString("BUS_LABEL_FACTORY_ID"));
leaf.put("NAME", leaf.getString("NAME"));
leaf.put("PARENT_ID", "0");
leaf.put("IS_ANCESTORS_FLAG", "1");
leaf.put("TYPE", pd.getString("TYPE"));
customLabelFactoryMapper.save(leaf);
}
} else {
leaf.put("BUS_LABEL_FACTORY_ID", Warden.get32UUID());
leaf.put("ANCESTORS_ID", leaf.getString("BUS_LABEL_FACTORY_ID"));
leaf.put("NAME", leaf.getString("NAME"));
leaf.put("PARENT_ID", "0");
leaf.put("IS_ANCESTORS_FLAG", "1");
leaf.put("TYPE", pd.getString("TYPE"));
customLabelFactoryMapper.save(leaf);
}
analysis(leaf, result, 1);
}
return result;
}
@Override
public List<PageData> findAllAncestors(PageData condition) throws Exception {
return customLabelFactoryMapper.findAllAncestors(condition);
}
private void analysis(PageData pd, List<PageData> result, Integer level) {
JSONArray children = (JSONArray) pd.get("children");
if (children == null || children.size() <= 0) {
return;
}
List<PageData> tree = Warden.getList(children);
result.addAll(tree);
for (PageData leaf : tree) {
leaf.put("BUS_LABEL_FACTORY_ID", leaf.get("BUS_LABEL_FACTORY_ID").toString().length() > 30 ? leaf.getString("BUS_LABEL_FACTORY_ID") : Warden.get32UUID());
leaf.put("ANCESTORS_ID", pd.getString("ANCESTORS_ID"));
leaf.put("PARENT_ID", pd.getString("BUS_LABEL_FACTORY_ID"));
leaf.put("IS_ANCESTORS_FLAG", "0");
leaf.put("LEVEL", level);
leaf.put("CREATOR_ID", Jurisdiction.getUSER_ID());
leaf.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
leaf.put("CREATED_TIME", DateUtil.date2Str(new Date()));
leaf.put("ISDELETE", "0");
leaf.put("TYPE", pd.getString("TYPE"));
customLabelFactoryMapper.save(leaf);
analysis(leaf, result, ++level);
}
}
private void analysis(List<PageData> labels, PageData parent) {
List<PageData> sons = labels.stream()
.filter(n -> n.getString("PARENT_ID").equals(parent.getString("BUS_LABEL_FACTORY_ID")))
.sorted(Comparator.comparing(o -> new BigDecimal(String.valueOf(o.get("SORT").toString()))))
.collect(Collectors.toList());
if (parent == null) {
return;
}
parent.put("children", sons);
if (sons.size() > 0) {
for (PageData son : sons) {
analysis(labels, son);
}
}
}
private PageData findParentNode(List<PageData> tree, PageData branch) throws Exception {
for (PageData root : tree) {
List<PageData> branches = (List<PageData>) root.get("children");
if (branches.size() <= 0) {
continue;
}
for (PageData _branch : branches) {
if (branch.getString("BUS_LABEL_FACTORY_ID").equals(_branch.getString("BUS_LABEL_FACTORY_ID"))) {
return root;
}
}
PageData parentNode = findParentNode(branches, branch);
if (parentNode != null && parentNode.size() > 0) {
return parentNode;
}
}
return null;
}
private void initNode(PageData info, PageData gene) {
info.put("BUS_LABEL_FACTORY_ID", info.get("BUS_LABEL_FACTORY_ID").toString().length() > 30 ? info.getString("BUS_LABEL_FACTORY_ID") : Warden.get32UUID());
info.put("PARENT_ID", gene.getString("BUS_LABEL_FACTORY_ID"));
info.put("ANCESTORS_ID", gene.getString("ANCESTORS_ID"));
info.put("IS_ANCESTORS_FLAG", "0");
info.put("LEVEL", Integer.parseInt(gene.get("LEVEL").toString()) + 1);
info.put("CREATOR_ID", Jurisdiction.getUSER_ID());
info.put("CREATED_TIME", DateUtil.date2Str(new Date()));
info.put("ISDELETE", "0");
info.put("TYPE", gene.getString("TYPE"));
JSONArray _children = (JSONArray) info.get("children");
if (_children == null || _children.size() <= 0) {
return;
}
List<PageData> children = Warden.getList(_children);
for (PageData child : children) {
initNode(child, info);
}
}
}

View File

@ -2,8 +2,11 @@ package com.zcloud.service.hiddenDangerCheckStandard.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.check.ListCheckItemMapper;
import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomMapper;
import com.zcloud.service.hiddenDangerCheckStandard.CustomItemService;
import com.zcloud.service.hiddenDangerCheckStandard.CustomService;
import com.zcloud.util.Warden;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -22,6 +25,8 @@ public class CustomServiceImpl implements CustomService {
@Autowired
private CustomMapper customMapper;
@Autowired
private CustomItemService customItemService;
/**
@ -147,6 +152,19 @@ public class CustomServiceImpl implements CustomService {
public void edit(PageData pd)throws Exception{
customMapper.edit(pd);
}
@Override
@Transactional
public void saveBaoBaoType(PageData pd) throws Exception {
List<PageData> itemList = Warden.getList(pd.getString("list"));
for (PageData dto : itemList) {
PageData condition = new PageData();
condition.put("CUSTOM_ITEM_ID",dto.get("CUSTOM_ITEM_ID"));
PageData entity = customItemService.findById(condition);
entity.put("BAO_BAO_NUM",dto.get("BAO_BAO_NUM"));
customItemService.edit(entity);
}
}
}

View File

@ -0,0 +1,83 @@
package com.zcloud.service.hiddenDangerCheckStandard.impl;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomTermLibraryMapper;
import com.zcloud.service.hiddenDangerCheckStandard.CustomTermLibraryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
*
* luoxiaobao
* 2023-10-13
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class CustomTermLibraryServiceImpl implements CustomTermLibraryService {
@Resource
private CustomTermLibraryMapper customTermLibraryMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
customTermLibraryMapper.save(pd);
}
/**
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
customTermLibraryMapper.delete(pd);
}
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
customTermLibraryMapper.edit(pd);
}
/**
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception{
return customTermLibraryMapper.datalistPage(page);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return customTermLibraryMapper.listAll(pd);
}
/**id
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return customTermLibraryMapper.findById(pd);
}
/**
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
customTermLibraryMapper.deleteAll(ArrayDATA_IDS);
}
}

View File

@ -98,10 +98,10 @@
and f.COMMON_STATUS = 1
and bhci.COMMON_ITEM_STATUS = 1
<!-- and f.INDUSTRY_TYPE_NAMES = #{pd.CORP_TYPE_NAME} -->
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
<if test="pd.OTHERKEYWORDS != null and pd.OTHERKEYWORDS != ''"><!-- 关键词检索 -->
and
(
bhci.CHECK_CONTENT LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
bhci.CHECK_CONTENT LIKE CONCAT(CONCAT('%', #{pd.OTHERKEYWORDS}),'%')
)
</if>
<if test="pd.CHECK_CATEGORY != null and pd.CHECK_CATEGORY != ''"><!-- 检查类别 -->

View File

@ -131,7 +131,7 @@
CHECK_UNQUALIFIED = #{CHECK_UNQUALIFIED},
OPERATION_TYPE = #{OPERATION_TYPE},
BAO_BAO_NUM = #{BAO_BAO_NUM},
LISTCHECKITEM_ID = LISTCHECKITEM_ID
CUSTOM_ITEM_ID = CUSTOM_ITEM_ID
where
CUSTOM_ITEM_ID = #{CUSTOM_ITEM_ID}
</update>
@ -189,7 +189,8 @@
blsd.NAME as TASK_TYPE_NAME,
blsd.BZ as TASK_TYPE_NUM,
bhd1.DICTIONARY_NAME as CHECK_CATEGORY_NAME,
bhd2.DICTIONARY_NAME as CHECK_ITEM_NAME
bhd2.DICTIONARY_NAME as CHECK_ITEM_NAME,
btl.DESCRIBE as BAO_BAO_NUM_NAME
from
<include refid="tableName"></include> f
left join bus_hiddendangercheckstandard_custom bl on bl.CUSTOM_ID = f.CUSTOM_ID
@ -198,6 +199,7 @@
left join sys_user u on u.USER_ID = bl.USER_ID
left join bus_hiddendangercheckstandard_dictionary bhd1 on bhd1.DICTIONARY_ID = f.CHECK_CATEGORY and bhd1.ISDELETE = 0
left join bus_hiddendangercheckstandard_dictionary bhd2 on bhd2.DICTIONARY_ID = f.CHECK_ITEM and bhd2.ISDELETE = 0
left join bus_hiddendangercheckstandard_term_library btl on btl.TASK_NUM = f.BAO_BAO_NUM and btl.WORK_TYPE = blsd.BZ
where f.ISDELETE = '0'
<if test="CUSTOM_ID != null and CUSTOM_ID != ''"><!-- 检查表id -->
and f.CUSTOM_ID = #{CUSTOM_ID}

View File

@ -0,0 +1,197 @@
<?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.datasource.hiddenDangerCheckStandard.CustomLabelFactoryMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_TERM_LIBRARY
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.PARENT_ID,
f.ANCESTORS_ID,
f.IS_ANCESTORS_FLAG,
f.LEVEL,
f.NAME,
f.CREATOR_ID,
f.CREATED_TIME,
f.ISDELETE,
f.SORT,
f.TYPE,
f.BUS_LABEL_FACTORY_ID,
f.CORPINFO_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
PARENT_ID,
ANCESTORS_ID,
IS_ANCESTORS_FLAG,
LEVEL,
NAME,
CREATOR_ID,
CREATED_TIME,
ISDELETE,
SORT,
TYPE,
BUS_LABEL_FACTORY_ID,
CORPINFO_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{PARENT_ID},
#{ANCESTORS_ID},
#{IS_ANCESTORS_FLAG},
#{LEVEL},
#{NAME},
#{CREATOR_ID},
#{CREATED_TIME},
#{ISDELETE},
#{SORT},
#{TYPE},
#{BUS_LABEL_FACTORY_ID},
#{CORPINFO_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'
where
BUS_LABEL_FACTORY_ID = #{BUS_LABEL_FACTORY_ID}
</delete>
<delete id="deleteByAncestors" parameterType="pd">
delete from
<include refid="tableName"></include>
where TYPE = #{TYPE}
<if test="CORPINFO_ID != '' and CORPINFO_ID != null">
and CORPINFO_ID = #{CORPINFO_ID}
</if>
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
PARENT_ID = #{PARENT_ID},
ANCESTORS_ID = #{ANCESTORS_ID},
IS_ANCESTORS_FLAG = #{IS_ANCESTORS_FLAG},
LEVEL = #{LEVEL},
NAME = #{NAME},
CREATOR_ID = #{CREATOR_ID},
CREATED_TIME = #{CREATED_TIME},
SORT = #{SORT},
TYPE = #{TYPE},
CORPINFO_ID = #{CORPINFO_ID},
BUS_LABEL_FACTORY_ID = BUS_LABEL_FACTORY_ID
where
BUS_LABEL_FACTORY_ID = #{BUS_LABEL_FACTORY_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.BUS_LABEL_FACTORY_ID = #{BUS_LABEL_FACTORY_ID}
</select>
<select id="findByAncestors" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
f
where f.ISDELETE = '0'
<if test="ANCESTORS_ID != null and ANCESTORS_ID != ''">
and f.ANCESTORS_ID = #{ANCESTORS_ID}
</if>
<if test="TYPE != null and TYPE != ''">
and f.TYPE = #{TYPE}
</if>
<if test="CORPINFO_ID != '' and CORPINFO_ID != null">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="IS_ANCESTORS_FLAG != null and IS_ANCESTORS_FLAG != ''">
and f.IS_ANCESTORS_FLAG = #{IS_ANCESTORS_FLAG}
</if>
</select>
<select id="findAllAncestors" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.IS_ANCESTORS_FLAG = '1' and f.ISDELETE = '0' and TYPE = #{TYPE}
<if test="NAME != null and NAME != ''">
and f.NAME LIKE CONCAT(CONCAT('%', #{NAME}),'%')
</if>
</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.NAME != null and pd.NAME != ''"><!-- 关键词检索 -->
and f.NAME LIKE CONCAT(CONCAT('%', #{pd.NAME}),'%')
</if>
<if test="pd.IS_ANCESTORS_FLAG != null and pd.IS_ANCESTORS_FLAG != ''"><!-- 关键词检索 -->
and f.IS_ANCESTORS_FLAG = #{pd.IS_ANCESTORS_FLAG}
</if>
<if test="pd.TYPE != null and pd.TYPE != ''">
and f.TYPE = #{pd.TYPE}
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f where f.ISDELETE = '0'
<if test="NAME != '' and NAME != null">
and f.NAME = #{NAME}
</if>
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
ISDELETE = '1'
where
BUS_LABEL_FACTORY_ID in
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>

View File

@ -343,6 +343,72 @@
<if test="pd.TYPE != null and pd.TYPE != ''"><!-- 关键词检索 -->
and f.TYPE = #{pd.TYPE}
</if>
<choose>
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
</when>
<otherwise>
<choose>
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
<choose>
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<otherwise>
and
(f.DEPARTMENT_ID in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
)or f.USER_ID = #{pd.USER_ID})
</otherwise>
</choose>
</when>
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
<choose>
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<otherwise>
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</otherwise>
</choose>
</when>
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
and f.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
</when>
<otherwise>
</otherwise>
</choose>
</otherwise>
</choose>
<if test="pd.LISTINGLEVEL != null and pd.LISTINGLEVEL != ''"><!-- 关键词检索 -->
<choose>
<when test='pd.LISTINGLEVEL == "1"'>
@ -353,8 +419,8 @@
</otherwise>
</choose>
</if>
<if test="pd.SCREENTYPE != null and pd.SCREENTYPE != ''"><!-- 关键词检索 -->
and f.SCREENTYPE = #{pd.SCREENTYPE}
<if test="pd.RISKCHECKLISTTYPE != null and pd.RISKCHECKLISTTYPE != ''"><!-- 关键词检索 -->
and f.SCREENTYPE = #{pd.RISKCHECKLISTTYPE}
</if>
order by f.ISDELETE,f.OPERATTIME desc
</select>

View File

@ -4,7 +4,7 @@
<!--表名 -->
<sql id="tableName">
bus_hiddendangercheckstandard_statistics
BUS_HIDDENDANGERCHECKSTANDARD_STATISTICS
</sql>
<!--数据字典表名 -->
@ -79,7 +79,7 @@
set
ISDELETE = '1'
where
LISTSTATISTICS_ID = #{LISTSTATISTICS_ID}
CUSTOMSTATISTICS_ID = #{CUSTOMSTATISTICS_ID}
</delete>
<!-- 物理删除-->

View File

@ -0,0 +1,140 @@
<?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.datasource.hiddenDangerCheckStandard.CustomTermLibraryMapper">
<!--表名 -->
<sql id="tableName">
BUS_HIDDENDANGERCHECKSTANDARD_TERM_LIBRARY
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.TASK_NUM,
f.DESCRIBE,
f.WORK_TYPE,
f.IS_DELETE,
f.CREATE_TIME,
f.TERM_LIBRARY_ID,
f.SORT
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
TASK_NUM,
DESCRIBE,
WORK_TYPE,
IS_DELETE,
CREATE_TIME,
TERM_LIBRARY_ID,
SORT
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{TASK_NUM},
#{DESCRIBE},
#{WORK_TYPE},
#{IS_DELETE},
#{CREATE_TIME},
#{TERM_LIBRARY_ID},
#{SORT}
</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
IS_DELETE = '1'
where
TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
TASK_NUM = #{TASK_NUM},
DESCRIBE = #{DESCRIBE},
WORK_TYPE = #{WORK_TYPE},
IS_DELETE = #{IS_DELETE},
CREATE_TIME = #{CREATE_TIME},
SORT = #{SORT},
TERM_LIBRARY_ID = TERM_LIBRARY_ID
where
TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.TERM_LIBRARY_ID = #{TERM_LIBRARY_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.IS_DELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
-->
)
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.IS_DELETE = '0'
<if test="WORK_TYPE != null and WORK_TYPE != null">
and f.WORK_TYPE = #{WORK_TYPE}
</if>
order by f.SORT asc
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">
update
<include refid="tableName"></include>
set
IS_DELETE = '1'
where
TERM_LIBRARY_ID in
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>