123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773 |
- <?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.diagbot.mapper.KlRuleMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.KlRule">
- <id column="id" property="id"/>
- <result column="is_deleted" property="isDeleted"/>
- <result column="gmt_create" property="gmtCreate"/>
- <result column="gmt_modified" property="gmtModified"/>
- <result column="creator" property="creator"/>
- <result column="modifier" property="modifier"/>
- <result column="concept_id" property="conceptId"/>
- <result column="description" property="description"/>
- <result column="rule_type" property="ruleType"/>
- <result column="status" property="status"/>
- </resultMap>
- <resultMap id="SchemaResultMap" type="com.diagbot.dto.RuleDTO">
- <result column="libName" property="libName"/>
- <result column="libType" property="libType"/>
- <result column="ruleType" property="ruleType"/>
- <collection property="ruleConditionDTOList" ofType="com.diagbot.dto.RuleConditionDTO">
- <result column="hasSubCond" property="hasSubCond"/>
- <result column="ruleGroup" property="ruleGroup"/>
- <result column="msg" property="msg"/>
- <collection property="ruleBaseDTOList" ofType="com.diagbot.dto.RuleBaseDTO">
- <result column="baseLibName" property="baseLibName"/>
- <result column="baseLibType" property="baseLibType"/>
- <result column="baseType" property="baseType"/>
- <result column="baseMinOperator" property="baseMinOperator"/>
- <result column="baseMinValue" property="baseMinValue"/>
- <result column="baseMinUnit" property="baseMinUnit"/>
- <result column="baseMaxOperator" property="baseMaxOperator"/>
- <result column="baseMaxValue" property="baseMaxValue"/>
- <result column="baseMaxUnit" property="baseMaxUnit"/>
- <result column="baseEqOperator" property="baseEqOperator"/>
- <result column="baseEqValue" property="baseEqValue"/>
- <result column="baseEqUnit" property="baseEqUnit"/>
- </collection>
- </collection>
- </resultMap>
- <select id="getAllRule" resultMap="SchemaResultMap">
- SELECT
- t10.*
- FROM
- (
- SELECT
- t4.lib_name AS libName,
- t4.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.msg AS msg,
- t1.has_sub_cond AS hasSubCond,
- CONCAT_WS("-", t1.id, 1) AS ruleGroup,
- "" AS baseLibName,
- 0 AS baseLibType,
- 0 AS baseType,
- "" AS baseMinOperator,
- "" AS baseMinValue,
- "" AS baseMinUnit,
- "" AS baseMaxOperator,
- "" AS baseMaxValue,
- "" AS baseMaxUnit,
- "" AS baseEqOperator,
- "" AS baseEqValue,
- "" AS baseEqUnit
- FROM
- kl_rule t1,
- kl_concept t4
- WHERE
- t1.is_deleted = "N"
- AND t4.is_deleted = "N"
- AND t1.concept_id = t4.id
- AND t1. STATUS = 1
- AND t4. STATUS = 1
- AND t1.has_sub_cond = 0
- UNION ALL
- SELECT
- t4.lib_name AS libName,
- t4.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.msg AS msg,
- t1.has_sub_cond AS hasSubCond,
- CONCAT_WS("-", t1.id, t2.group_type) AS ruleGroup,
- t5.lib_name AS baseLibName,
- t5.lib_type AS baseLibType,
- t3.type AS baseType,
- t3.min_operator AS baseMinOperator,
- t3.min_value AS baseMinValue,
- t3.min_unit AS baseMinUnit,
- t3.max_operator AS baseMaxOperator,
- t3.max_value AS baseMaxValue,
- t3.max_unit AS baseMaxUnit,
- t3.eq_operator AS baseEqOperator,
- t3.eq_value AS baseEqValue,
- t3.eq_unit AS baseEqUnit
- FROM
- kl_rule t1,
- kl_rule_condition t2,
- kl_rule_base t3,
- kl_concept t4,
- kl_concept t5
- WHERE
- t1.is_deleted = "N"
- AND t2.is_deleted = "N"
- AND t3.is_deleted = "N"
- AND t4.is_deleted = "N"
- AND t5.is_deleted = "N"
- AND t1. STATUS = 1
- AND t3. STATUS = 1
- AND t4. STATUS = 1
- AND t5. STATUS = 1
- AND t1.id = t2.rule_id
- AND t2.rule_base_id = t3.id
- AND t1.concept_id = t4.id
- AND t3.concept_id = t5.id
- AND t1.has_sub_cond = 1
- ) t10
- ORDER BY
- t10.libType,
- t10.libName,
- t10.ruleType,
- t10.ruleGroup
- </select>
- <select id="getKlRuleInfoPage" resultType="com.diagbot.dto.KlRuleInfoDTO">
- SELECT
- ru.id as parId,
- ru.description as parDescription,
- ru.rule_type as parRuleType,
- ru.concept_id as parConceptId,
- co.lib_name as parConceptName,
- le.name as parLibTypeName,
- ru.has_sub_cond as parHasSub,
- ru.msg as parMsg,
- ru.status as parStatus,
- ru.gmt_modified as gmtModified,
- ru.modifier as modifier
- FROM
- kl_rule ru,
- kl_concept co,
- kl_lexicon le
- WHERE ru.is_deleted = 'N'
- AND co.is_deleted = 'N'
- AND le.is_deleted = 'N'
- AND ru.concept_id = co.`id`
- AND co.lib_type = le.`code`
- <if test="parDescription!=null and parDescription!=''">
- AND UPPER(ru.description) LIKE CONCAT('%', UPPER(trim(#{parDescription})), '%')
- </if>
- <if test="parRuleType !=null">
- AND ru.rule_type = #{parRuleType}
- </if>
- <if test="parConceptName!=null and parConceptName!=''">
- AND UPPER(co.lib_name) LIKE CONCAT('%', UPPER(trim(#{parConceptName})), '%')
- </if>
- <if test="parStatus!=null">
- AND ru.status = #{parStatus}
- </if>
- ORDER BY ru.status DESC ,ru.gmt_modified DESC,ru.id DESC
- </select>
- <select id="getByIdRuleInfo" resultType="com.diagbot.dto.KlRuleByIdDTO">
- SELECT
- par.*,
- CASE
- WHEN ISNULL(ruco.rule_id)
- THEN par.parId
- ELSE ruco.rule_id
- END AS ruleId,
- sub.*,
- ruco.msg AS subMsg,
- ruco.group_type AS groupType
- FROM
- (SELECT
- a.id AS parId,
- a.description AS parDescription,
- a.rule_type AS parRuleType,
- a.concept_id AS parconceptId,
- b.lib_name AS parlibName,
- a.has_sub_cond AS parHasSub,
- a.msg AS parMsg,
- a.status AS parStatus,
- c.name AS parLenName,
- c.code AS parLenCode
- FROM
- kl_rule a,
- kl_concept b,
- kl_lexicon c
- WHERE a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND a.concept_id = b.id
- <if test="id != null">
- and a.id = #{id}
- </if>
- AND b.lib_type = c.code) par
- LEFT JOIN kl_rule_condition ruco
- ON par.parId = ruco.rule_id
- LEFT JOIN
- (SELECT
- c.id AS subId,
- c.description AS subDescription,
- c.concept_id AS subConceptId,
- d.lib_name AS subLibName,
- f.name AS subLenName,
- f.code AS subLenCode,
- c.type AS subType,
- c.min_operator AS subMinOperator,
- c.min_value AS subMinValue,
- c.min_unit AS subMinUnit,
- c.max_operator AS subMaxOperator,
- c.max_value AS subMaxValue,
- c.max_unit AS subMaxUnit,
- c.eq_operator AS subEqOperator,
- c.eq_value AS subEqValue,
- c.eq_unit AS subEqUnit
- FROM
- kl_rule_base c,
- kl_concept d,
- kl_lexicon f
- WHERE c.is_deleted = 'N'
- AND d.is_deleted = 'N'
- AND f.is_deleted = 'N'
- AND c.concept_id = d.id
- AND d.lib_type = f.code) sub
- ON sub.subId = ruco.rule_base_id
- </select>
- <select id="exportIndication" resultType="com.diagbot.dto.IndicationExportDTO">
- SELECT
- tt1.par_name,
- tt1.par_type,
- tt2.lib_name base_name,
- xx2.NAME base_type,
- CASE
- when tt1.type = '1' then '等于术语'
- when tt1.type = '2' then '比较'
- when tt1.type = '3' then '不等于术语'
- when tt1.type = '4' then '过敏'
- when tt1.type = '5' then '开单项互斥'
- when tt1.type = '6' then '正则'
- else '错误类型'
- end taboo_type,
- tt1.eq_value,
- tt1.min_value,
- tt1.min_operator,
- tt1.min_unit,
- tt1.max_value,
- tt1.max_operator,
- tt1.max_unit,
- tt1.description,
- tt1.msg,
- tt1.rule_id,
- tt1.cond_id
- FROM
- (
- SELECT
- c1.lib_name par_name,
- c1.id par_id,
- x1.`name` par_type,
- t1.id rule_id,
- t1.description,
- t1.rule_type,
- t1.has_sub_cond,
- t2.id cond_id,
- t2.msg,
- t3.type,
- t3.concept_id base_id,
- t3.eq_value,
- t3.min_value,
- t3.min_operator,
- t3.min_unit,
- t3.max_value,
- t3.max_operator,
- t3.max_unit
- FROM
- kl_concept c1,
- kl_lexicon x1,
- kl_rule t1,
- kl_rule_condition t2,
- kl_rule_base t3
- WHERE
- c1.is_deleted = 'N'
- AND t1.is_deleted = 'N'
- AND t2.is_deleted = 'N'
- AND t3.is_deleted = 'N'
- AND c1.`status` = 1
- AND t1.`status` = 1
- AND c1.id = t1.concept_id
- AND t1.id = t2.rule_id
- AND t2.rule_base_id = t3.id
- AND t1.rule_type = 1
- AND x1.`code` = c1.lib_type
- ) tt1
- LEFT JOIN kl_concept tt2 ON tt2.is_deleted = 'N'
- AND tt2.`status` = 1
- AND tt1.base_id = tt2.id
- LEFT JOIN kl_lexicon xx2 ON tt2.lib_type = xx2.CODE
- ORDER BY par_name, rule_id
- </select>
- <select id="exportOther" resultType="com.diagbot.dto.DefaultExportDTO">
- SELECT
- a.id rule_id,
- a.concept_id,
- f.lib_type,
- f.lib_name,
- g.name lib_type_cn,
- a.description rule_group,
- a.rule_type,
- a.has_sub_cond,
- b.group_type,
- b.msg,
- c.concept_id base_concept,
- d.lib_name baseName,
- d.lib_type baseType,
- e. NAME baseTypeCn,
- CASE
- WHEN c.type = '1' THEN
- '等于术语'
- WHEN c.type = '2' THEN
- '比较'
- WHEN c.type = '3' THEN
- '不等于术语'
- WHEN c.type = '4' THEN
- '过敏'
- WHEN c.type = '5' THEN
- '开单项互斥'
- WHEN c.type = '6' THEN
- '正则'
- ELSE
- '错误类型'
- END taboo_type,
- c.min_operator,
- c.min_value,
- c.max_operator,
- c.max_value,
- c.eq_value
- FROM
- kl_rule a,
- kl_rule_condition b,
- kl_rule_base c,
- kl_concept d,
- kl_lexicon e,
- kl_concept f,
- kl_lexicon g
- WHERE
- a.is_deleted = 'N'
- AND b.is_deleted = 'N'
- AND c.is_deleted = 'N'
- AND d.is_deleted = 'N'
- AND e.is_deleted = 'N'
- AND f.is_deleted = 'N'
- AND g.is_deleted = 'N'
- AND a.`status` = 1
- AND d.`status` = 1
- AND f.`status` = 1
- AND a.id = b.rule_id
- AND b.rule_base_id = c.id
- AND c.concept_id = d.id
- AND d.lib_type = e.`code`
- AND a.concept_id = f.id
- AND f.lib_type = g.`code`
- <if test="ruleType != null">
- AND a.rule_type = #{ruleType}
- </if>
- <if test="libTypeList != null and libTypeList.size() > 0">
- and f.lib_type in
- <foreach collection="libTypeList" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- ORDER BY
- a.gmt_modified DESC, b.id,c.id asc
- </select>
- <select id="getRuleInitDTO" resultType="com.diagbot.dto.RuleInitDTO">
- SELECT
- *
- FROM
- (
- SELECT
- t1.concept_id AS conceptId,
- CONCAT_WS(
- "_",
- t1.concept_id,
- t1.rule_type
- ) AS conceptGroup,
- t1.id AS ruleId,
- t4.lib_name AS libName,
- t4.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.has_sub_cond AS hasSubCond,
- t1.description AS description,
- t1.msg AS msg,
- t1.gmt_modified AS gmtModified
- FROM
- kl_rule t1,
- kl_concept t4
- WHERE
- t1.is_deleted = "N"
- AND t4.is_deleted = "N"
- AND t1.concept_id = t4.id
- AND t1. STATUS = 1
- AND t4. STATUS = 1
- AND t4.lib_type BETWEEN 100 AND 299
- UNION
- SELECT
- t11.id AS conceptId,
- CONCAT_WS("_", t11.id, t1.rule_type) AS conceptGroup,
- t1.id AS ruleId,
- t11.lib_name AS libName,
- t11.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.has_sub_cond AS hasSubCond,
- t1.description AS description,
- t1.msg AS msg,
- t1.gmt_modified AS gmtModified
- FROM
- kl_rule t1,
- kl_concept t4,
- kl_relation t10,
- kl_concept t11
- WHERE
- t1.is_deleted = "N"
- AND t4.is_deleted = "N"
- AND t1.concept_id = t4.id
- AND t1. STATUS = 1
- AND t4. STATUS = 1
- AND t4.lib_type BETWEEN 300 AND 399
- AND t10.start_id = t4.id
- AND t10.relation_id = 600
- AND t10.end_id = t11.id
- AND t11.lib_type BETWEEN 100 AND 299
- AND t10.is_deleted = "N"
- AND t11.is_deleted = "N"
- AND t10. STATUS = 1
- AND t11. STATUS = 1
- ) t12
- ORDER BY
- t12.conceptId,
- t12.ruleType,
- t12.hasSubCond,
- t12.gmtModified DESC,
- t12.ruleId DESC
- </select>
- <select id="getRuleConditionInitDTO" resultType="com.diagbot.dto.RuleConditionInitDTO">
- SELECT
- t2.rule_id AS ruleId,
- CONCAT_WS("-", t2.rule_id, t2.group_type) AS ruleGroup,
- t2.rule_base_id as ruleBaseId,
- t2.msg as msg
- FROM
- kl_rule_condition t2
- WHERE
- t2.is_deleted = "N"
- ORDER BY
- t2.id DESC
- </select>
- <select id="getRuleBaseInitDTO" resultType="com.diagbot.dto.RuleBaseInitDTO">
- SELECT
- t3.id as ruleBaseId,
- t5.lib_name AS baseLibName,
- t5.lib_type AS baseLibType,
- t3.type AS baseType,
- t3.min_operator AS baseMinOperator,
- t3.min_value AS baseMinValue,
- t3.min_unit AS baseMinUnit,
- t3.max_operator AS baseMaxOperator,
- t3.max_value AS baseMaxValue,
- t3.max_unit AS baseMaxUnit,
- t3.eq_operator AS baseEqOperator,
- t3.eq_value AS baseEqValue,
- t3.eq_unit AS baseEqUnit
- FROM
- kl_rule_base t3,
- kl_concept t5
- WHERE
- t3.is_deleted = "N"
- AND t5.is_deleted = "N"
- AND t3. STATUS = 1
- AND t5. STATUS = 1
- AND t3.concept_id = t5.id
- </select>
- <select id="getRuleInitDTONotHaveClass" resultType="com.diagbot.dto.RuleInitDTO">
- SELECT
- CONCAT_WS("_",t1.concept_id,t1.rule_type) AS conceptGroup,
- t1.id AS ruleId,
- t4.lib_name AS libName,
- t4.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.msg AS msg,
- t1.has_sub_cond AS hasSubCond
- FROM
- kl_rule t1,
- kl_concept t4
- WHERE
- t1.is_deleted = "N"
- AND t4.is_deleted = "N"
- AND t1.concept_id = t4.id
- AND t1. STATUS = 1
- AND t4. STATUS = 1
- AND t4.lib_type BETWEEN 100 AND 299
- </select>
- <select id="getRuleInitDTOHaveClass" resultType="com.diagbot.dto.RuleInitDTO">
- SELECT
- CONCAT_WS("_", t11.id, t1.rule_type) AS conceptGroup,
- t1.id AS ruleId,
- t11.lib_name AS libName,
- t11.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.msg AS msg,
- t1.has_sub_cond AS hasSubCond
- FROM
- kl_rule t1,
- kl_concept t4,
- kl_relation t10,
- kl_concept t11
- WHERE
- t1.is_deleted = "N"
- AND t4.is_deleted = "N"
- AND t1.concept_id = t4.id
- AND t1. STATUS = 1
- AND t4. STATUS = 1
- AND t4.lib_type BETWEEN 300 AND 399
- AND t10.start_id = t4.id
- AND t10.relation_id = 600
- AND t10.end_id = t11.id
- AND t11.lib_type BETWEEN 100 AND 299
- AND t10.is_deleted = "N"
- AND t11.is_deleted = "N"
- AND t10. STATUS = 1
- AND t11. STATUS = 1
- </select>
- <select id="getRuleBaseInitDTONotHaveClass" resultType="com.diagbot.dto.RuleBaseInitDTO">
- SELECT
- t3.id AS ruleBaseId,
- t5.lib_name AS baseLibName,
- t5.lib_type AS baseLibType,
- t3.type AS baseType,
- t3.min_operator AS baseMinOperator,
- t3.min_value AS baseMinValue,
- t3.min_unit AS baseMinUnit,
- t3.max_operator AS baseMaxOperator,
- t3.max_value AS baseMaxValue,
- t3.max_unit AS baseMaxUnit,
- t3.eq_operator AS baseEqOperator,
- t3.eq_value AS baseEqValue,
- t3.eq_unit AS baseEqUnit
- FROM
- kl_rule_base t3,
- kl_concept t5
- WHERE
- t3.is_deleted = "N"
- AND t5.is_deleted = "N"
- AND t3. STATUS = 1
- AND t5. STATUS = 1
- AND t3.concept_id = t5.id
- AND (t5.lib_type BETWEEN 100 AND 299
- OR t5.lib_type= 410)
- </select>
- <select id="getRuleBaseInitDTOHaveClass" resultType="com.diagbot.dto.RuleBaseInitDTO">
- SELECT
- t3.id AS ruleBaseId,
- t11.lib_name AS baseLibName,
- t11.lib_type AS baseLibType,
- t3.type AS baseType,
- t3.min_operator AS baseMinOperator,
- t3.min_value AS baseMinValue,
- t3.min_unit AS baseMinUnit,
- t3.max_operator AS baseMaxOperator,
- t3.max_value AS baseMaxValue,
- t3.max_unit AS baseMaxUnit,
- t3.eq_operator AS baseEqOperator,
- t3.eq_value AS baseEqValue,
- t3.eq_unit AS baseEqUnit
- FROM
- kl_rule_base t3,
- kl_concept t5,
- kl_relation t10,
- kl_concept t11
- WHERE
- t3.is_deleted = "N"
- AND t5.is_deleted = "N"
- AND t3. STATUS = 1
- AND t5. STATUS = 1
- AND t3.concept_id = t5.id
- AND t5.lib_type BETWEEN 300 AND 399
- AND t10.start_id = t5.id
- AND t10.relation_id = 600
- AND t10.end_id = t11.id
- AND (t11.lib_type BETWEEN 100 AND 299
- OR t11.lib_type = 410)
- AND t10.is_deleted = "N"
- AND t11.is_deleted = "N"
- AND t10. STATUS = 1
- AND t11. STATUS = 1
- </select>
- <select id="getRulePage" resultType="com.diagbot.dto.RuleQueryDTO" parameterType="com.diagbot.vo.RuleQueryVO">
- SELECT DISTINCT
- t12.libName AS libName,
- t12.libType AS libType,
- t12.ruleType AS ruleType
- FROM
- (
- SELECT
- t1.concept_id AS conceptId,
- t1.id AS ruleId,
- t4.lib_name AS libName,
- t4.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.has_sub_cond AS hasSubCond,
- t1.gmt_modified AS gmtModified
- FROM
- kl_rule t1,
- kl_rule_search t3,
- kl_concept t4
- WHERE
- t1.is_deleted = "N"
- AND t3.is_deleted = "N"
- AND t3.id = t1.id
- AND t4.is_deleted = "N"
- AND t1.concept_id = t4.id
- AND t1. STATUS = 1
- AND t4. STATUS = 1
- AND t4.lib_type BETWEEN 100
- AND 299
- <if test="description!=null and description!=''">
- AND UPPER(t1.description) LIKE CONCAT('%', UPPER(trim(#{description})), '%')
- </if>
- <if test="libName!=null and libName!=''">
- AND UPPER(t4.lib_name) LIKE CONCAT('%', UPPER(trim(#{libName})), '%')
- </if>
- <if test="libType !=null">
- AND t4.lib_type = #{libType}
- </if>
- <if test="ruleType !=null">
- AND t1.rule_type = #{ruleType}
- </if>
- UNION ALL
- SELECT
- t11.id AS conceptId,
- t1.id AS ruleId,
- t11.lib_name AS libName,
- t11.lib_type AS libType,
- t1.rule_type AS ruleType,
- t1.has_sub_cond AS hasSubCond,
- t1.gmt_modified AS gmtModified
- FROM
- kl_rule t1,
- kl_rule_search t3,
- kl_concept t4,
- kl_relation t10,
- kl_concept t11
- WHERE
- t1.is_deleted = "N"
- AND t4.is_deleted = "N"
- AND t3.is_deleted = "N"
- AND t3.id = t1.id
- AND t1.concept_id = t4.id
- AND t1. STATUS = 1
- AND t4. STATUS = 1
- AND t4.lib_type BETWEEN 300
- AND 399
- AND t10.start_id = t4.id
- AND t10.relation_id = 600
- AND t10.end_id = t11.id
- AND t11.lib_type BETWEEN 100
- AND 299
- AND t10.is_deleted = "N"
- AND t11.is_deleted = "N"
- AND t10. STATUS = 1
- AND t11. STATUS = 1
- <if test="description!=null and description!=''">
- AND UPPER(t1.description) LIKE CONCAT('%', UPPER(trim(#{description})), '%')
- </if>
- <if test="libName!=null and libName!=''">
- AND UPPER(t11.lib_name) LIKE CONCAT('%', UPPER(trim(#{libName})), '%')
- </if>
- <if test="libType !=null">
- AND t11.lib_type = #{libType}
- </if>
- <if test="ruleType !=null">
- AND t1.rule_type = #{ruleType}
- </if>
- ) t12
- <if test="(baseLibType!=null) or (baseLibName!=null and baseLibName!='')">
- INNER JOIN
- (SELECT
- t1.id AS ruleId,
- t3.id AS ruleBaseId,
- t5.lib_name AS baseLibName,
- t5.lib_type AS baseLibType,
- t3.type AS baseType
- FROM
- kl_rule_search t1,
- kl_rule_condition t2,
- kl_rule_base t3,
- kl_concept t5
- WHERE
- t3.is_deleted = "N"
- AND t5.is_deleted = "N"
- AND t1.is_deleted = "N"
- AND t2.is_deleted = "N"
- AND t1.id = t2.rule_base_id
- AND t2.rule_base_id = t3.id
- AND t3. STATUS = 1
- AND t5. STATUS = 1
- AND t3.concept_id = t5.id
- <if test="baseLibName!=null and baseLibName!=''">
- AND UPPER(t5.lib_name) LIKE CONCAT('%', UPPER(trim(#{baseLibName})), '%')
- </if>
- <if test="baseLibType !=null">
- AND t5.lib_type = #{baseLibType}
- </if>
- AND (t5.lib_type BETWEEN 100 AND 299
- OR t5.lib_type= 410)
- UNION ALL
- SELECT
- t1.id AS ruleId,
- t3.id AS ruleBaseId,
- t11.lib_name AS baseLibName,
- t11.lib_type AS baseLibType,
- t3.type AS baseType
- FROM
- kl_rule_search t1,
- kl_rule_condition t2,
- kl_rule_base t3,
- kl_concept t5,
- kl_relation t10,
- kl_concept t11
- WHERE
- t3.is_deleted = "N"
- AND t5.is_deleted = "N"
- AND t1.is_deleted = "N"
- AND t2.is_deleted = "N"
- AND t1.id = t2.rule_base_id
- AND t2.rule_base_id = t3.id
- AND t3. STATUS = 1
- AND t5. STATUS = 1
- AND t3.concept_id = t5.id
- AND t5.lib_type BETWEEN 300 AND 399
- AND t10.start_id = t5.id
- AND t10.relation_id = 600
- AND t10.end_id = t11.id
- <if test="baseLibName!=null and baseLibName!=''">
- AND UPPER(t11.lib_name) LIKE CONCAT('%', UPPER(trim(#{baseLibName})), '%')
- </if>
- <if test="baseLibType !=null">
- AND t11.lib_type = #{baseLibType}
- </if>
- AND (t11.lib_type BETWEEN 100 AND 299
- OR t11.lib_type = 410)
- AND t10.is_deleted = "N"
- AND t11.is_deleted = "N"
- AND t10. STATUS = 1
- AND t11. STATUS = 1) t13 ON t12.ruleId = t13.ruleId
- </if>
- ORDER BY
- t12.gmtModified DESC,
- t12.ruleId DESC,
- t12.conceptId DESC
- </select>
- </mapper>
|