zoukankan      html  css  js  c++  java
  • maximo开发中可能用到的一些sql(各级菜单查询、完整删除应用)

    一级菜单查询:

    select t.position APP,
    'MODULE' appType,
    '' APPURL,
    mod.description,
    '' mainTbName,
    '5' maxAppsId,
    t.position ORDERID,
    NULL PARENT
    from maxmenu t, maxmodules mod
    where t.keyvalue = mod.module
    and t.menutype = 'MODULE'
    and t.elementtype = 'MODULE'
    and t.visible = 1

    二级菜单查询:

    select t.position app,
    'APP' appType,
    p.app APPURL,
    p.description,
    '' mainTbName,
    '5' maxAppsId,
    t.position ORDERID,
    m.position parent
    from maxmenu t,
    maxapps p,
    (select t.position, mod.module
    from maxmenu t, maxmodules mod
    where t.keyvalue = mod.module
    and t.menutype = 'MODULE'
    and t.elementtype = 'MODULE'
    and t.visible = 1
    and t.moduleapp in
    (select m.moduleapp
    from maxmenu m
    where m.menutype = 'MODULE'
    and m.elementtype = 'APP'
    and m.keyvalue in
    (select distinct a.app
    from applicationauth a
    where a.groupname in
    (select g.groupname
    from groupuser g)
    -- where g.userid = inuserid)
    and a.optionname = 'READ'
    ))) m
    where t.keyvalue = p.app
    and t.menutype = 'MODULE'
    and t.elementtype = 'APP'
    and t.moduleapp = m.module
    and t.subposition = 0
    and t.visible = 1

    比如:
    查询设备维修计划
    select t.position app,
    'APP' appType,
    p.app APPURL,
    p.description,
    '' mainTbName,
    '5' maxAppsId,
    t.position ORDERID,
    t.position parent,
    t.maxmenuid
    from maxmenu t,
    maxapps p
    where t.keyvalue = p.app
    and t.menutype = 'MODULE'
    and t.elementtype = 'APP'
    -- and t.moduleapp = m.module
    and t.subposition = 0
    and t.visible = 1
    and p.description like '设备维修计划'

    三级菜单查询:

    select t.subposition app,
    'APP' appType,
    p.app APPURL,
    p.description,
    '' mainTbName,
    '5' maxAppsId,
    t.subposition ORDERID,
    pa.position parent
    from maxmenu t,
    maxapps p,
    (select t.position, M.module
    from maxmenu t,
    (select t.position, mod.module
    from maxmenu t, maxmodules mod
    where t.keyvalue = mod.module
    and t.menutype = 'MODULE'
    and t.elementtype = 'MODULE'
    and t.visible = 1
    and t.moduleapp in
    (select m.moduleapp
    from maxmenu m
    where m.menutype = 'MODULE'
    and m.elementtype = 'APP'
    and m.keyvalue in
    (select distinct a.app
    from applicationauth a
    where a.groupname in
    (select g.groupname
    from groupuser g
    )
    and a.optionname = 'READ'))) m
    where t.menutype = 'MODULE'
    and t.elementtype = 'HEADER'
    and t.moduleapp = m.module
    and t.visible = 1
    and t.moduleapp in
    (select m.moduleapp
    from maxmenu m
    where m.menutype = 'MODULE'
    and m.keyvalue in
    (select distinct a.app
    from applicationauth a
    where a.groupname in
    (select g.groupname
    from groupuser g
    )
    and a.optionname = 'READ'))) PA
    where t.keyvalue = p.app
    and t.menutype = 'MODULE'
    and t.elementtype = 'APP'
    and t.moduleapp = PA.module
    AND T.position = PA.position
    and t.visible = 1

    如上,那么各级菜单的信息都查出来了,更改菜单等级应该就有理可询了

    下面是完整删除一个应用要包含的操作了:

    delete from maxapps where app='SBWXJH2';

    delete from maxpresentation where app='SBWXJH2';

    delete from sigoption where app='SBWXJH2';

    delete from applicationauth where app='SBWXJH2';

    delete from maxlabels where app='SBWXJH2';

    delete from maxmenu where moduleapp='SBWXJH2' and menutype !='MODULE';

    delete from maxmenu where elementtype='APP' and keyvalue='SBWXJH2';

    delete from appdoctype where app='SBWXJH2';

    delete from sigoptflag where app='SBWXJH2';

    上面这个是删除一个应用程序为SBWXJH2的应用

     下面是域查询的相关sql:

    select * from maxattribute where objectname='SBREWORKER' and attributename='REMARK';

    select * from maxdomain where domainid='REWORKERTITLE';

    select * from alndomain where domainid='REWORKERTITLE';

    查看sequence:

    SELECT * FROM SYSCAT.SEQUENCES where seqname like 'SB%';

    设置默认值:

    alter table sbrepairplan alter column hasld set with default 0

    UPDATE sbrepairplan SET hasld = DEFAULT WHERE hasld IS NULL;

    ALTER TABLE sbrepairplan ALTER COLUMN hasld DROP DEFAULT;

    这个设置默认值的sql是我网上查询的,虽然上次有使用,但是没有去验证结果,慎用

  • 相关阅读:
    js你不是的那些基础问题-错误处理机制
    js你不是的那些基础问题-数据类型的转换
    js你不是的那些基础问题-布尔运算符
    js你不是的那些基础问题-函数
    js你不知的那些基础问题-对象
    js你不知的那些基础问题-数值
    小程序中ios11底部黑条兼容
    上传---FileReader
    2021年了,我才知道H5支持元素拖放!!!
    ES6常用总结(一)
  • 原文地址:https://www.cnblogs.com/binTke170120/p/6364941.html
Copyright © 2011-2022 走看看