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是我网上查询的,虽然上次有使用,但是没有去验证结果,慎用

  • 相关阅读:
    浮点数大于0
    坐标变换
    实战c++中的vector系列--正确释放vector的内存(clear(), swap(), shrink_to_fit())
    计算sigma
    ECharts 在winform中使用(访问JS)
    Linux用户锁定、解锁及锁定查看
    vue或者js中平均分割数组
    python 文件读写with open模式r,r+,w,w+,a,a+的区别
    vue 三元表达式当出现elif
    后端排序时去掉element表格排序的null状态
  • 原文地址:https://www.cnblogs.com/binTke170120/p/6364941.html
Copyright © 2011-2022 走看看