| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <div class="space-api-body">
- <h1 class="body-h1">
- 码本 - CodeBook.xml
- </h1>
- <blockquote class="layui-elem-quote">
- 小码本 大作用,让开发更便捷,让页面更简单
- </blockquote>
- <fieldset class="layui-elem-field layui-field-title space-api-title">
- <legend>所在位置</legend>
- <div class="layui-field-box">
- <pre class="layui-code"><br>
- WebRoot
- └─WEB-INF
- └─apps
- └─模块
- └─config
- └─codebook.xml // 码本配置文件
- </pre>
- </div>
- </fieldset>
- <fieldset class="layui-elem-field layui-field-title space-api-title">
- <legend>初始化</legend>
- <div class="layui-field-box">
- 在系统启动时进行初始化,与服务配置文件同级,初始化顺序为:2
- </div>
- </fieldset>
- <fieldset class="layui-elem-field layui-field-title space-api-title">
- <legend>小码本 大作用</legend>
- <div class="layui-field-box">
- <div class="layui-row">
- <div class="layui-col-md6">
- <pre class="layui-code" lay-title="页面组件调用代码">
-
- <!-- 小码本大作用之下拉选择框 -->
- <el-select v-model="obj.jlztm" placeholder="请选择">
- <span class="span-red"><app:codeBookOption name="env.jlzt" /></span>
- </el-select>
- </pre>
- </div>
- <div class="layui-col-md6" style="text-align: center;">
- <img src="/dev/web/apiHelp/html/config/imgs/codebook/codebook_01.jpg" />
- </div>
- <hr />
- <div class="layui-col-md6">
- <pre class="layui-code" lay-title="页面组件调用代码">
- <!-- 小码本大作用之码本翻译 -->
- <span class="span-red"><app:codeBookTranslate name="env.jlzt" <br /> filter="{'jlztm':'21'}"</span> />
- </pre>
- </div>
- <div class="layui-col-md6" style="text-align: center;">
- <img src="/dev/web/apiHelp/html/config/imgs/codebook/codebook_02.jpg" />
- </div>
- <hr />
- <div class="layui-col-md12">
- <pre class="layui-code" lay-title="码本配置">
-
- <codebook name="jlzt" desc="记录状态" cache="true" >
- <sql>
- <![CDATA[ select jlztm, mc from app_jlzt order by jlztm desc ]]>
- </sql>
- </codebook>
- </pre>
- </div>
- </div>
- </div>
- </fieldset>
- <fieldset class="layui-elem-field layui-field-title space-api-title">
- <legend>属性配置</legend>
- <div class="layui-field-box">
- <table class="layui-table">
- <colgroup>
- <col width="100">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th>属性</th>
- <th>描述</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th>name</th>
- <th>码本名称,页面调用时使用,由字母和下划线组合,单个应用内唯一</th>
- </tr>
- <tr>
- <th>desc</th>
- <th>码本的描述</th>
- </tr>
- <tr>
- <th>cache</th>
- <th>是否进行缓存预热,可选值为<span class="span-red">true</span>和<span class="span-red">false</span>,可以为空,为空时默认为<span class="span-red">false</span>,如为<span class="span-red">true</span>,则在系统启动时进行预热,否则在调用时进行缓存</th>
- </tr>
- </tbody>
- </table>
- <blockquote class="layui-elem-quote layui-quote-nm">码本的配置虽然非常简单,但发挥的作用却不容小觑</blockquote>
- </div>
- </fieldset>
- <fieldset class="layui-elem-field layui-field-title space-api-title">
- <legend>完整组合 - 带参数、带条件、带排序</legend>
- <div class="layui-field-box">
- <pre class="layui-code">
- <codebook name="bm" desc="部门">
- <show text="mc" value="bmid"/>
- <sql>
- <![CDATA[ select bmid, mc, jlztm from app_bm where 1 = 1 ]]>
- </sql>
- <where name="ty" desc="停用" >
- <sql>
- <![CDATA[ and jlztm = 11 ]]>
- </sql>
- </where>
- <where name="jlzt" desc="记录状态" >
- <sql>
- <![CDATA[ and jlztm = :jlztm ]]>
- </sql>
- <param name="jlztm" value="appGw.jlztm" scope="request" />
- </where>
- <sort>
- <![CDATA[ order by bmid desc ]]>
- </sort>
- </codebook>
- </pre>
- <table class="layui-table">
- <colgroup>
- <col width="100">
- <col>
- <col>
- </colgroup>
- <thead>
- <tr>
- <th>子节点</th>
- <th>描述</th>
- <th>属性</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th>sql</th>
- <th>数据库查询主体脚本</th>
- <th>-</th>
- </tr>
- <tr>
- <th>show</th>
- <th colspan="2">向外输出的列名,可以为空,如为空,则默认取查询结果的第一列为text,第二列为value</th>
- </tr>
- <tr>
- <th>param</th>
- <th>参数节点,支持<span class="span-violet">sql(需要与sql同级)和where</span>节点,其他节点无法使用</th>
- <th>
- <table class="layui-table">
- <colgroup>
- <col width="100">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th>属性</th>
- <th>描述</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th>name</th>
- <th>参数名称,对应脚本中的占位符</th>
- </tr>
- <tr>
- <th>scope</th>
- <th>作用域,可选参数:<span class="span-violet">request</span>和<span class="span-violet">session</span></th>
- </tr>
- <tr>
- <th>value</th>
- <th>作用域中的键</th>
- </tr>
- </tbody>
- </table>
- </th>
- </tr>
- <tr>
- <th>where</th>
- <th>查询条件脚本,可以存在多个</th>
- <th>
- <table class="layui-table">
- <colgroup>
- <col width="100">
- <col>
- </colgroup>
- <thead>
- <tr>
- <th>属性</th>
- <th>描述</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <th>name</th>
- <th>名称,字母和下划线组合,单个码本内唯一,调用时使用</th>
- </tr>
- <tr>
- <th>desc</th>
- <th>码本描述</th>
- </tr>
- </tbody>
- </table>
- </th>
- </tr>
- <tr>
- <th>sort</th>
- <th colspan="2">排序脚本,可以为空,一般和<span class="span-violet">where</span>节点成对出现,单个码本内唯一,调用码本时候默认执行</th>
- </tr>
- </tbody>
- </table>
- </div>
- </fieldset>
- <blockquote class="layui-elem-quote">
- 建议把经常用到的码本进行缓存预热
- </blockquote>
- </div>
|