Browse Source

模板管理

xiaoqiao 1 year ago
parent
commit
7319ea37c8

+ 3 - 2
src/main/java/com/bowintek/practice/controller/TempController.java

@@ -10,6 +10,7 @@ import com.bowintek.practice.services.service.AccountService;
 import com.bowintek.practice.services.service.GenSqlStringService;
 import com.bowintek.practice.services.service.TempService;
 import com.bowintek.practice.services.service.system.RoleService;
+import com.bowintek.practice.vo.SaerchtempVo;
 import com.bowintek.practice.vo.system.FunctionCodeModel;
 import com.bowintek.practice.vo.system.RoleFunctionCodeModel;
 import com.bowintek.practice.vo.system.RoleModel;
@@ -37,9 +38,9 @@ public class TempController {
 
     @ResponseBody
     @GetMapping("/getList")
-    public BaseResponse<PageInfo<SrSaerchtemp>> getList(@RequestParam("page") int page, @RequestParam("rows") int rows,
+    public BaseResponse<PageInfo<SaerchtempVo>> getList(@RequestParam("page") int page, @RequestParam("rows") int rows,
                                                         String tempNo, String tempName) throws Exception {
-        PageInfo<SrSaerchtemp> result = tempService.getList(page, rows, tempNo, tempName, null);
+        PageInfo<SaerchtempVo> result = tempService.getList(page, rows, tempNo, tempName, null);
         return RespGenerstor.success(result);
     }
 

+ 2 - 1
src/main/java/com/bowintek/practice/mapper/cquery/TempCQuery.java

@@ -1,6 +1,7 @@
 package com.bowintek.practice.mapper.cquery;
 
 import com.bowintek.practice.model.*;
+import com.bowintek.practice.vo.SaerchtempVo;
 import com.bowintek.practice.vo.system.RoleFunctionCodeModel;
 import org.apache.ibatis.annotations.Param;
 
@@ -8,7 +9,7 @@ import java.util.HashMap;
 import java.util.List;
 
 public interface TempCQuery {
-    List<SrSaerchtemp> getList(String tempNo, String tempName, String tempIdsString);
+    List<SaerchtempVo> getList(String tempNo, String tempName, String tempIdsString);
     List<HashMap<String,Object>> getListBySqlString(String sqlString);
     List<HashMap<String,Object>> getListToHashMap(String tempName);
     Integer batchInsertDimension(@Param("dataList") List<SrTempdimension> dataList);

+ 5 - 4
src/main/java/com/bowintek/practice/services/impl/TempServiceImpl.java

@@ -9,6 +9,7 @@ import com.bowintek.practice.services.service.TempService;
 import com.bowintek.practice.services.service.UserService;
 import com.bowintek.practice.util.DateUtils;
 import com.bowintek.practice.util.StringUtils;
+import com.bowintek.practice.vo.SaerchtempVo;
 import com.bowintek.practice.vo.temp.TempObjectModel;
 import com.bowintek.practice.vo.temp.TempSaveResult;
 import com.bowintek.practice.vo.user.DataRange;
@@ -35,14 +36,14 @@ public class TempServiceImpl implements TempService {
     private StringUtils stringUtils;
 
     @Override
-    public PageInfo<SrSaerchtemp> getList(Integer page, Integer rows,
-                                       String tempNo, String tempName, List<String> idList) {
+    public PageInfo<SaerchtempVo> getList(Integer page, Integer rows,
+                                          String tempNo, String tempName, List<String> idList) {
         PageHelper.startPage(page, rows);
 
-        List<SrSaerchtemp> dataList = tempCQuery.getList(tempNo, tempName,
+        List<SaerchtempVo> dataList = tempCQuery.getList(tempNo, tempName,
                 stringUtils.ListToInSql(idList));
 
-        PageInfo<SrSaerchtemp> result = new PageInfo(dataList);
+        PageInfo<SaerchtempVo> result = new PageInfo(dataList);
         return result;
     }
 

+ 2 - 1
src/main/java/com/bowintek/practice/services/service/TempService.java

@@ -2,6 +2,7 @@ package com.bowintek.practice.services.service;
 
 import com.bowintek.practice.model.SrSaerchtemp;
 import com.bowintek.practice.model.SysMenu;
+import com.bowintek.practice.vo.SaerchtempVo;
 import com.bowintek.practice.vo.temp.TempObjectModel;
 import com.bowintek.practice.vo.temp.TempSaveResult;
 import com.github.pagehelper.PageInfo;
@@ -10,7 +11,7 @@ import java.util.HashMap;
 import java.util.List;
 
 public interface TempService {
-    PageInfo<SrSaerchtemp> getList(Integer page, Integer rows,
+    PageInfo<SaerchtempVo> getList(Integer page, Integer rows,
                                    String tempNo, String tempName, List<String> idList);
     List<HashMap<String,Object>> getSubjectTree(String likeName);
     TempSaveResult saveTemp(TempObjectModel data, String userID);

+ 10 - 0
src/main/java/com/bowintek/practice/vo/SaerchtempVo.java

@@ -0,0 +1,10 @@
+package com.bowintek.practice.vo;
+
+import com.bowintek.practice.model.SrSaerchtemp;
+import lombok.Data;
+
+@Data
+public class SaerchtempVo extends SrSaerchtemp {
+    private String dimensionName;
+    private String measurName;
+}

+ 8 - 2
src/main/resources/mapping/cquery/TempCQuery.xml

@@ -1,9 +1,15 @@
 <?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.bowintek.practice.mapper.cquery.TempCQuery">
-    <select id="getList" resultType="com.bowintek.practice.model.SrSaerchtemp">
-        select *
+    <select id="getList" resultType="com.bowintek.practice.vo.SaerchtempVo">
+        select tmp.*,td.dimensionName,tm.measurName
         from sr_saerchtemp tmp
+        left join(
+        select d.tempId,group_concat(d.fieldName) dimensionName from  sr_tempDimension d group by d.tempId
+        ) td on tmp.tempId = td.tempId
+        left join(
+        select m.tempId,group_concat(concat(m.fieldName,'(',m.operation,')')) measurName from  sr_tempMeasure m group by m.tempId
+        ) tm on tmp.tempId = tm.tempId
         where 1=1
         <if test="tempName!='' and tempName!=null">
             and tmp.tempName like Concat('%',#{tempName},'%')

BIN
target/classes/com/bowintek/practice/vo/common/ImportBaseModel.class


BIN
target/classes/com/bowintek/practice/vo/practicebase/ImportPositionModel.class


+ 2 - 2
vue/src/plugins/antd.ts

@@ -19,7 +19,7 @@ import {
   Switch,
   Space, Cascader,
   Tree,
-  Transfer,Image,Progress,List,Avatar,Badge,Spin,Pagination
+  Transfer,Image,Progress,List,Avatar,Badge,Spin,Pagination,Popover
 } from 'ant-design-vue';
 import type { App } from 'vue';
 //导入组件库
@@ -68,5 +68,5 @@ export function setupAntd(app: App<Element>) {
     .use(Transfer)
     .use(Cascader)
     .use(Image)
-    .use(Tree).use(Progress).use(List).use(Avatar).use(Badge).use(Spin).use(Pagination);
+    .use(Tree).use(Progress).use(List).use(Avatar).use(Badge).use(Spin).use(Pagination).use(Popover);
 }

+ 84 - 18
vue/src/views/query/table.vue

@@ -24,23 +24,63 @@
             <a-input v-model:value="formState.tempNo" style="width: 200px"></a-input>
           </a-form-item>
         </a-col>
-        <a-col  :span="6" style="text-align: left">
+        <a-col :span="6" style="text-align: left">
           <a-button type="primary" html-type="submit" @click="onFinish">查询</a-button>
           <a-button style="margin: 0 8px" @click="() => {formRef.resetFields();loadData()}">重置</a-button>
         </a-col>
       </a-row>
       <a-row class="edit-operation">
         <a-col :span="24" style="text-align: right">
+          <a-radio-group v-model:value="viewModel" style="text-align: left">
+            <a-radio-button value="list">列表</a-radio-button>
+            <a-radio-button value="card">卡片</a-radio-button>
+          </a-radio-group>
           <a-button type="primary" html-type="button" @click="add" functioncode="T010601">新增</a-button>
           <a-popconfirm placement="leftTop"
-            title="是否删除模板数据?"
-            @confirm="onDelete()">
+                        title="是否删除模板数据?"
+                        @confirm="onDelete()">
             <a-button type="primary" style="margin: 0 8px" html-type="button" functioncode="T010604">删除</a-button>
           </a-popconfirm>
         </a-col>
       </a-row>
     </a-form>
-    <div class="search-result-list">
+    <div class="search-result-list" v-if="viewModel=='card'">
+      <a-row :gutter="[24,8]">
+        <a-col :span="6" v-for="item in data">
+
+          <a-card :title="item.tempName" @mouseover="item.visible=true"  @mouseout="item.visible=false">
+            <template #extra>
+              <a href="#">查看详情</a>
+            </template>
+            <template class="ant-card-actions" #actions>
+              <edit-outlined key="edit"/>
+              <ellipsis-outlined key="ellipsis"/>
+            </template>
+            <a-popover title="详细信息" :visible="item.visible">
+              <template #content>
+                <p>维度:{{ item.dimensionName }}</p>
+                <p>度量:{{ item.measurName }}</p>
+              </template>
+            </a-popover>
+            <a-row :gutter="[24,4]" >
+              <a-col :span="10" class="col-text">维度:</a-col>
+              <a-col :span="12" class="col-content" >{{ item.dimensionName }}</a-col>
+              <a-col :span="10" class="col-text">度量:</a-col>
+              <a-col :span="12" class="col-content" >{{ item.measurName }}</a-col>
+              <a-col :span="10" class="col-text">创建人:</a-col>
+              <a-col :span="12">{{ item.createdName }}</a-col>
+              <a-col :span="10" class="col-text">创建/更新日期:</a-col>
+              <a-col :span="12">{{ dayjs(item.createTime ?? item.modifyTime).format('YYYY-MM-DD') }}</a-col>
+              <a-col :span="10" class="col-text">备注:</a-col>
+              <a-col :span="12" class="col-content">{{ item.remark }}</a-col>
+            </a-row>
+          </a-card>
+        </a-col>
+      </a-row>
+      <a-pagination v-model:current="pagination.current" :total="pagination.total"
+                    :pageSize="pagination.pageSize" :show-total="total => `共 ${total} 条`"/>
+    </div>
+    <div class="search-result-list" v-if="viewModel=='list'">
       <a-table :columns="columns" :data-source="data" :scroll="{ x:'100%', y: 500 }" :pagination="pagination"
                :loading="loading"
                :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@@ -60,7 +100,7 @@
 import {reactive, ref, defineComponent, computed} from 'vue';
 import type {FormInstance} from 'ant-design-vue';
 import type {TableColumnsType, TableProps} from 'ant-design-vue';
-import { get, postdel} from '@/api/common';
+import {get, postdel} from '@/api/common';
 import {useRoute, useRouter} from "vue-router";
 import {useTabsViewStore} from "@/store/modules/tabsView";
 import {message} from "ant-design-vue";
@@ -77,11 +117,11 @@ export default defineComponent({
     const expand = ref(false);
     const formRef = ref<FormInstance>();
     const tabsViewStore = useTabsViewStore();
-    const selectedRowKeys =ref([]) ;
+    const selectedRowKeys = ref([]);
+    const viewModel = ref("list");
     const formState = reactive({
-      page: 1, rows: 10, tempName: '', tempNo: '', tempId: "", total: 0,isPostManage:true
+      page: 1, rows: 10, tempName: '', tempNo: '', tempId: "", total: 0, isPostManage: true
     });
-
     const columns: TableColumnsType = [
       {
         title: '序号',
@@ -91,13 +131,17 @@ export default defineComponent({
         align: "center",
         customRender: item => `${formState.rows * (formState.page - 1) + item.index + 1}`
       },
-      {title: '模板编号', dataIndex: 'tempNo', key: 'tempNo', width:180,align:"center"},
-      {title: '模板名称', dataIndex: 'tempName', key: '1', width:300},
-      {title: '创建时间', dataIndex: 'createTime', key: '2', width: 180, customRender: ({record}) =>
-          record.createTime==null?"": (dayjs(record.createTime).format('YYYY-MM-DD HH:mm'))},
-      {title: '模板状态', dataIndex: 'status', key: '3', width: 100,align:"center", customRender: ({record}) =>
-          record.status==0?"正常":"禁用"},
-      {title: '备注', dataIndex: 'remark', key: '4',ellipsis: true},
+      {title: '模板编号', dataIndex: 'tempNo', key: 'tempNo', width: 180, align: "center"},
+      {title: '模板名称', dataIndex: 'tempName', key: '1', width: 300},
+      {
+        title: '创建时间', dataIndex: 'createTime', key: '2', width: 180, customRender: ({record}) =>
+          record.createTime == null ? "" : (dayjs(record.createTime).format('YYYY-MM-DD HH:mm'))
+      },
+      {
+        title: '模板状态', dataIndex: 'status', key: '3', width: 100, align: "center", customRender: ({record}) =>
+          record.status == 0 ? "正常" : "禁用"
+      },
+      {title: '备注', dataIndex: 'remark', key: '4', ellipsis: true},
       {title: '操作', key: 'operation', width: 120, align: "center"},
     ];
 
@@ -154,15 +198,15 @@ export default defineComponent({
       route,
       expand,
       formRef,
-      formState,
-      columns,data,loading,selectedRowKeys,
+      formState, viewModel, dayjs,
+      columns, data, loading, selectedRowKeys,
       pagination,
       handleTableChange,
       onSelectChange,
       onFinish,
       loadData,
       add,
-      edit,onDelete
+      edit, onDelete
     };
   },
   created() {
@@ -174,3 +218,25 @@ export default defineComponent({
   }
 });
 </script>
+<style lang="less" scoped>
+.ant-card-actions {
+  margin: 0;
+  padding: 0;
+  list-style: none;
+  background: #fafafa;
+  border-top: 1px solid #f0f0f0;
+}
+
+.col-text {
+  padding-right: 0px !important;
+  text-align: right;
+  font-weight: bold;
+}
+
+.col-content {
+  width: 200px;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+</style>

+ 4 - 0
vue/src/views/subject/detail.vue

@@ -84,6 +84,10 @@ export default defineComponent({
       },
       {title: '取数字典编码', dataIndex: 'dictionaryCode', key: 'dictionaryCode', align: "center"},
       {title: '显示排序', dataIndex: 'disOrder', key: 'disOrder', align: "center"},
+      {
+        title: '标签', dataIndex: 'tagList', key: 'tagList', align: "center", customRender: ({record}) =>
+          record.tagList == null ? "" : (record.tagList as []).join(",")
+      },
       {
         title: '是否关联字段', dataIndex: 'isForeignKey', key: 'isForeignKey', align: "center", customRender: ({record}) =>
           record.isForeignKey == "1" ? "是" : "否"

+ 2 - 2
vue/src/views/subject/model.ts

@@ -4,7 +4,7 @@ export interface Subject {
   tabName: string,
   isReferences: number | null,
   tabDesc: string,
-  execSql:string
+  execSql: string
 }
 
 export interface Subjectfield {
@@ -21,5 +21,5 @@ export interface Subjectfield {
   foreignKey: string,
   displayColumn: string,
   referencesTab: string,
-  tagList:[]
+  tagList: []
 }