Install VS2010 Chinese flagship version of Deepwater

2023-01-20   ES  




    <!-When the project is packaged, the*.xml file in the java directory will also be packed->


package com.indi.srb.core.pojo.dto;

public class ExcelDictDTO {
    // ExcelProperty Note
    // When writing, you will write to Excel's head,
    // When reading, it will automatically read the corresponding attribute according to the name of the header
    private Long id;

    @ExcelProperty("Upper Id")
    private Long parentId;

    private String name;

    private Integer value;

    private String dictCode;

    void insertBatch(List<ExcelDictDTO> list);


	<insert id="insertBatch">
		insert into dict(
		) values
		<foreach collection="list" item="item" index="index" separator=",">

com.indi.srb.corePackage created belowlistenerbag

package com.indi.srb.core.listener;

public class ExcelDictDTOListener extends AnalysisEventListener<ExcelDictDTO> {
    private DictMapper dictMapper;
    List<ExcelDictDTO> list = new ArrayList<>();    // data list
    // Storage data every 5 records
    private static final int BATCH_COUNT = 5;

    public ExcelDictDTOListener(DictMapper dictMapper) {
        this.dictMapper = dictMapper;

    public void invoke(ExcelDictDTO excelDictDTO, AnalysisContext analysisContext) {
   "Analysis of a piece of data: {}", excelDictDTO);

        // Stock the data into the data list
        if (list.size() >= BATCH_COUNT) {

    private void saveData() {
   "{} Data is stored to the database", list.size());
        // Call the Save method of the mapper layer: Save list object
        dictMapper.insertBatch(list);"{} Data Storage to Database success", list.size());

    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        // When the last remaining record is insufficient BATCH_COUNT, finally stored in one -time
        saveData();"All data analysis is complete!");

    void importData(InputStream inputStream);

    // Once the introduction fails halfway, roll back the data directly
    @Transactional(rollbackFor = Exception.class)
    public void importData(InputStream inputStream) {
   , ExcelDictDTO.class, new ExcelDictDTOListener(baseMapper)).sheet().doRead();"Excel import success");

adminPackage created

@Api(tags = "Data Dictionary Management")
public class AdminDictController {
    DictService dictService;

    @ApiOperation("Batch import of data data")
    public R batchImport(
            @ApiParam(value = "Excel Data Dictionary File", required = true)
            @RequestParam("file") MultipartFile file){
        try {
            InputStream inputStream = file.getInputStream();
            return R.ok().setMessage("Data dictionary batch import success");
        } catch (IOException e) {
            throw new BusinessException(ResponseEnum.UPLOAD_ERROR, e);


    path: '/core',
    component: Layout,
    redirect: '/core/dict/list',
    name: 'coreDict',
    meta: {
     title: 'System settings', icon: 'el-icon-setting' },
    alwaysShow: true,
    children: [
        path: 'dict/list',
        name: 'Data Dictionary',
        component: () => import('@/views/core/dict/list'),
        meta: {
     title: 'Data Dictionary' }


  <div class="app-container">
    <div style="margin-bottom: 10px;">
        @click="dialogVisible = true"
      >Import Excel</el-button>

    <el-dialog title="Data Dictionary Import" :visible.sync="dialogVisible" width="30%">
        <el-form-item label="Please select Excel file">
            :action="BASE_API + '/admin/core/dict/import'"
            <el-button size="small" type="primary">Click to upload</el-button>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">Cancel</el-button>

export default {
  // Define data
  data() {
    return {
      dialogVisible: false, // Whether the file upload dialog box is displayed
      BASE_API: process.env.VUE_APP_BASE_API // Get the rear end interface address

  methods: {
    // When uploading more files than one file
    fileUploadExceed() {
      this.$message.warning('Only one file' can be selected ')

    // The successful recovery with the server communication with the server
    fileUploadSuccess(response) {
      if (response.code === 0) {
        // business success
        this.$message.success(data import successful ')
        this.dialogVisible = false
      } else {
        // business failure

    // Capsule of failed communication with the server
    fileUploadError(error) {
      this.$message.error('data import failed')

    List<ExcelDictDTO> dictListData();

    public List<ExcelDictDTO> dictListData() {
        List<Dict> dictList = baseMapper.selectList(null);
        ArrayList<ExcelDictDTO> excelDictDTOList = new ArrayList<>(dictList.size());
        dictList.forEach(dict -> {
            ExcelDictDTO excelDictDTO = new ExcelDictDTO();
        return excelDictDTOList;

    @ApiOperation("Batch Export of Data")
    public void export(HttpServletResponse response) {
        try {
            // Pay attention to the use of Swagger to cause various problems here, please use the browser or postman directly
            // Here Urlencoder.encode can prevent Chinese garbled. Of course, it has nothing to do with EasyExcel
            String fileName = URLEncoder.encode("mydict", "UTF-8").replaceAll("\\+", "%20");
            response.setHeader("Content-disposition", "attachment;filename*=mydict.xlsx");
            // Mainly this place
            EasyExcel.write(response.getOutputStream(), ExcelDictDTO.class).sheet().doWrite(dictService.dictListData());
        } catch (IOException e) {
            // export_data_error (104, "data export failure"),
            throw new BusinessException(ResponseEnum.EXPORT_DATA_ERROR, e);

      >Export Excel</el-button>  

Add Excel data export method to Methods

    // Excel data export
    exportData() {
      // Because the export interface of the back end is refreshing, we need to let the browser refresh,
      // So you cannot use Axios to send ordinary requests. You need to use the following method to send a request
      window.location.href = this.BASE_API + '/admin/core/dict/export'

Dict.javaAdd attributes

    @ApiModelProperty(value = "Whether it contains sub -nodes")
    @TableField(exist = false)	// ignore this column in the database table
    private boolean hasChildren;

	List<Dict> listByParentId(Long parentId);

    public List<Dict> listByParentId(Long parentId) {
        QueryWrapper<Dict> queryWrapper = new QueryWrapper<Dict>().eq("parent_id",parentId);
        List<Dict> dictList = baseMapper.selectList(queryWrapper);
        // Fill the Haschildren field
        dictList.forEach(dict -> {
            boolean hasChildren = this.hasChildren(dict.getId());
        return dictList;
      * Determine whether the node where the current ID is located has a sub -node 
    private boolean hasChildren(Long id) {
        QueryWrapper<Dict> queryWrapper = new QueryWrapper<Dict>().eq("parent_id",id);
        Integer count = baseMapper.selectCount(queryWrapper);
        if(count.intValue() > 0) {
            return true;
        return false;

      * Scheme 2: delay loading 
      * No need to return the data to the nested data in the back end, but it is necessary to define the Boolean attribute Haschildren, which means whether the current node contains sub -data 
      * If Haschildren is true, it means that the current node contains sub -data 
      * If Haschildren is false, it means that the current node does not contain sub -data 
      * If the current node contains sub -data, then when you click on the current node, you need to load the child data through the load method 
	@ApiOperation("List of Data of Sub -Node for Surface ID")
    public R listByParentId(
        @ApiParam(value = "superior node ID", required = true)
        @PathVariable Long parentId) {
        List<Dict> dictList = dictService.listByParentId(parentId);
        return R.ok().data("list", dictList);


import request from '@/utils/request'
export default {
  listByParentId(parentId) {
    return request({
      url: `/admin/core/dict/listByParentId/${
      method: 'get'


Put it to the previously written</el-dialog>closed tag below

    <el-table :data="list" border row-key="id" lazy :load="load">
      <el-table-column label="Name" align="left" prop="name" />
      <el-table-column label="encoding" prop="dictCode" />
      <el-table-column label="value" align="left" prop="value" />

First import Dictapi

import dictApi from '@/api/core/dict'

Data List of Data Dictionary

list: [] // Data dictionary list

METHODS adds a new method

    // Call the API layer to get the 1 -level menu data
    fetchData() {
      dictApi.listByParentId(1).then(response => {
        this.list =

    // The method of delaying the loading child node
    load(tree, treeNode, resolve) {
      dictApi.listByParentId( => {
        // Responsible for putting the sub -node data in the expanded list

initialization call

  created() {

Data Refresh the data list of the page after importing


Related Posts

MFC+OpenCV3.3.1+Display image video+water level recognition

python2 console shows garbled and saved file garbled Gu Ying

UNI-APP network request packaging and login authorization

Software construct LAB5 error use guide ()

Install VS2010 Chinese flagship version of Deepwater

Random Posts

02-title, paragraph, code Sismphus

OPENCV training classifier Make XML document

distributed storage minio

html -mobile terminal

leetcode questions 145. The post -order of binary tree traversed Bonbon