Administrator 3 years ago
parent
commit
98c4ac9f9a

+ 12 - 0
mybusiness/src/main/java/com/sooka/system/domain/TUInterfaceinfo.java

@@ -66,6 +66,17 @@ public class TUInterfaceinfo extends BaseEntity
     @Excel(name = "AK/SK方式")
     private String typeAksk;
 
+    private String code;
+
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
     public void setId(String id)
     {
         this.id = id;
@@ -205,6 +216,7 @@ public class TUInterfaceinfo extends BaseEntity
             .append("interfaceAddress", getInterfaceAddress())
             .append("typeIam", getTypeIam())
             .append("typeAksk", getTypeAksk())
+                .append("code", getCode())
             .toString();
     }
 }

+ 10 - 8
mybusiness/src/main/java/com/sooka/system/mapper/TUInterfaceinfoMapper.java

@@ -5,15 +5,15 @@ import com.sooka.system.domain.TUInterfaceinfo;
 
 /**
  * 【请填写功能名称】Mapper接口
- * 
+ *
  * @author lei
  * @date 2021-07-01
  */
-public interface TUInterfaceinfoMapper 
+public interface TUInterfaceinfoMapper
 {
     /**
      * 查询【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】ID
      * @return 【请填写功能名称】
      */
@@ -21,7 +21,7 @@ public interface TUInterfaceinfoMapper
 
     /**
      * 查询【请填写功能名称】列表
-     * 
+     *
      * @param tUInterfaceinfo 【请填写功能名称】
      * @return 【请填写功能名称】集合
      */
@@ -29,7 +29,7 @@ public interface TUInterfaceinfoMapper
 
     /**
      * 新增【请填写功能名称】
-     * 
+     *
      * @param tUInterfaceinfo 【请填写功能名称】
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface TUInterfaceinfoMapper
 
     /**
      * 修改【请填写功能名称】
-     * 
+     *
      * @param tUInterfaceinfo 【请填写功能名称】
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface TUInterfaceinfoMapper
 
     /**
      * 删除【请填写功能名称】
-     * 
+     *
      * @param id 【请填写功能名称】ID
      * @return 结果
      */
@@ -53,9 +53,11 @@ public interface TUInterfaceinfoMapper
 
     /**
      * 批量删除【请填写功能名称】
-     * 
+     *
      * @param ids 需要删除的数据ID
      * @return 结果
      */
     public int deleteTUInterfaceinfoByIds(String[] ids);
+
+    public Integer getMaxCode();
 }

+ 32 - 0
mybusiness/src/main/java/com/sooka/system/service/impl/TUInterfaceinfoServiceImpl.java

@@ -59,9 +59,41 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
     {
         tUInterfaceinfo.setId(UUID.fastUUID().toString());
         tUInterfaceinfo.setCreateTime(DateUtils.getNowDate());
+        //计算code 5位
+        Integer integer = tUInterfaceinfoMapper.getMaxCode();
+        if(integer == null){
+            tUInterfaceinfo.setCode("00001");
+        }else{
+            Integer i = integer+1;
+            int w =getW(i);
+            String r = String.valueOf(i);
+            for(int k=0;k<5-w;k++){
+                r = "0"+r;
+            }
+            tUInterfaceinfo.setCode(r);
+
+        }
+
+
         return tUInterfaceinfoMapper.insertTUInterfaceinfo(tUInterfaceinfo);
     }
 
+
+    public static int getW(Integer i){
+        for(int k=1;k<=5;k++){
+            if(i/ (int)Math.pow(10,k) == 0){
+                return k;
+            }
+        }
+        return  0;
+    }
+
+    public static void main(String[] args){
+        System.out.println(getW(10000));
+//        System.out.println(1/(int)Math.pow(10,1));
+    }
+
+
     /**
      * 修改【请填写功能名称】
      *

+ 16 - 7
mybusiness/src/main/resources/mapper/system/TUInterfaceinfoMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sooka.system.mapper.TUInterfaceinfoMapper">
-    
+
     <resultMap type="TUInterfaceinfo" id="TUInterfaceinfoResult">
         <result property="id"    column="id"    />
         <result property="status"    column="status"    />
@@ -23,15 +23,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="interfaceAddress"    column="interface_address"    />
         <result property="typeIam"    column="type_iam"    />
         <result property="typeAksk"    column="type_aksk"    />
+        <result property="code"    column="code"    />
     </resultMap>
 
     <sql id="selectTUInterfaceinfoVo">
-        select id, status, remark, del_flag, create_by, create_time, update_by, update_time, interface_name, info_item, usage_scenarios, share_type, interface_type, env, sign_serveraddress, interface_address, type_iam, type_aksk from t_u_interfaceinfo
+        select id, status, remark, del_flag, create_by, create_time, update_by, update_time, interface_name, info_item, usage_scenarios, share_type, interface_type, env, sign_serveraddress, interface_address, type_iam, type_aksk,code from t_u_interfaceinfo
     </sql>
 
     <select id="selectTUInterfaceinfoList" parameterType="TUInterfaceinfo" resultMap="TUInterfaceinfoResult">
         <include refid="selectTUInterfaceinfoVo"/>
-        <where>  
+        <where>
             <if test="status != null  and status != ''"> and status = #{status}</if>
             <if test="interfaceName != null  and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
             <if test="infoItem != null  and infoItem != ''"> and info_item = #{infoItem}</if>
@@ -43,14 +44,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="interfaceAddress != null  and interfaceAddress != ''"> and interface_address = #{interfaceAddress}</if>
             <if test="typeIam != null  and typeIam != ''"> and type_iam = #{typeIam}</if>
             <if test="typeAksk != null  and typeAksk != ''"> and type_aksk = #{typeAksk}</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
         </where>
     </select>
-    
+
     <select id="selectTUInterfaceinfoById" parameterType="String" resultMap="TUInterfaceinfoResult">
         <include refid="selectTUInterfaceinfoVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertTUInterfaceinfo" parameterType="TUInterfaceinfo">
         insert into t_u_interfaceinfo
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -72,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="interfaceAddress != null">interface_address,</if>
             <if test="typeIam != null">type_iam,</if>
             <if test="typeAksk != null">type_aksk,</if>
+            <if test="code != null">code,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
@@ -92,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="interfaceAddress != null">#{interfaceAddress},</if>
             <if test="typeIam != null">#{typeIam},</if>
             <if test="typeAksk != null">#{typeAksk},</if>
+            <if test="code != null">#{code},</if>
          </trim>
     </insert>
 
@@ -115,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="interfaceAddress != null">interface_address = #{interfaceAddress},</if>
             <if test="typeIam != null">type_iam = #{typeIam},</if>
             <if test="typeAksk != null">type_aksk = #{typeAksk},</if>
+            <if test="code != null">code = #{code},</if>
         </trim>
         where id = #{id}
     </update>
@@ -124,10 +129,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteTUInterfaceinfoByIds" parameterType="String">
-        delete from t_u_interfaceinfo where id in 
+        delete from t_u_interfaceinfo where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
 
-</mapper>
+    <select id="getMaxCode" resultType="java.lang.Integer" >
+        SELECT max(CONVERT(code, UNSIGNED INTEGER)) from t_u_interfaceinfo
+    </select>
+
+</mapper>

+ 118 - 103
mybusiness/src/main/resources/templates/system/interfaceinfo/interfaceinfo.html

@@ -1,99 +1,109 @@
 <!DOCTYPE html>
 <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
-    <th:block th:include="include :: header('【请填写功能名称】列表')" />
+    <th:block th:include="include :: header('【请填写功能名称】列表')"/>
 </head>
 <body class="gray-bg">
-     <div class="container-div">
-        <div class="row">
-            <div class="col-sm-12 search-collapse">
-                <form id="formId">
-                    <div class="select-list">
-                        <ul>
-                            <li>
-                                <label>接口名称:</label>
-                                <input type="text" name="interfaceName"/>
-                            </li>
-                            <li>
-                                <label>共享方式:</label>
-                                <select name="shareType" th:with="type=${@dict.getType('share_type')}">
-                                    <option value="">所有</option>
-                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
-                                </select>
-                            </li>
-                            <li>
-                                <label>请求方式:</label>
-                                <select name="interfaceType" th:with="type=${@dict.getType('interface_type')}">
-                                    <option value="">所有</option>
-                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
-                                </select>
-                            </li>
-                            <li>
-                                <label>签名服务地址:</label>
-                                <input type="text" name="signServeraddress"/>
-                            </li>
-                            <li>
-                                <label>接口地址:</label>
-                                <input type="text" name="interfaceAddress"/>
-                            </li>
-                            <li>
-                                <label>IAM方式:</label>
-                                <input type="text" name="typeIam"/>
-                            </li>
-                            <li>
-                                <label>AK/SK方式:</label>
-                                <input type="text" name="typeAksk"/>
-                            </li>
-                            <li>
-                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
-                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
-                            </li>
-                        </ul>
-                    </div>
-                </form>
-            </div>
+<div class="container-div">
+    <div class="row">
+        <div class="col-sm-12 search-collapse">
+            <form id="formId">
+                <div class="select-list">
+                    <ul>
+                        <li>
+                            <label>接口码:</label>
+                            <input type="text" name="code"/>
+                        </li>
+                        <li>
+                            <label>接口名称:</label>
+                            <input type="text" name="interfaceName"/>
+                        </li>
+                        <li>
+                            <label>共享方式:</label>
+                            <select name="shareType" th:with="type=${@dict.getType('share_type')}">
+                                <option value="">所有</option>
+                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
+                                        th:value="${dict.dictValue}"></option>
+                            </select>
+                        </li>
+                        <li>
+                            <label>请求方式:</label>
+                            <select name="interfaceType" th:with="type=${@dict.getType('interface_type')}">
+                                <option value="">所有</option>
+                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
+                                        th:value="${dict.dictValue}"></option>
+                            </select>
+                        </li>
+                        <li>
+                            <label>签名服务地址:</label>
+                            <input type="text" name="signServeraddress"/>
+                        </li>
+                        <li>
+                            <label>接口地址:</label>
+                            <input type="text" name="interfaceAddress"/>
+                        </li>
+                        <li>
+                            <label>IAM方式:</label>
+                            <input type="text" name="typeIam"/>
+                        </li>
+                        <li>
+                            <label>AK/SK方式:</label>
+                            <input type="text" name="typeAksk"/>
+                        </li>
+                        <li>
+                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
+                                    class="fa fa-search"></i>&nbsp;搜索</a>
+                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
+                                    class="fa fa-refresh"></i>&nbsp;重置</a>
+                        </li>
+                    </ul>
+                </div>
+            </form>
+        </div>
 
-            <div class="btn-group-sm" id="toolbar" role="group">
-                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:interfaceinfo:add">
-                    <i class="fa fa-plus"></i> 添加
-                </a>
-                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:interfaceinfo:edit">
-                    <i class="fa fa-edit"></i> 修改
-                </a>
-                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:interfaceinfo:remove">
-                    <i class="fa fa-remove"></i> 删除
-                </a>
-                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:interfaceinfo:export">
-                    <i class="fa fa-download"></i> 导出
-                </a>
-            </div>
-            <div class="col-sm-12 select-table table-striped">
-                <table id="bootstrap-table"></table>
-            </div>
+        <div class="btn-group-sm" id="toolbar" role="group">
+            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:interfaceinfo:add">
+                <i class="fa fa-plus"></i> 添加
+            </a>
+            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
+               shiro:hasPermission="system:interfaceinfo:edit">
+                <i class="fa fa-edit"></i> 修改
+            </a>
+            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
+               shiro:hasPermission="system:interfaceinfo:remove">
+                <i class="fa fa-remove"></i> 删除
+            </a>
+            <a class="btn btn-warning" onclick="$.table.exportExcel()"
+               shiro:hasPermission="system:interfaceinfo:export">
+                <i class="fa fa-download"></i> 导出
+            </a>
+        </div>
+        <div class="col-sm-12 select-table table-striped">
+            <table id="bootstrap-table"></table>
         </div>
     </div>
-    <th:block th:include="include :: footer" />
-    <script th:inline="javascript">
-        var editFlag = [[${@permission.hasPermi('system:interfaceinfo:edit')}]];
-        var removeFlag = [[${@permission.hasPermi('system:interfaceinfo:remove')}]];
-        var prefix = ctx + "system/interfaceinfo";
-        var shareType_datas = [[${@dict.getType('share_type')}]];
-        var interfaceType_datas = [[${@dict.getType('interface_type')}]];
-        console.log(interfaceType_datas)
+</div>
+<th:block th:include="include :: footer"/>
+<script th:inline="javascript">
+    var editFlag = [[${@permission.hasPermi('system:interfaceinfo:edit')}]];
+    var removeFlag = [[${@permission.hasPermi('system:interfaceinfo:remove')}]];
+    var prefix = ctx + "system/interfaceinfo";
+    var shareType_datas = [[${@dict.getType('share_type')}]];
+    var interfaceType_datas = [[${@dict.getType('interface_type')}]];
+    console.log(interfaceType_datas)
 
 
-
-        $(function() {
-            var options = {
-                url: prefix + "/list",
-                createUrl: prefix + "/add",
-                updateUrl: prefix + "/edit/{id}",
-                removeUrl: prefix + "/remove",
-                exportUrl: prefix + "/export",
-                modalName: "【请填写功能名称】",
-                columns: [{
-                    checkbox: true
-                },
+    $(function () {
+        var options = {
+            url: prefix + "/list",
+            createUrl: prefix + "/add",
+            updateUrl: prefix + "/edit/{id}",
+            removeUrl: prefix + "/remove",
+            exportUrl: prefix + "/export",
+            modalName: "【请填写功能名称】",
+            columns: [{
+                checkbox: true
+            },
                 {
                     field: 'id',
                     title: '主键ID',
@@ -110,6 +120,10 @@
                     visible: false
                 },
                 {
+                    field: 'code',
+                    title: '接口码'
+                },
+                {
                     field: 'interfaceName',
                     title: '接口名称'
                 },
@@ -124,14 +138,14 @@
                 {
                     field: 'shareType',
                     title: '共享方式',
-                    formatter: function(value, item, index) {
+                    formatter: function (value, item, index) {
                         return $.table.selectDictLabel(shareType_datas, item.shareType);
                     }
                 },
                 {
                     field: 'interfaceType',
                     title: '请求方式',
-                    formatter: function(value, item, index) {
+                    formatter: function (value, item, index) {
                         return $.table.selectDictLabel(interfaceType_datas, item.interfaceType);
                     }
                 },
@@ -158,7 +172,7 @@
                 {
                     title: '操作',
                     align: 'center',
-                    formatter: function(value, row, index) {
+                    formatter: function (value, row, index) {
                         var actions = [];
                         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
@@ -168,23 +182,24 @@
                         return actions.join('');
                     }
                 }]
-            };
-            $.table.init(options);
-        });
+        };
+        $.table.init(options);
+    });
+
 
+    function settingParams(id) {
+        var url = prefix + "/settingParams/" + id;
+        console.log(url)
+        $.modal.openTab("设置业务接口参数", url);
+    }
 
-        function settingParams(id) {
-            var url = prefix + "/settingParams/"+id;
-            console.log(url)
-            $.modal.openTab("设置业务接口参数", url);
-        }
-        function execInterface(id) {
-            var url = prefix + "/execInterface/"+id;
-            console.log(url)
-            $.modal.openTab("设置业务接口参数", url);
-        }
+    function execInterface(id) {
+        var url = prefix + "/execInterface/" + id;
+        console.log(url)
+        $.modal.openTab("设置业务接口参数", url);
+    }
 
 
-    </script>
+</script>
 </body>
 </html>