Prechádzať zdrojové kódy

数据字典初始化

vincent 3 rokov pred
rodič
commit
0132e50597

+ 5 - 0
server/pom.xml

@@ -51,6 +51,11 @@
 			<artifactId>mybatis-spring-boot-starter</artifactId>
 			<version>1.3.2</version>
 		</dependency>
+        <dependency>
+            <groupId>com.alibaba.boot</groupId>
+            <artifactId>nacos-config-spring-boot-starter</artifactId>
+            <version>0.2.1</version>
+        </dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-aop</artifactId>

+ 2 - 0
server/src/main/java/edp/DavinciServerApplication.java

@@ -19,6 +19,7 @@
 
 package edp;
 
+import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -30,6 +31,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
         org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
 })
 @EnableScheduling
+@NacosPropertySource(dataId = "example", autoRefreshed = true)
 public class DavinciServerApplication {
 
     public static void main(String[] args) {

+ 235 - 0
server/src/main/java/edp/davinci/controller/DictController.java

@@ -0,0 +1,235 @@
+package edp.davinci.controller;
+
+import edp.core.annotation.AuthIgnore;
+import edp.core.annotation.CurrentUser;
+import edp.davinci.common.controller.BaseController;
+import edp.davinci.core.common.Constants;
+import edp.davinci.core.common.ResultMap;
+import edp.davinci.model.*;
+import edp.davinci.service.DictService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Api(value = "/dict", tags = "dict", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+@ApiResponses(@ApiResponse(code = 404, message = "dict not found"))
+@Slf4j
+@RestController
+@RequestMapping(value = Constants.BASE_API_PATH + "/dict", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+public class DictController extends BaseController
+{
+    @Autowired
+    private DictService dictService;
+
+    /**
+     * 获取字典类型列表
+     *
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "get dict type")
+    @GetMapping(value = "/dictTypes")
+    public ResponseEntity dictTypes(
+            HttpServletRequest request)
+    {
+        List<DictType> dictTypes = dictService.getDictType();
+        return ResponseEntity.ok(dictTypes);
+    }
+
+    /**
+     * 获取字典数据
+     *
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "get dict data")
+    @GetMapping(value = "/dictDatas")
+    public ResponseEntity dictDatas(@RequestParam String dictType,
+                                    HttpServletRequest request)
+    {
+        List<DictData> dictDataList = dictService.getDictData(dictType);
+        return ResponseEntity.ok(dictDataList);
+    }
+
+    /**
+     * 创建字典类型
+     *
+     * @param dictType
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "create dict type", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @PostMapping(value = "/createDictType",consumes = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity createDictType(@RequestBody DictType dictType,
+                                         HttpServletRequest request)
+    {
+
+        DictType record = dictService.createDictType(dictType);
+
+        return ResponseEntity.ok(record);
+    }
+
+    /**
+     * 创建字典数据
+     *
+     * @param dictData
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "create dict data", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @PostMapping(value = "/createDictData",consumes = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity createDictData(@RequestBody DictData dictData,
+                                       HttpServletRequest request)
+    {
+
+        DictData record = dictService.createDictData(dictData);
+        return ResponseEntity.ok(record);
+    }
+
+    /**
+     * 获取dict type 信息
+     *
+     * @param id
+     * @param user
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "get dict type detail")
+    @GetMapping("/getDictTypeDetail/{id}")
+    public ResponseEntity getDictTypeDetail(@PathVariable Long id,
+                                          @ApiIgnore @CurrentUser User user,
+                                          HttpServletRequest request) {
+        if (invalidId(id)) {
+            ResultMap resultMap = new ResultMap(tokenUtils).failAndRefreshToken(request).message("Invalid project id");
+            return ResponseEntity.status(resultMap.getCode()).body(resultMap);
+        }
+        DictType sourceDetail = dictService.getDictTypeDetail(id);
+        return ResponseEntity.ok(sourceDetail);
+    }
+
+    /**
+     * 获取dict data 信息
+     *
+     * @param id
+     * @param user
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "get dict data detail")
+    @GetMapping("/getDictDataDetail/{id}")
+    public ResponseEntity getDictDataDetail(@PathVariable Long id,
+                                          HttpServletRequest request) {
+        DictData sourceDetail = dictService.getDictDataDetail(id);
+        return ResponseEntity.ok(sourceDetail);
+    }
+
+    /**
+     * 更新dictType
+     *
+     * @param id
+     * @param source
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "update a dictType", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @PutMapping(value = "/updateDictType/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity updateDictType(@PathVariable Long id,
+                                       @RequestBody DictType dictType,
+                                       HttpServletRequest request) {
+
+        if (invalidId(id) || !id.equals(dictType.getDictId())) {
+            ResultMap resultMap = new ResultMap(tokenUtils).failAndRefreshToken(request).message("Invalid dictType id");
+            return ResponseEntity.status(resultMap.getCode()).body(resultMap);
+        }
+
+        dictService.updateDictType(dictType);
+        return ResponseEntity.ok("update success");
+    }
+    /**
+     * 更新dictData
+     *
+     * @param id
+     * @param source
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "update a dictData", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @PutMapping(value = "/updateDictData/{id}", consumes = MediaType.APPLICATION_JSON_VALUE)
+    public ResponseEntity updateDictData(@PathVariable Long id,
+                                         @RequestBody DictData dictData,
+                                         HttpServletRequest request) {
+
+        if (invalidId(id) || !id.equals(dictData.getDictCode())) {
+            ResultMap resultMap = new ResultMap(tokenUtils).failAndRefreshToken(request).message("Invalid dictData id");
+            return ResponseEntity.status(resultMap.getCode()).body(resultMap);
+        }
+
+        dictService.updateDictData(dictData);
+        return ResponseEntity.ok("update success");
+    }
+
+    /**
+     * 删除dicttype
+     *
+     * @param id
+     * @param user
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "delete a dicttype")
+    @DeleteMapping("/deleteDictType/{id}")
+    public ResponseEntity deleteDictType(@PathVariable Long id,
+                                       HttpServletRequest request) {
+
+        if (invalidId(id)) {
+            ResultMap resultMap = new ResultMap(tokenUtils).failAndRefreshToken(request).message("Invalid dicttype id");
+            return ResponseEntity.status(resultMap.getCode()).body(resultMap);
+        }
+
+        dictService.deleteDictType(id);
+        return ResponseEntity.ok("delete success");
+    }
+
+    /**
+     * 删除dictdata
+     *
+     * @param id
+     * @param user
+     * @param request
+     * @return
+     */
+    @AuthIgnore
+    @ApiOperation(value = "delete a dictdata")
+    @DeleteMapping("/deleteDictData/{id}")
+    public ResponseEntity deleteDictData(@PathVariable Long id,
+                                         HttpServletRequest request) {
+
+        if (invalidId(id)) {
+            ResultMap resultMap = new ResultMap(tokenUtils).failAndRefreshToken(request).message("Invalid dictdata id");
+            return ResponseEntity.status(resultMap.getCode()).body(resultMap);
+        }
+
+        dictService.deleteDictData(id);
+        return ResponseEntity.ok("delete success");
+    }
+}

+ 63 - 0
server/src/main/java/edp/davinci/dao/DictDataMapper.java

@@ -0,0 +1,63 @@
+/*
+ * <<
+ *  Davinci
+ *  ==
+ *  Copyright (C) 2016 - 2019 EDP
+ *  ==
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *  >>
+ *
+ */
+
+package edp.davinci.dao;
+
+import edp.davinci.model.DictData;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public interface DictDataMapper
+{
+
+    int insert(DictData dictData);
+
+    @Delete({"delete from `dict_data` where id = #{id}"})
+    int deleteById(@Param("id") Long id);
+
+    @Select({"select * from `dict_data` where id = #{id}"})
+    DictData getById(@Param("id") Long id);
+
+    @Update({
+            "update `dict_data`",
+            "set `name` = #{name,jdbcType=VARCHAR},",
+            "`description` = #{description,jdbcType=VARCHAR},",
+            "`type` = #{type,jdbcType=VARCHAR},",
+            "`project_id` = #{projectId,jdbcType=BIGINT},",
+            "`config` = #{config,jdbcType=LONGVARCHAR},",
+            "`update_by` = #{updateBy,jdbcType=BIGINT},",
+            "`update_time` = #{updateTime,jdbcType=TIMESTAMP}",
+            "where id = #{id,jdbcType=BIGINT}"
+    })
+    int update(DictData dictData);
+
+    @Select({"select id from `dict_data` where  dict_name = #{dictName}"})
+    Long getByNameWithProjectId(@Param("dictName") String dictName);
+
+    @Select({"select * from `dict_data` where dict_type = #{dictType}"})
+    List<DictData> getDictDataList(@Param("dictType") String dictType);
+
+    int insertBatch(@Param("list") List<DictData> dictDataList);
+}

+ 79 - 0
server/src/main/java/edp/davinci/dao/DictTypeMapper.java

@@ -0,0 +1,79 @@
+/*
+ * <<
+ *  Davinci
+ *  ==
+ *  Copyright (C) 2016 - 2019 EDP
+ *  ==
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *  >>
+ *
+ */
+
+package edp.davinci.dao;
+
+import edp.davinci.model.DictType;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public interface DictTypeMapper
+{
+
+    int insert(DictType dictType);
+
+    @Delete({"delete from `dict_type` where id = #{id}"})
+    int deleteById(@Param("id") Long id);
+
+    @Select({"select * from `dict_type` where id = #{id}"})
+    DictType getById(@Param("id") Long id);
+
+    @Update({
+            "update `dict_type`",
+            "set `dict_name` = #{dictName,jdbcType=VARCHAR},",
+            "`dict_type` = #{dictType,jdbcType=VARCHAR},",
+            "`status` = #{type,jdbcType=BIGINT},",
+            "`remark` = #{remark,jdbcType=VARCHAR},",
+            "`update_by` = #{updateBy,jdbcType=BIGINT},",
+            "`update_time` = #{updateTime,jdbcType=TIMESTAMP}",
+            "where id = #{id,jdbcType=BIGINT}"
+    })
+    int update(DictType dictType);
+
+    @Select({"select id from `dict_type` where  dict_name = #{dictName}"})
+    Long getByNameWithProjectId(@Param("dictName") String dictName);
+
+    @Select({"select * from `dict_type`"})
+    List<DictType> getDictTypeList();
+
+    @Select({
+            "SELECT s.id, s.`name`, s.`type`, s.`config`,",
+            "	p.id 'project.id',",
+            "	p.`name` 'project.name',",
+            "	p.`description` 'project.description',",
+            "	p.`pic` 'project.pic',",
+            "	p.`user_id` 'project.userId',",
+            "	p.`org_id` 'project.orgId',",
+            "	p.`visibility` 'p.visibility'",
+            "FROM source s INNER JOIN project p on p.id = s.project_id",
+            "where s.id = #{sourceId}"
+    })
+//    SourceWithProject getSourceWithProjectById(@Param("sourceId") Long sourceId);
+
+    int insertBatch(@Param("list") List<DictType> dictTypeList);
+
+    @Delete({"delete from `dict_type` where project_id = #{projectId}"})
+    int deleteByProject(@Param("projectId") Long projectId);
+}

+ 5 - 0
server/src/main/java/edp/davinci/dto/dictDto/DictTypeInfo.java

@@ -0,0 +1,5 @@
+package edp.davinci.dto.dictDto;
+
+public class DictTypeInfo
+{
+}

+ 42 - 0
server/src/main/java/edp/davinci/model/DictData.java

@@ -0,0 +1,42 @@
+package edp.davinci.model;
+
+import edp.core.model.RecordInfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 字典数据
+ */
+@Slf4j
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DictData extends RecordInfo<DictData>
+{
+    private Long dictCode;
+
+    private Long dictSort;
+
+    private String dictLabel;
+
+    private String dictValue;
+
+    private String dictType;
+
+    private String cssClass;
+
+    private String listClass;
+
+    // Y=是,N=否
+    private String isDefault;
+
+    //0=正常,1=停用
+    private String status;
+
+    // 备注
+    private String remark;
+
+
+
+
+}

+ 29 - 0
server/src/main/java/edp/davinci/model/DictType.java

@@ -0,0 +1,29 @@
+package edp.davinci.model;
+
+import edp.core.model.RecordInfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 字典类型
+ */
+@Slf4j
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DictType extends RecordInfo<DictType>
+{
+    private Long dictId;
+
+    // 字典名称
+    private String dictName;
+
+    //字典类型
+    private String dictType;
+
+    // 字典状态 0=正常,1=停用
+    private String status;
+
+    // 备注
+    private String remark;
+}

+ 60 - 0
server/src/main/java/edp/davinci/service/DictService.java

@@ -0,0 +1,60 @@
+/*
+ * <<
+ *  Davinci
+ *  ==
+ *  Copyright (C) 2016 - 2019 EDP
+ *  ==
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *  >>
+ *
+ */
+
+package edp.davinci.service;
+
+import edp.core.exception.NotFoundException;
+import edp.core.exception.ServerException;
+import edp.core.exception.UnAuthorizedException;
+import edp.core.model.DBTables;
+import edp.core.model.TableInfo;
+import edp.davinci.core.service.CheckEntityService;
+import edp.davinci.dto.dictDto.DictTypeInfo;
+import edp.davinci.dto.sourceDto.*;
+import edp.davinci.model.DictData;
+import edp.davinci.model.DictType;
+import edp.davinci.model.Source;
+import edp.davinci.model.User;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+public interface DictService extends CheckEntityService {
+
+    List<DictType> getDictType();
+
+    List<DictData> getDictData(String dictType);
+
+    DictType createDictType(DictType dictType);
+
+    DictData createDictData(DictData dictData);
+
+    boolean deleteDictType(Long id);
+
+    boolean deleteDictData(Long id);
+
+    DictType updateDictType(DictType dictType);
+
+    DictData updateDictData(DictData dictData);
+
+    DictType getDictTypeDetail(Long id);
+
+    DictData getDictDataDetail(Long id);
+
+}

+ 131 - 0
server/src/main/java/edp/davinci/service/impl/DictServiceImpl.java

@@ -0,0 +1,131 @@
+package edp.davinci.service.impl;
+
+import edp.core.exception.NotFoundException;
+import edp.core.exception.ServerException;
+import edp.core.exception.UnAuthorizedException;
+import edp.davinci.dao.DictDataMapper;
+import edp.davinci.dao.DictTypeMapper;
+import edp.davinci.dto.dictDto.DictTypeInfo;
+import edp.davinci.model.DictData;
+import edp.davinci.model.DictType;
+import edp.davinci.model.User;
+import edp.davinci.service.DictService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Slf4j
+@Service("dictService")
+public class DictServiceImpl implements DictService
+{
+    @Autowired
+    private DictTypeMapper dictTypeMapper;
+
+    @Autowired
+    private DictDataMapper dictDataMapper;
+
+    public boolean isExist(String name, Long id)
+    {
+        Long sourceId = dictTypeMapper.getByNameWithProjectId(name);
+        if (null != id && null != sourceId)
+        {
+            return !id.equals(sourceId);
+        }
+        return null != sourceId && sourceId.longValue() > 0L;
+    }
+
+    @Override
+    public List<DictType> getDictType()
+    {
+
+        return dictTypeMapper.getDictTypeList();
+    }
+
+    @Override
+    public List<DictData> getDictData(String dictType)
+    {
+
+        return dictDataMapper.getDictDataList(dictType);
+    }
+
+    @Override
+    public DictType createDictType(DictType dictType)
+    {
+        dictTypeMapper.insert(dictType);
+
+        return dictType;
+    }
+
+    @Override
+    public DictData createDictData(DictData dictData)
+    {
+        dictDataMapper.insert(dictData);
+
+        return dictData;
+    }
+
+    @Override
+    public boolean deleteDictType(Long id)
+    {
+        int count = dictTypeMapper.deleteById(id);
+        DictType dictType = dictTypeMapper.getById(id);
+
+        List<DictData> dictDataList = dictDataMapper.getDictDataList(dictType.getDictType());
+        for (DictData dictData : dictDataList)
+        {
+            dictDataMapper.deleteById(dictData.getDictCode());
+        }
+        if (count > 0)
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean deleteDictData(Long id)
+    {
+        int count = dictDataMapper.deleteById(id);
+
+        if (count > 0)
+        {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public DictType updateDictType(DictType dictType)
+    {
+        dictTypeMapper.update(dictType);
+        return dictType;
+    }
+
+    @Override
+    public DictData updateDictData(DictData dictData)
+    {
+        dictDataMapper.update(dictData);
+        return dictData;
+    }
+
+    @Override
+    public DictType getDictTypeDetail(Long id)
+    {
+        return dictTypeMapper.getById(id);
+    }
+
+    @Override
+    public DictData getDictDataDetail(Long id)
+    {
+        return dictDataMapper.getById(id);
+    }
+
+    @Override
+    public boolean isExist(String name, Long id, Long scopeId)
+    {
+        return false;
+    }
+}

+ 2 - 2
server/src/main/resources/application.yml

@@ -22,9 +22,9 @@ file:
   userfiles-path: ${DAVINCI3_HOME:}/userfiles/
   web_resources: ${DAVINCI3_HOME}/davinci-ui/
   base-path: ${DAVINCI3_HOME}/lib/
-
-
 spring:
+  application:
+    name: taihu-analysis
   servlet:
     multipart:
       max-request-size: 1024MB

+ 51 - 0
server/src/main/resources/mybatis/mapper/DictDataMapper.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ <<
+  ~  Davinci
+  ~  ==
+  ~  Copyright (C) 2016 - 2019 EDP
+  ~  ==
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~        http://www.apache.org/licenses/LICENSE-2.0
+  ~   Unless required by applicable law or agreed to in writing, software
+  ~   distributed under the License is distributed on an "AS IS" BASIS,
+  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~   See the License for the specific language governing permissions and
+  ~   limitations under the License.
+  ~  >>
+  ~
+  -->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="edp.davinci.dao.DictDataMapper">
+    <insert id="insert" parameterType="edp.davinci.model.DictData">
+        <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id">
+            SELECT LAST_INSERT_ID() AS id
+        </selectKey>
+        insert into source
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            `name`,
+            <if test="description != null">
+                description,
+            </if>
+            `type`,
+            `project_id`,
+            `config`,
+            `create_by`,
+            `create_time`
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            #{name,jdbcType=VARCHAR},
+            <if test="description != null">
+                #{description,jdbcType=VARCHAR},
+            </if>
+            #{type,jdbcType=VARCHAR},
+            #{projectId,jdbcType=BIGINT},
+            #{config,jdbcType=LONGVARCHAR},
+            #{createBy,jdbcType=BIGINT},
+            #{createTime,jdbcType=TIMESTAMP}
+        </trim>
+    </insert>
+</mapper>

+ 54 - 0
server/src/main/resources/mybatis/mapper/DictTypeMapper.xml

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ <<
+  ~  Davinci
+  ~  ==
+  ~  Copyright (C) 2016 - 2019 EDP
+  ~  ==
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~        http://www.apache.org/licenses/LICENSE-2.0
+  ~   Unless required by applicable law or agreed to in writing, software
+  ~   distributed under the License is distributed on an "AS IS" BASIS,
+  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~   See the License for the specific language governing permissions and
+  ~   limitations under the License.
+  ~  >>
+  ~
+  -->
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="edp.davinci.dao.DictTypeMapper">
+    <insert id="insert" parameterType="edp.davinci.model.DictData">
+        <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="dictCode">
+            SELECT LAST_INSERT_ID() AS dict_code
+        </selectKey>
+        insert into source
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            `dict_sort`,
+            `dict_label`,
+            `dict_value`,
+            `dict_type`,
+            `cssClass`,
+            `listClass`,
+            `isDefault`,
+            `remark`,
+            `status`,
+            `create_by`,
+            `create_time`
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            #{dictSort,jdbcType=BIGINT},
+            #{dictLable,jdbcType=VARCHAR},
+            #{dictValue,jdbcType=VARCHAR},
+            #{dictType,jdbcType=VARCHAR},
+            #{cssClass,jdbcType=VARCHAR},
+            #{listClass,jdbcType=VARCHAR},
+            #{isDefault,jdbcType=VARCHAR},
+            #{remark,jdbcType=VARCHAR},
+            #{createBy,jdbcType=BIGINT},
+            #{createTime,jdbcType=TIMESTAMP}
+        </trim>
+    </insert>
+</mapper>