1
0
suochencheng 7 лет назад
Родитель
Сommit
878e882c2a
24 измененных файлов с 1673 добавлено и 311 удалено
  1. 2 1
      .gitignore
  2. 4 3
      awesome-admin.iml
  3. 12 5
      pom.xml
  4. 34 0
      src/main/java/com/izouma/awesomeadmin/dao/TableShouyiYaopinxinxiMapper.java
  5. 278 0
      src/main/java/com/izouma/awesomeadmin/dao/TableShouyiYaopinxinxiMapper.xml
  6. 2 1
      src/main/java/com/izouma/awesomeadmin/dao/TestAaaMapper.java
  7. 41 32
      src/main/java/com/izouma/awesomeadmin/dao/TestAaaMapper.xml
  8. 10 0
      src/main/java/com/izouma/awesomeadmin/model/GenCode.java
  9. 104 0
      src/main/java/com/izouma/awesomeadmin/model/TableShouyiYaopinxinxi.java
  10. 14 5
      src/main/java/com/izouma/awesomeadmin/model/TestAaa.java
  11. 27 0
      src/main/java/com/izouma/awesomeadmin/service/TableShouyiYaopinxinxiService.java
  12. 137 0
      src/main/java/com/izouma/awesomeadmin/service/impl/TableShouyiYaopinxinxiServiceImpl.java
  13. 105 0
      src/main/java/com/izouma/awesomeadmin/util/PinYinUtil.java
  14. 19 2
      src/main/java/com/izouma/awesomeadmin/web/GenCodeController.java
  15. 112 0
      src/main/java/com/izouma/awesomeadmin/web/TableShouyiYaopinxinxiController.java
  16. 2 0
      src/main/java/com/izouma/codegenerator/GeneratorTool.java
  17. 124 0
      src/main/java/com/izouma/codegenerator/ReadTableGenerator.java
  18. 81 69
      src/main/resources/templates/MapperXmlSqlServerTemplate.vm
  19. 157 156
      src/main/vue/src/pages/GenCode.vue
  20. 96 0
      src/main/vue/src/pages/TableShouyiYaopinxinxi.vue
  21. 282 0
      src/main/vue/src/pages/TableShouyiYaopinxinxis.vue
  22. 2 16
      src/main/vue/src/pages/TestAaa.vue
  23. 16 16
      src/main/vue/src/pages/TestAaas.vue
  24. 12 5
      src/main/vue/src/router/index.js

+ 2 - 1
.gitignore

@@ -2,4 +2,5 @@
 .DS_Store
 .idea
 node_modules/
-/target
+/target
+./awesome-admin.iml

+ 4 - 3
awesome-admin.iml

@@ -55,7 +55,7 @@
     <orderEntry type="module-library">
       <library name="Maven: com.alibaba:jconsole:1.8.0">
         <CLASSES>
-          <root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/lib/jconsole.jar!/" />
+          <root url="jar://C:/Program Files/Java/jdk1.8.0_141/lib/jconsole.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES />
@@ -64,14 +64,14 @@
     <orderEntry type="module-library">
       <library name="Maven: com.alibaba:tools:1.8.0">
         <CLASSES>
-          <root url="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/lib/tools.jar!/" />
+          <root url="jar://C:/Program Files/Java/jdk1.8.0_141/lib/tools.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES />
       </library>
     </orderEntry>
     <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.30" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: com.microsoft.sqlserver:mssql-jdbc:6.4.0.jre8" level="project" />
+    <orderEntry type="library" name="Maven: com.microsoft.sqlserver:mssql-jdbc:6.4.0.jre8" level="project" />
     <orderEntry type="library" name="Maven: c3p0:c3p0:0.9.1.1" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.5.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.5.RELEASE" level="project" />
@@ -207,6 +207,7 @@
     <orderEntry type="library" name="Maven: com.thoughtworks.xstream:xstream:1.4" level="project" />
     <orderEntry type="library" name="Maven: net.sf.kxml:kxml2-min:2.3.0" level="project" />
     <orderEntry type="library" name="Maven: net.sf.dozer:dozer:5.5.1" level="project" />
+    <orderEntry type="library" name="Maven: com.belerweb:pinyin4j:2.5.1" level="project" />
     <orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.25-incubating" level="project" />
     <orderEntry type="library" name="Maven: com.ibeetl:beetl:2.7.5" level="project" />
     <orderEntry type="library" name="Maven: org.antlr:antlr4-runtime:4.2" level="project" />

+ 12 - 5
pom.xml

@@ -51,7 +51,7 @@
 
         <!-- jdbc driver setting -->
         <mysql.driver.version>5.1.30</mysql.driver.version>
-        <sqlserver.driver.version>4.0</sqlserver.driver.version>
+        <sqlserver.driver.version>4.0.0</sqlserver.driver.version>
         <oracle.driver.version>10.2.0.4.0</oracle.driver.version>
         <mssql.driver.version>1.3.1</mssql.driver.version>
 
@@ -281,9 +281,9 @@
             <version>${mysql.driver.version}</version>
         </dependency>
         <!--<dependency>-->
-        <!--<groupId>com.microsoft.sqlserver</groupId>-->
-        <!--<artifactId>sqljdbc4</artifactId>-->
-        <!--<version>${sqlserver.driver.version}</version>-->
+            <!--<groupId>com.microsoft.sqlserver</groupId>-->
+            <!--<artifactId>sqljdbc4</artifactId>-->
+            <!--<version>${sqlserver.driver.version}</version>-->
         <!--</dependency>-->
         <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4 -->
         <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
@@ -291,7 +291,6 @@
             <groupId>com.microsoft.sqlserver</groupId>
             <artifactId>mssql-jdbc</artifactId>
             <version>6.4.0.jre8</version>
-            <scope>test</scope>
         </dependency>
 
         <dependency>
@@ -633,6 +632,14 @@
             <version>${dozer.version}</version>
         </dependency>
 
+        <!-- https://mvnrepository.com/artifact/com.belerweb/pinyin4j -->
+        <dependency>
+            <groupId>com.belerweb</groupId>
+            <artifactId>pinyin4j</artifactId>
+            <version>2.5.1</version>
+        </dependency>
+
+
         <!-- template engine -->
         <dependency>
             <groupId>org.freemarker</groupId>

+ 34 - 0
src/main/java/com/izouma/awesomeadmin/dao/TableShouyiYaopinxinxiMapper.java

@@ -0,0 +1,34 @@
+package com.izouma.awesomeadmin.dao;
+
+import java.util.*;
+import com.izouma.awesomeadmin.datasource.DataSource;
+import org.springframework.stereotype.Repository;
+import com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi;
+
+
+/**
+*  Dao接口
+*/
+@DataSource("dataSourceSqlserver")
+@Repository("com.zoumaframe.dao.TableShouyiYaopinxinxiMapper")
+public interface TableShouyiYaopinxinxiMapper{
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(TableShouyiYaopinxinxi record);
+
+    TableShouyiYaopinxinxi selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(TableShouyiYaopinxinxi record);
+
+    List<TableShouyiYaopinxinxi> queryAllTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record);
+
+    List<TableShouyiYaopinxinxi> queryTableShouyiYaopinxinxiByPage(Map<String, Object> parameter);
+
+    int delete(String id);
+
+    TableShouyiYaopinxinxi queryTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record);
+
+    List<TableShouyiYaopinxinxi> query(TableShouyiYaopinxinxi record);
+}
+

+ 278 - 0
src/main/java/com/izouma/awesomeadmin/dao/TableShouyiYaopinxinxiMapper.xml

@@ -0,0 +1,278 @@
+<?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.izouma.awesomeadmin.dao.TableShouyiYaopinxinxiMapper">
+    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="药品编号" property="药品编号" jdbcType="VARCHAR"/>
+        <result column="药品名称" property="药品名称" jdbcType="VARCHAR"/>
+        <result column="计量单位" property="计量单位" jdbcType="VARCHAR"/>
+        <result column="规格" property="规格" jdbcType="VARCHAR"/>
+        <result column="主要成分" property="主要成分" jdbcType="VARCHAR"/>
+        <result column="有效成分" property="有效成分" jdbcType="VARCHAR"/>
+        <result column="单价" property="单价" jdbcType="DECIMAL"/>
+        <result column="生产厂家" property="生产厂家" jdbcType="VARCHAR"/>
+        <result column="药品制定部门" property="药品制定部门" jdbcType="VARCHAR"/>
+        <result column="FlagColumn" property="flagcolumn" jdbcType="INTEGER"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+                    ID,                    药品编号,                    药品名称,                    计量单位,                    规格,                    主要成分,                    有效成分,                    单价,                    生产厂家,                    药品制定部门,                    FlagColumn            </sql>
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
+        select
+        <include refid="Base_Column_List"/>
+        from Table_兽医_药品信息
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete from Table_兽医_药品信息
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into Table_兽医_药品信息
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="药品编号!= null">
+                药品编号,
+            </if>
+            <if test="药品名称!= null">
+                药品名称,
+            </if>
+            <if test="计量单位!= null">
+                计量单位,
+            </if>
+            <if test="规格!= null">
+                规格,
+            </if>
+            <if test="主要成分!= null">
+                主要成分,
+            </if>
+            <if test="有效成分!= null">
+                有效成分,
+            </if>
+            <if test="单价!= null">
+                单价,
+            </if>
+            <if test="生产厂家!= null">
+                生产厂家,
+            </if>
+            <if test="药品制定部门!= null">
+                药品制定部门,
+            </if>
+            <if test="flagcolumn!= null">
+                FlagColumn,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="药品编号 != null">
+                #{药品编号,jdbcType=VARCHAR},
+            </if>
+            <if test="药品名称 != null">
+                #{药品名称,jdbcType=VARCHAR},
+            </if>
+            <if test="计量单位 != null">
+                #{计量单位,jdbcType=VARCHAR},
+            </if>
+            <if test="规格 != null">
+                #{规格,jdbcType=VARCHAR},
+            </if>
+            <if test="主要成分 != null">
+                #{主要成分,jdbcType=VARCHAR},
+            </if>
+            <if test="有效成分 != null">
+                #{有效成分,jdbcType=VARCHAR},
+            </if>
+            <if test="单价 != null">
+                #{单价,jdbcType=DECIMAL},
+            </if>
+            <if test="生产厂家 != null">
+                #{生产厂家,jdbcType=VARCHAR},
+            </if>
+            <if test="药品制定部门 != null">
+                #{药品制定部门,jdbcType=VARCHAR},
+            </if>
+            <if test="flagcolumn != null">
+                #{flagcolumn,jdbcType=INTEGER},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi">
+        update Table_兽医_药品信息
+        <set>
+            <if test="药品编号 != null">
+                药品编号= #{药品编号,jdbcType=VARCHAR},
+            </if>
+            <if test="药品名称 != null">
+                药品名称= #{药品名称,jdbcType=VARCHAR},
+            </if>
+            <if test="计量单位 != null">
+                计量单位= #{计量单位,jdbcType=VARCHAR},
+            </if>
+            <if test="规格 != null">
+                规格= #{规格,jdbcType=VARCHAR},
+            </if>
+            <if test="主要成分 != null">
+                主要成分= #{主要成分,jdbcType=VARCHAR},
+            </if>
+            <if test="有效成分 != null">
+                有效成分= #{有效成分,jdbcType=VARCHAR},
+            </if>
+            <if test="单价 != null">
+                单价= #{单价,jdbcType=DECIMAL},
+            </if>
+            <if test="生产厂家 != null">
+                生产厂家= #{生产厂家,jdbcType=VARCHAR},
+            </if>
+            <if test="药品制定部门 != null">
+                药品制定部门= #{药品制定部门,jdbcType=VARCHAR},
+            </if>
+            <if test="flagcolumn != null">
+                FlagColumn= #{flagcolumn,jdbcType=INTEGER},
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+    <select id="queryTableShouyiYaopinxinxiByPage" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi">
+        select
+        <include refid="Base_Column_List"/>
+        from Table_兽医_药品信息
+        <where>
+            and FlagColumn = 0
+            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
+                and ID = #{record.id}
+            </if>
+            <if test="record.药品编号 != null and !&quot;&quot;.equals(record.药品编号)">
+                and 药品编号 = #{record.药品编号}
+            </if>
+            <if test="record.药品名称 != null and !&quot;&quot;.equals(record.药品名称)">
+                and 药品名称 = #{record.药品名称}
+            </if>
+            <if test="record.计量单位 != null and !&quot;&quot;.equals(record.计量单位)">
+                and 计量单位 = #{record.计量单位}
+            </if>
+            <if test="record.规格 != null and !&quot;&quot;.equals(record.规格)">
+                and 规格 = #{record.规格}
+            </if>
+            <if test="record.主要成分 != null and !&quot;&quot;.equals(record.主要成分)">
+                and 主要成分 = #{record.主要成分}
+            </if>
+            <if test="record.有效成分 != null and !&quot;&quot;.equals(record.有效成分)">
+                and 有效成分 = #{record.有效成分}
+            </if>
+            <if test="record.单价 != null and !&quot;&quot;.equals(record.单价)">
+                and 单价 = #{record.单价}
+            </if>
+            <if test="record.生产厂家 != null and !&quot;&quot;.equals(record.生产厂家)">
+                and 生产厂家 = #{record.生产厂家}
+            </if>
+            <if test="record.药品制定部门 != null and !&quot;&quot;.equals(record.药品制定部门)">
+                and 药品制定部门 = #{record.药品制定部门}
+            </if>
+            <if test="record.flagcolumn != null and !&quot;&quot;.equals(record.flagcolumn)">
+                and FlagColumn = #{record.flagcolumn}
+            </if>
+        </where>
+        order by id desc
+    </select>
+    <select id="queryAllTableShouyiYaopinxinxi" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi">
+        select
+        <include refid="Base_Column_List"/>
+        from Table_兽医_药品信息
+        <where>
+            and FlagColumn = 0
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and ID = #{id}
+            </if>
+            <if test="药品编号 != null and !&quot;&quot;.equals(药品编号)">
+                and 药品编号 = #{药品编号}
+            </if>
+            <if test="药品名称 != null and !&quot;&quot;.equals(药品名称)">
+                and 药品名称 = #{药品名称}
+            </if>
+            <if test="计量单位 != null and !&quot;&quot;.equals(计量单位)">
+                and 计量单位 = #{计量单位}
+            </if>
+            <if test="规格 != null and !&quot;&quot;.equals(规格)">
+                and 规格 = #{规格}
+            </if>
+            <if test="主要成分 != null and !&quot;&quot;.equals(主要成分)">
+                and 主要成分 = #{主要成分}
+            </if>
+            <if test="有效成分 != null and !&quot;&quot;.equals(有效成分)">
+                and 有效成分 = #{有效成分}
+            </if>
+            <if test="单价 != null and !&quot;&quot;.equals(单价)">
+                and 单价 = #{单价}
+            </if>
+            <if test="生产厂家 != null and !&quot;&quot;.equals(生产厂家)">
+                and 生产厂家 = #{生产厂家}
+            </if>
+            <if test="药品制定部门 != null and !&quot;&quot;.equals(药品制定部门)">
+                and 药品制定部门 = #{药品制定部门}
+            </if>
+            <if test="flagcolumn != null and !&quot;&quot;.equals(flagcolumn)">
+                and FlagColumn = #{flagcolumn}
+            </if>
+        </where>
+        order by id desc
+    </select>
+    <select id="queryTableShouyiYaopinxinxi" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi">
+        select top 1
+        <include refid="Base_Column_List"/>
+        from Table_兽医_药品信息
+        <where>
+            and FlagColumn = 0
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and ID = #{id}
+            </if>
+            <if test="药品编号 != null and !&quot;&quot;.equals(药品编号)">
+                and 药品编号 = #{药品编号}
+            </if>
+            <if test="药品名称 != null and !&quot;&quot;.equals(药品名称)">
+                and 药品名称 = #{药品名称}
+            </if>
+            <if test="计量单位 != null and !&quot;&quot;.equals(计量单位)">
+                and 计量单位 = #{计量单位}
+            </if>
+            <if test="规格 != null and !&quot;&quot;.equals(规格)">
+                and 规格 = #{规格}
+            </if>
+            <if test="主要成分 != null and !&quot;&quot;.equals(主要成分)">
+                and 主要成分 = #{主要成分}
+            </if>
+            <if test="有效成分 != null and !&quot;&quot;.equals(有效成分)">
+                and 有效成分 = #{有效成分}
+            </if>
+            <if test="单价 != null and !&quot;&quot;.equals(单价)">
+                and 单价 = #{单价}
+            </if>
+            <if test="生产厂家 != null and !&quot;&quot;.equals(生产厂家)">
+                and 生产厂家 = #{生产厂家}
+            </if>
+            <if test="药品制定部门 != null and !&quot;&quot;.equals(药品制定部门)">
+                and 药品制定部门 = #{药品制定部门}
+            </if>
+            <if test="flagcolumn != null and !&quot;&quot;.equals(flagcolumn)">
+                and FlagColumn = #{flagcolumn}
+            </if>
+
+        </where>
+    </select>
+    <update id="delete">
+        UPDATE Table_兽医_药品信息 SET FlagColumn = 1
+        <where>
+            AND id = #{id}
+        </where>
+    </update>
+    <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi">
+        select
+        <include refid="Base_Column_List"/>
+        from Table_兽医_药品信息
+        <where>
+            and FlagColumn = 0
+        </where>
+        order by id desc
+    </select>
+</mapper>
+

+ 2 - 1
src/main/java/com/izouma/awesomeadmin/dao/TestAaaMapper.java

@@ -1,7 +1,7 @@
 package com.izouma.awesomeadmin.dao;
 
 import java.util.*;
-
+import com.izouma.awesomeadmin.datasource.DataSource;
 import org.springframework.stereotype.Repository;
 import com.izouma.awesomeadmin.model.TestAaa;
 
@@ -9,6 +9,7 @@ import com.izouma.awesomeadmin.model.TestAaa;
 /**
 *  Dao接口
 */
+@DataSource("dataSourceSqlserver")
 @Repository("com.zoumaframe.dao.TestAaaMapper")
 public interface TestAaaMapper{
 

+ 41 - 32
src/main/java/com/izouma/awesomeadmin/dao/TestAaaMapper.xml

@@ -4,10 +4,11 @@
     <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.TestAaa" >
                 <id column="id" property="id" jdbcType="INTEGER" />
                                         <result column="del_flag" property="delFlag" jdbcType="CHAR" />
-                                <result column="name_test" property="nameTest" jdbcType="VARCHAR" />
+                                <result column="test_name" property="testName" jdbcType="VARCHAR" />
+                                <result column="remark" property="remark" jdbcType="VARCHAR" />
             </resultMap>
     <sql id="Base_Column_List" >
-            id,            del_flag,            name_test        </sql>
+            id,            del_flag,            test_name,            remark        </sql>
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
         select
         <include refid="Base_Column_List" />
@@ -21,41 +22,41 @@
     <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.TestAaa" useGeneratedKeys="true" keyProperty="id">
         insert into test_aaa
         <trim prefix="(" suffix=")" suffixOverrides="," >
-                <if test="id!= null" >
-                id,
-            </if>
-                <if test="delFlag!= null" >
+                                    <if test="delFlag!= null" >
                 del_flag,
             </if>
-                <if test="nameTest!= null" >
-                name_test,
+                                <if test="testName!= null" >
+                test_name,
             </if>
-            </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-                    <if test="id != null" >
-                #{id,jdbcType=INTEGER},
+                                <if test="remark!= null" >
+                remark,
             </if>
-                    <if test="delFlag != null" >
+                    </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+                                                    <if test="delFlag != null" >
                 #{delFlag,jdbcType=CHAR},
             </if>
-                    <if test="nameTest != null" >
-                #{nameTest,jdbcType=VARCHAR},
+                                            <if test="testName != null" >
+                #{testName,jdbcType=VARCHAR},
             </if>
-                </trim>
+                                            <if test="remark != null" >
+                #{remark,jdbcType=VARCHAR},
+            </if>
+                            </trim>
     </insert>
     <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.TestAaa" >
         update test_aaa
         <set >
-                    <if test="id != null" >
-               id= #{id,jdbcType=INTEGER},
-            </if>
-                     <if test="delFlag != null" >
+                                                     <if test="delFlag != null" >
                del_flag= #{delFlag,jdbcType=CHAR},
             </if>
-                     <if test="nameTest != null" >
-               name_test= #{nameTest,jdbcType=VARCHAR},
+                                             <if test="testName != null" >
+               test_name= #{testName,jdbcType=VARCHAR},
             </if>
-                 </set>
+                                             <if test="remark != null" >
+               remark= #{remark,jdbcType=VARCHAR},
+            </if>
+                             </set>
         where id = #{id,jdbcType=INTEGER}
     </update>
     <select id="queryTestAaaByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestAaa">
@@ -68,8 +69,11 @@
                      <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
                 and  del_flag = #{record.delFlag}
             </if>
-                     <if test="record.nameTest != null and !&quot;&quot;.equals(record.nameTest)">
-                and  name_test = #{record.nameTest}
+                     <if test="record.testName != null and !&quot;&quot;.equals(record.testName)">
+                and  test_name = #{record.testName}
+            </if>
+                     <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
+                and  remark = #{record.remark}
             </if>
                  </where>
         order by id desc
@@ -84,14 +88,17 @@
                     <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                 and  del_flag = #{delFlag}
             </if>
-                    <if test="nameTest != null and !&quot;&quot;.equals(nameTest)">
-                and  name_test = #{nameTest}
+                    <if test="testName != null and !&quot;&quot;.equals(testName)">
+                and  test_name = #{testName}
+            </if>
+                    <if test="remark != null and !&quot;&quot;.equals(remark)">
+                and  remark = #{remark}
             </if>
                 </where>
         order by id desc
     </select>
     <select id="queryTestAaa" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestAaa">
-        select <include refid="Base_Column_List"/> from test_aaa
+        select top 1 <include refid="Base_Column_List"/> from test_aaa
         <where>
             and del_flag = 'N'
                     <if test="id != null and !&quot;&quot;.equals(id)">
@@ -100,12 +107,14 @@
                      <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                 and del_flag = #{delFlag}
             </if>
-                     <if test="nameTest != null and !&quot;&quot;.equals(nameTest)">
-                and name_test = #{nameTest}
+                     <if test="testName != null and !&quot;&quot;.equals(testName)">
+                and test_name = #{testName}
+            </if>
+                     <if test="remark != null and !&quot;&quot;.equals(remark)">
+                and remark = #{remark}
             </if>
          
         </where>
-        LIMIT 1
     </select>
     <update id="delete">
         UPDATE test_aaa SET del_flag = 'Y'
@@ -117,7 +126,7 @@
         select <include refid="Base_Column_List"/> from test_aaa
         <where>
             and del_flag = 'N'
-                                                                                                        </where>
+                                                                                                                                    </where>
         order by id desc
     </select>
 </mapper>

+ 10 - 0
src/main/java/com/izouma/awesomeadmin/model/GenCode.java

@@ -77,6 +77,8 @@ public class GenCode {
     private List<TableField> fields;    // 表字段
     private TableField primaryField; //主键字段
 
+    private Boolean readTable;
+
     public List<TableField> getFields() {
         return fields;
     }
@@ -188,5 +190,13 @@ public class GenCode {
     public void setDataBaseType(String dataBaseType) {
         this.dataBaseType = dataBaseType;
     }
+
+    public Boolean getReadTable() {
+        return readTable;
+    }
+
+    public void setReadTable(Boolean readTable) {
+        this.readTable = readTable;
+    }
 }
 

+ 104 - 0
src/main/java/com/izouma/awesomeadmin/model/TableShouyiYaopinxinxi.java

@@ -0,0 +1,104 @@
+package com.izouma.awesomeadmin.model;
+
+import java.math.BigDecimal;
+import java.util.*;
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+
+@JsonAutoDetect
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class TableShouyiYaopinxinxi{
+    private Integer id;
+    private String 药品编号;
+    private String 药品名称;
+    private String 计量单位;
+    private String 规格;
+    private String 主要成分;
+    private String 有效成分;
+    private BigDecimal 单价;
+    private String 生产厂家;
+    private String 药品制定部门;
+    private Integer flagcolumn;
+
+    public Integer getId(){
+        return this.id;
+    }
+
+    public void setId(Integer id){
+        this.id = id;
+    }
+    public String get药品编号(){
+        return this.药品编号;
+    }
+
+    public void set药品编号(String 药品编号){
+        this.药品编号 = 药品编号;
+    }
+    public String get药品名称(){
+        return this.药品名称;
+    }
+
+    public void set药品名称(String 药品名称){
+        this.药品名称 = 药品名称;
+    }
+    public String get计量单位(){
+        return this.计量单位;
+    }
+
+    public void set计量单位(String 计量单位){
+        this.计量单位 = 计量单位;
+    }
+    public String get规格(){
+        return this.规格;
+    }
+
+    public void set规格(String 规格){
+        this.规格 = 规格;
+    }
+    public String get主要成分(){
+        return this.主要成分;
+    }
+
+    public void set主要成分(String 主要成分){
+        this.主要成分 = 主要成分;
+    }
+    public String get有效成分(){
+        return this.有效成分;
+    }
+
+    public void set有效成分(String 有效成分){
+        this.有效成分 = 有效成分;
+    }
+    public BigDecimal get单价(){
+        return this.单价;
+    }
+
+    public void set单价(BigDecimal 单价){
+        this.单价 = 单价;
+    }
+    public String get生产厂家(){
+        return this.生产厂家;
+    }
+
+    public void set生产厂家(String 生产厂家){
+        this.生产厂家 = 生产厂家;
+    }
+    public String get药品制定部门(){
+        return this.药品制定部门;
+    }
+
+    public void set药品制定部门(String 药品制定部门){
+        this.药品制定部门 = 药品制定部门;
+    }
+    public Integer getFlagcolumn(){
+        return this.flagcolumn;
+    }
+
+    public void setFlagcolumn(Integer flagcolumn){
+        this.flagcolumn = flagcolumn;
+    }
+
+
+}
+

+ 14 - 5
src/main/java/com/izouma/awesomeadmin/model/TestAaa.java

@@ -1,5 +1,6 @@
 package com.izouma.awesomeadmin.model;
 
+import java.util.*;
 import com.fasterxml.jackson.annotation.JsonAutoDetect;
 import com.fasterxml.jackson.annotation.JsonInclude;
 
@@ -9,7 +10,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 public class TestAaa{
     private Integer id;
     private String delFlag;
-    private String nameTest;
+    private String testName;
+    private String remark;
 
     public Integer getId(){
         return this.id;
@@ -25,12 +27,19 @@ public class TestAaa{
     public void setDelFlag(String delFlag){
         this.delFlag = delFlag;
     }
-    public String getNameTest(){
-        return this.nameTest;
+    public String getTestName(){
+        return this.testName;
     }
 
-    public void setNameTest(String nameTest){
-        this.nameTest = nameTest;
+    public void setTestName(String testName){
+        this.testName = testName;
+    }
+    public String getRemark(){
+        return this.remark;
+    }
+
+    public void setRemark(String remark){
+        this.remark = remark;
     }
 
 

+ 27 - 0
src/main/java/com/izouma/awesomeadmin/service/TableShouyiYaopinxinxiService.java

@@ -0,0 +1,27 @@
+package com.izouma.awesomeadmin.service;
+
+import java.util.*;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi;
+
+
+/**
+*  service接口类
+*/
+public interface TableShouyiYaopinxinxiService{
+
+    List<TableShouyiYaopinxinxi> getTableShouyiYaopinxinxiList(TableShouyiYaopinxinxi record);
+
+    List<TableShouyiYaopinxinxi> getTableShouyiYaopinxinxiByPage(Page page, TableShouyiYaopinxinxi record);
+
+    TableShouyiYaopinxinxi getTableShouyiYaopinxinxiById(String id);
+
+    TableShouyiYaopinxinxi getTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record);
+
+    boolean createTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record);
+
+    boolean deleteTableShouyiYaopinxinxi(String id);
+
+    boolean updateTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record);
+}
+

+ 137 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/TableShouyiYaopinxinxiServiceImpl.java

@@ -0,0 +1,137 @@
+package com.izouma.awesomeadmin.service.impl;
+
+import java.util.*;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.izouma.awesomeadmin.constant.AppConstant;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi;
+import com.izouma.awesomeadmin.service.TableShouyiYaopinxinxiService;
+import com.izouma.awesomeadmin.dao.TableShouyiYaopinxinxiMapper;
+
+/**
+*  service接口实现类
+*/
+@Service
+public class TableShouyiYaopinxinxiServiceImpl implements TableShouyiYaopinxinxiService{
+
+    private static Logger logger = Logger.getLogger(TableShouyiYaopinxinxiServiceImpl.class);
+
+    @Autowired
+    private TableShouyiYaopinxinxiMapper tableShouyiYaopinxinxiMapper;
+
+    @Override
+    public List<TableShouyiYaopinxinxi> getTableShouyiYaopinxinxiList(TableShouyiYaopinxinxi record) {
+
+        logger.info("getTableShouyiYaopinxinxiList");
+        try {
+
+        return tableShouyiYaopinxinxiMapper.queryAllTableShouyiYaopinxinxi(record);
+        } catch (Exception e) {
+        logger.error("getTableShouyiYaopinxinxiList", e);
+        }
+
+        return null;
+    }
+    @Override
+    public List<TableShouyiYaopinxinxi> getTableShouyiYaopinxinxiByPage(Page page, TableShouyiYaopinxinxi record) {
+
+        logger.info("getTableShouyiYaopinxinxiByPage");
+        try {
+
+        Map<String, Object> parameter = new HashMap<String, Object>();
+        parameter.put("record", record);
+        parameter.put(AppConstant.PAGE, page);
+
+        return tableShouyiYaopinxinxiMapper.queryTableShouyiYaopinxinxiByPage(parameter);
+        } catch (Exception e) {
+        logger.error("getTableShouyiYaopinxinxiByPage", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public TableShouyiYaopinxinxi getTableShouyiYaopinxinxiById(String id) {
+
+        logger.info("getTableShouyiYaopinxinxiyId");
+        try {
+
+            return tableShouyiYaopinxinxiMapper.selectByPrimaryKey(Integer.valueOf(id));
+        } catch (Exception e) {
+        logger.error("getTableShouyiYaopinxinxiById", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public TableShouyiYaopinxinxi getTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record) {
+
+        logger.info("getTableShouyiYaopinxinxi");
+        try {
+
+            return tableShouyiYaopinxinxiMapper.queryTableShouyiYaopinxinxi(record);
+        } catch (Exception e) {
+        logger.error("getTableShouyiYaopinxinxi", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public boolean createTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record) {
+
+        logger.info("createTableShouyiYaopinxinxi");
+        try {
+
+            int updates = tableShouyiYaopinxinxiMapper.insertSelective(record);
+
+            if (updates > 0) {
+                 return true;
+            }
+        } catch (Exception e) {
+            logger.error("createTableShouyiYaopinxinxi", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean deleteTableShouyiYaopinxinxi(String id) {
+
+        logger.info("deleteTableShouyiYaopinxinxi");
+        try {
+
+             int updates = tableShouyiYaopinxinxiMapper.delete(id);
+
+            if (updates > 0) {
+                 return true;
+            }
+        } catch (Exception e) {
+             logger.error("deleteTableShouyiYaopinxinxi", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean updateTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record) {
+
+        logger.info("updateTableShouyiYaopinxinxi");
+        try {
+
+            int updates = tableShouyiYaopinxinxiMapper.updateByPrimaryKeySelective(record);
+
+            if (updates > 0) {
+                 return true;
+            }
+        } catch (Exception e) {
+             logger.error("updateTableShouyiYaopinxinxi", e);
+        }
+
+        return false;
+    }
+}
+

+ 105 - 0
src/main/java/com/izouma/awesomeadmin/util/PinYinUtil.java

@@ -0,0 +1,105 @@
+package com.izouma.awesomeadmin.util;
+
+import net.sourceforge.pinyin4j.PinyinHelper;
+import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
+import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
+import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
+import org.springframework.stereotype.Component;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * pinyin4j汉字转拼音工具类
+ *
+ * @author
+ */
+@Component
+public class PinYinUtil {
+
+
+    /**
+     * 对单个字进行转换
+     *
+     * @param pinYinStr 需转换的汉字字符串
+     * @return 拼音字符串数组
+     */
+    public static String getCharPinYin(char pinYinStr) {
+
+        if (!isContainChinese(String.valueOf(pinYinStr))) {
+            return String.valueOf(pinYinStr);
+        }
+        //pinyin4j格式类
+        HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
+        /*
+         * 设置需要转换的拼音格式
+         * 以天为例
+         * HanyuPinyinToneType.WITHOUT_TONE 转换为tian
+         * HanyuPinyinToneType.WITH_TONE_MARK 转换为tian1
+         * HanyuPinyinVCharType.WITH_U_UNICODE 转换为tiān
+         *
+         */
+
+        format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
+        //拼音字符串数组
+        String[] pinyin = null;
+
+        try {
+            //执行转换
+            pinyin = PinyinHelper.toHanyuPinyinStringArray(pinYinStr, format);
+
+        } catch (BadHanyuPinyinOutputFormatCombination e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        //pinyin4j规则,当转换的符串不是汉字,就返回null
+        if (pinyin == null) {
+            return null;
+        }
+
+        //多音字会返回一个多音字拼音的数组,pinyiin4j并不能有效判断该字的读音
+        return pinyin[0];
+    }
+
+    /**
+     * 对单个字进行转换
+     *
+     * @param pinYinStr
+     * @return
+     */
+    public static String getStringPinYin(String pinYinStr) {
+        StringBuffer sb = new StringBuffer();
+        String tempStr = null;
+        //循环字符串
+        for (int i = 0; i < pinYinStr.length(); i++) {
+
+            tempStr = getCharPinYin(pinYinStr.charAt(i));
+            if (tempStr == null) {
+                //非汉字直接拼接
+                sb.append(pinYinStr.charAt(i));
+            } else {
+                sb.append(tempStr);
+            }
+        }
+
+        return sb.toString();
+
+    }
+
+    /**
+     * 判断字符串中是否包含中文
+     *
+     * @param str 待校验字符串
+     * @return 是否为中文
+     * @warn 不能校验是否为中文标点符号
+     */
+    public static boolean isContainChinese(String str) {
+        Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
+        Matcher m = p.matcher(str);
+        if (m.find()) {
+            return true;
+        }
+        return false;
+    }
+}

+ 19 - 2
src/main/java/com/izouma/awesomeadmin/web/GenCodeController.java

@@ -4,6 +4,7 @@ import java.io.File;
 import java.util.*;
 
 import com.izouma.awesomeadmin.model.GenCode;
+import com.izouma.awesomeadmin.util.PinYinUtil;
 import com.izouma.codegenerator.*;
 import org.apache.commons.text.CaseUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -83,11 +84,27 @@ public class GenCodeController extends BaseController {
     @ResponseBody
     public Result save(@RequestBody GenCode record) {
         try {
-            record.setClassName(CaseUtils.toCamelCase(record.getTableName(), true, '_'));
+
+            String tableName = record.getTableName();
+
+            if (PinYinUtil.isContainChinese(tableName)) {
+                tableName = PinYinUtil.getStringPinYin(tableName);
+            }
+
+            record.setClassName(CaseUtils.toCamelCase(tableName, true, '_'));
+
+            if (record.getReadTable()) {
+                ReadTableGenerator.ReadTable(record);
+            }
+
+
+            GeneratorTool.getImports(record);
+
             ControllerGenerator.GenController(record);
-            if (record.getGenTable()) {
+            if (record.getGenTable() && !record.getReadTable()) {
                 TableGenerator.GenTable(record);
             }
+
             if (record.getGenClass()) {
                 ModelGenerator.GenModel(record);
                 ControllerGenerator.GenController(record);

+ 112 - 0
src/main/java/com/izouma/awesomeadmin/web/TableShouyiYaopinxinxiController.java

@@ -0,0 +1,112 @@
+package com.izouma.awesomeadmin.web;
+
+import java.util.*;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import com.izouma.awesomeadmin.constant.AppConstant;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.dto.Result;
+import com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi;
+import com.izouma.awesomeadmin.service.TableShouyiYaopinxinxiService;
+
+/**
+*  controller类
+*/
+@Controller
+@RequestMapping("/tableShouyiYaopinxinxi")
+public class TableShouyiYaopinxinxiController extends BaseController{
+
+    @Autowired
+    private TableShouyiYaopinxinxiService tableShouyiYaopinxinxiService;
+
+    /**
+    * <p>获取全部记录。</p>
+    */
+    @RequiresAuthentication
+    @RequestMapping(value = "/all", method = RequestMethod.GET)
+    @ResponseBody
+    public Result all(TableShouyiYaopinxinxi record) {
+        List<TableShouyiYaopinxinxi> pp = tableShouyiYaopinxinxiService.getTableShouyiYaopinxinxiList(record);
+        return new Result(true, pp);
+    }
+
+    /**
+    * <p>根据Id。</p>
+    */
+    @RequestMapping(value = "/getTableShouyiYaopinxinxi", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getTableShouyiYaopinxinxi(@RequestParam(required = false, value = "id") String id) {
+        TableShouyiYaopinxinxi data = tableShouyiYaopinxinxiService.getTableShouyiYaopinxinxiById(id);
+        return new Result(true, data);
+    }
+
+    /**
+    * <p>根据条件获取。</p>
+    */
+    @RequestMapping(value = "/getOne", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getOne(TableShouyiYaopinxinxi record) {
+        TableShouyiYaopinxinxi data = tableShouyiYaopinxinxiService.getTableShouyiYaopinxinxi(record);
+        return new Result(true, data);
+    }
+
+
+    /**
+    * <p>分页查询。</p>
+    */
+    @RequestMapping(value = "/page", method = RequestMethod.GET)
+    @ResponseBody
+    public Result page(Page page, TableShouyiYaopinxinxi record) {
+        Map<String, Object> result = new HashMap<>();
+
+        List<TableShouyiYaopinxinxi> pp =tableShouyiYaopinxinxiService.getTableShouyiYaopinxinxiByPage(page, record);
+
+        result.put(AppConstant.PAGE, page);
+        result.put("pp", pp);
+        return new Result(true, result);
+    }
+
+
+    /**
+    * <p>保存。</p>
+    */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ResponseBody
+    public Result save(TableShouyiYaopinxinxi record) {
+        boolean num = tableShouyiYaopinxinxiService.createTableShouyiYaopinxinxi(record);
+        if (num) {
+        return new Result(true, record.getId());
+        }
+        return new Result(false, "保存异常");
+    }
+
+    /**
+    * <p>更新信息。</p>
+    */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ResponseBody
+    public Result updateTableShouyiYaopinxinxi(TableShouyiYaopinxinxi record) {
+        boolean num = tableShouyiYaopinxinxiService.updateTableShouyiYaopinxinxi(record);
+        if (num) {
+        return new Result(true, "保存成功");
+        }
+        return new Result(false, "保存异常");
+    }
+
+    /**
+    * <p>删除。</p>
+    */
+    @RequestMapping(value = "/del", method = RequestMethod.POST)
+    @ResponseBody
+    public Result deleteTableShouyiYaopinxinxi(@RequestParam(required = true, value = "id") String id) {
+
+        boolean num = tableShouyiYaopinxinxiService.deleteTableShouyiYaopinxinxi(id);
+        if (num) {
+        return new Result(true, "删除成功");
+        }
+        return new Result(false, "删除异常");
+    }
+}
+

+ 2 - 0
src/main/java/com/izouma/codegenerator/GeneratorTool.java

@@ -65,6 +65,8 @@ public class GeneratorTool {
             return "INTEGER";
         } else if (jdbcType.equalsIgnoreCase("datetime")) {
             return "TIMESTAMP";
+        } else if (jdbcType.equalsIgnoreCase("nvarchar")) {
+            return "VARCHAR";
         }
         return jdbcType.toUpperCase();
     }

+ 124 - 0
src/main/java/com/izouma/codegenerator/ReadTableGenerator.java

@@ -0,0 +1,124 @@
+package com.izouma.codegenerator;
+
+import com.izouma.awesomeadmin.model.GenCode;
+import com.izouma.awesomeadmin.model.TableField;
+import com.izouma.awesomeadmin.util.PropertiesFileLoader;
+import org.apache.commons.lang.StringUtils;
+
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class ReadTableGenerator {
+
+    public static void ReadTable(GenCode model) throws Exception {
+        Connection conn = null;
+        try {
+
+            String[] colnames; // 列名数组
+            String[] colTypes; //列名类型数组
+            String[] colComments;//列名注释数组mybatis-generator-core
+
+            int[] colSizes; //列名大小数组
+
+            String PK_NAME = "id";//主键名
+
+            //查要生成实体类的表
+            String sql = "select * from " + model.getTableName();
+            PreparedStatement pStemt = null;
+
+            if ("Mysql".equals(model.getDataBaseType())) {
+                Class.forName("com.mysql.jdbc.Driver");
+                System.out.println("成功加载MySQL驱动!");
+
+                PropertiesFileLoader propertiesFileLoader = PropertiesFileLoader.getInstance();
+                propertiesFileLoader.getProperties("properties/jdbc.properties", "jdbc.url");
+
+                String url = propertiesFileLoader.getProperties("properties/jdbc.properties", "jdbc.url");
+                String user = propertiesFileLoader.getProperties("properties/jdbc.properties", "jdbc.username");
+                String password = propertiesFileLoader.getProperties("properties/jdbc.properties", "jdbc.password");
+                conn = DriverManager.getConnection(url, user, password);
+
+                System.out.println("成功连接到数据库!");
+            } else if ("SqlServer".equals(model.getDataBaseType())) {
+                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
+                System.out.println("成功加载SQLServer驱动!");
+
+                PropertiesFileLoader propertiesFileLoader = PropertiesFileLoader.getInstance();
+                propertiesFileLoader.getProperties("properties/jdbc.properties", "jdbc.url");
+
+                String url = propertiesFileLoader.getProperties("properties/jdbc.properties", "sqlserver.url");
+                String user = propertiesFileLoader.getProperties("properties/jdbc.properties", "sqlserver.user");
+                String password = propertiesFileLoader.getProperties("properties/jdbc.properties", "sqlserver.password");
+                conn = DriverManager.getConnection(url, user, password);
+            }
+
+
+            pStemt = conn.prepareStatement(sql);
+
+            ResultSetMetaData rsmd = pStemt.getMetaData();
+
+            ResultSet pkRSet = conn.getMetaData().getPrimaryKeys(conn.getCatalog().toUpperCase(),
+                    null, model.getTableName());
+
+            while (pkRSet.next()) {
+                System.out.println(pkRSet.getString("COLUMN_NAME"));
+                PK_NAME = pkRSet.getString("COLUMN_NAME");
+            }
+
+
+            int size = rsmd.getColumnCount();   //统计列
+            colComments = new String[size];
+            colnames = new String[size];
+            colTypes = new String[size];
+            colSizes = new int[size];
+            for (int i = 0; i < size; i++) {
+                colnames[i] = rsmd.getColumnName(i + 1);
+                colTypes[i] = rsmd.getColumnTypeName(i + 1);
+                colSizes[i] = rsmd.getColumnDisplaySize(i + 1);
+            }
+
+
+            if ("Mysql".equals(model.getDataBaseType())) {
+                //获取注释
+                ResultSet rs = pStemt.executeQuery("show full columns from " + model.getTableName());
+                int j = 0;
+                while (rs.next()) {
+                    colComments[j] = (rs.getString("Comment"));
+                    j++;
+                }
+            }
+            List<TableField> tableFields = new ArrayList<>();
+
+
+            for (int i = 0; i < colnames.length; i++) {
+                TableField tableField = new TableField();
+
+                tableField.setName(colnames[i]);
+                tableField.setJdbcType(colTypes[i]);
+                tableField.setNotNull(false);
+                tableField.setPrimaryKey(PK_NAME.equals(colnames[i]) ? true : false);
+                tableField.setAutoIncrease(PK_NAME.equals(colnames[i]) ? true : false);
+                tableField.setRemark((StringUtils.isNotEmpty(colComments[i]) ? colComments[i] : colnames[i]));
+                tableField.setShowInList(true);
+                tableField.setShowInForm("ID".equalsIgnoreCase(colnames[i]) ? false : true);
+                tableField.setFormType("singleLineText");
+
+                tableFields.add(tableField);
+            }
+
+            model.setFields(tableFields);
+
+            System.out.println("读取数据表成功");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            conn.close();
+        }
+
+    }
+
+}
+

+ 81 - 69
src/main/resources/templates/MapperXmlSqlServerTemplate.vm

@@ -1,111 +1,123 @@
 <?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.izouma.awesomeadmin.dao.${model.className}Mapper" >
-    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.${model.className}" >
-#foreach($field in $model.fields)
-        #if(${field.name}=='id')
-        <id column="id" property="id" jdbcType="INTEGER" />
-        #end
-        #if(${field.name}!='id')
-        <result column="${field.name}" property="$field.modelName" jdbcType="$field.sqlType" />
+<mapper namespace="com.izouma.awesomeadmin.dao.${model.className}Mapper">
+    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.${model.className}">
+        #foreach($field in $model.fields)
+            #if(${field.name}=='id'||${field.name}=='ID')
+                <id column="id" property="id" jdbcType="INTEGER"/>
+            #end
+            #if(${field.name}!='id'&&${field.name}!='ID')
+                <result column="${field.name}" property="$field.modelName" jdbcType="$field.sqlType"/>
+            #end
         #end
-#end
     </resultMap>
-    <sql id="Base_Column_List" >
-    #foreach($field in $model.fields)
-        ${field.name}#if($velocityCount!=$model.fields.size()),#end
-    #end
+    <sql id="Base_Column_List">
+        #foreach($field in $model.fields)
+            ${field.name}#if($velocityCount!=$model.fields.size()),#end
+        #end
     </sql>
-    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
         select
-        <include refid="Base_Column_List" />
+        <include refid="Base_Column_List"/>
         from $model.tableName
         where id = #{id,jdbcType=INTEGER}
     </select>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
         delete from $model.tableName
         where id = #{id,jdbcType=INTEGER}
     </delete>
-    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.${model.className}" useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.${model.className}"
+            useGeneratedKeys="true" keyProperty="id">
         insert into $model.tableName
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-    #foreach($field in $model.fields)
-        #if(${field.name}!='id')
-            <if test="$field.modelName!= null" >
-                ${field.name},
-            </if>
-        #end
-    #end
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            #foreach($field in $model.fields)
+                #if(${field.name}!='id'&&${field.name}!='ID')
+                    <if test="$field.modelName!= null">
+                        ${field.name},
+                    </if>
+                #end
+            #end
         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-        #foreach($field in $model.fields)
-            #if(${field.name}!='id')
-            <if test="$field.modelName != null" >
-                #{$field.modelName,jdbcType=${field.sqlType}},
-            </if>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            #foreach($field in $model.fields)
+                #if(${field.name}!='id'&&${field.name}!='ID')
+                    <if test="$field.modelName != null">
+                        #{$field.modelName,jdbcType=${field.sqlType}},
+                    </if>
+                #end
             #end
-        #end
         </trim>
     </insert>
-    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.${model.className}" >
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.${model.className}">
         update $model.tableName
-        <set >
-        #foreach($field in $model.fields)
-            #if(${field.name}!='id')
-            <if test="$field.modelName != null" >
-               ${field.name}= #{$field.modelName,jdbcType=${field.sqlType}},
-            </if>
+        <set>
+            #foreach($field in $model.fields)
+                #if(${field.name}!='id'&&${field.name}!='ID')
+                    <if test="$field.modelName != null">
+                        ${field.name}= #{$field.modelName,jdbcType=${field.sqlType}},
+                    </if>
+                #end
             #end
-         #end
         </set>
         where id = #{id,jdbcType=INTEGER}
     </update>
-    <select id="query${model.className}ByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.${model.className}">
-        select <include refid="Base_Column_List"/> from ${model.tableName}
+    <select id="query${model.className}ByPage" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.${model.className}">
+        select
+        <include refid="Base_Column_List"/>
+        from ${model.tableName}
         <where>
-            and del_flag = 'N'
-        #foreach($field in $model.fields)
-            <if test="record.$field.modelName != null and !&quot;&quot;.equals(record.$field.modelName)">
-                and  ${field.name} = #{record.$field.modelName}
-            </if>
-         #end
+            and FlagColumn = 0
+            #foreach($field in $model.fields)
+                <if test="record.$field.modelName != null and !&quot;&quot;.equals(record.$field.modelName)">
+                    and  ${field.name} = #{record.$field.modelName}
+                </if>
+            #end
         </where>
         order by id desc
     </select>
-    <select id="queryAll${model.className}" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.${model.className}">
-        select <include refid="Base_Column_List"/> from ${model.tableName}
+    <select id="queryAll${model.className}" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.${model.className}">
+        select
+        <include refid="Base_Column_List"/>
+        from ${model.tableName}
         <where>
-            and del_flag = 'N'
-        #foreach($field in $model.fields)
-            <if test="$field.modelName != null and !&quot;&quot;.equals($field.modelName)">
-                and  ${field.name} = #{$field.modelName}
-            </if>
-        #end
+            and FlagColumn = 0
+            #foreach($field in $model.fields)
+                <if test="$field.modelName != null and !&quot;&quot;.equals($field.modelName)">
+                    and  ${field.name} = #{$field.modelName}
+                </if>
+            #end
         </where>
         order by id desc
     </select>
-    <select id="query${model.className}" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.${model.className}">
-        select top 1 <include refid="Base_Column_List"/> from ${model.tableName}
+    <select id="query${model.className}" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.${model.className}">
+        select top 1
+        <include refid="Base_Column_List"/>
+        from ${model.tableName}
         <where>
-            and del_flag = 'N'
-        #foreach($field in $model.fields)
-            <if test="$field.modelName != null and !&quot;&quot;.equals($field.modelName)">
-                and ${field.name} = #{$field.modelName}
-            </if>
-         #end
+            and FlagColumn = 0
+            #foreach($field in $model.fields)
+                <if test="$field.modelName != null and !&quot;&quot;.equals($field.modelName)">
+                    and ${field.name} = #{$field.modelName}
+                </if>
+            #end
 
         </where>
     </select>
     <update id="delete">
-        UPDATE ${model.tableName} SET del_flag = 'Y'
+        UPDATE ${model.tableName} SET FlagColumn = 1
         <where>
             AND id = #{id}
         </where>
     </update>
     <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.${model.className}">
-        select <include refid="Base_Column_List"/> from ${model.tableName}
+        select
+        <include refid="Base_Column_List"/>
+        from ${model.tableName}
         <where>
-            and del_flag = 'N'
+            and FlagColumn = 0
             #foreach($field in $model.fields)
                 #if(${field.searchable})
                     #if(${field.searchMethod}=="=")
@@ -127,10 +139,10 @@
                         and ${field.name} <= #{$field.modelName}
                     #end
                     #if(${field.searchMethod}=="like")
-                        and ${field.name} like  '%${$field.modelName}%'
+                        and ${field.name} like '%${$field.modelName}%'
                     #end
                     #if(${field.searchMethod}=="left like")
-                        and ${field.name} like  '%${$field.modelName}'
+                        and ${field.name} like '%${$field.modelName}'
                     #end
                     #if(${field.searchMethod}=="right like")
                         and ${field.name} like '${$field.modelName}%'

+ 157 - 156
src/main/vue/src/pages/GenCode.vue

@@ -7,15 +7,17 @@
             <el-form-item prop="remark" label="描述">
                 <el-input v-model="formData.remark" style="width: 400px;"></el-input>
             </el-form-item>
+            <el-form-item prop="readTable" label="读表">
+
+                <el-switch :value="formData.readTable" on-text="读表" off-text="不读" @change="updateReadTable()">
+                </el-switch>
+
+            </el-form-item>
             <el-form-item prop="dataBaseType" label="数据库">
-                <el-select placeholder="数据库类型" size="small" v-model="formData.dataBaseType"  class="filter-item">
-                    <el-option
-                        label="Mysql"
-                        value="Mysql">
+                <el-select placeholder="数据库类型" size="small" v-model="formData.dataBaseType" class="filter-item">
+                    <el-option label="Mysql" value="Mysql">
                     </el-option>
-                    <el-option
-                        label="SqlServer"
-                        value="SqlServer">
+                    <el-option label="SqlServer" value="SqlServer">
                     </el-option>
                 </el-select>
             </el-form-item>
@@ -28,7 +30,7 @@
             <el-form-item prop="javaPath" label="根目录">
                 <el-input v-model="formData.rootPath"></el-input>
             </el-form-item>
-            <el-form-item prop="fields" label="数据">
+            <el-form-item prop="fields" label="数据" v-if="!formData.readTable">
                 <el-tabs value="1" type="border-card" @tab-click="tabClick">
                     <el-tab-pane label="字段" name="1">
                         <el-table :data="fields">
@@ -40,8 +42,7 @@
                             <el-table-column prop="type" label="类型" width="150" align="center">
                                 <template slot-scope="{row}">
                                     <el-select v-model="row.jdbcType" filterable>
-                                        <el-option v-for="item in fieldTypes" :value="item" :label="item"
-                                                   :key="item"></el-option>
+                                        <el-option v-for="item in fieldTypes" :value="item" :label="item" :key="item"></el-option>
                                     </el-select>
                                 </template>
                             </el-table-column>
@@ -110,17 +111,14 @@
                             <el-table-column prop="formType" label="表单类型" width="150" align="center">
                                 <template slot-scope="{row}">
                                     <el-select v-model="row.formType">
-                                        <el-option v-for="item in formTypes" :label="item.label" :value="item.value"
-                                                   :key="item.value"></el-option>
+                                        <el-option v-for="item in formTypes" :label="item.label" :value="item.value" :key="item.value"></el-option>
                                     </el-select>
                                 </template>
                             </el-table-column>
                             <el-table-column prop="searchMethod" label="搜索方式" width="150" align="center">
                                 <template slot-scope="{row}">
                                     <el-select v-model="row.searchMethod">
-                                        <el-option v-for="item in searchMethods" :label="item"
-                                                   :value="item"
-                                                   :key="item"></el-option>
+                                        <el-option v-for="item in searchMethods" :label="item" :value="item" :key="item"></el-option>
                                     </el-select>
                                 </template>
                             </el-table-column>
@@ -163,8 +161,7 @@
                             <el-table-column prop="validatorType" label="校验类型" width="150" align="center">
                                 <template slot-scope="{row}">
                                     <el-select v-model="row.validatorType">
-                                        <el-option v-for="item in validatorTypes" :label="item.label"
-                                                   :value="item.label" :key="item.label"></el-option>
+                                        <el-option v-for="item in validatorTypes" :label="item.label" :value="item.label" :key="item.label"></el-option>
                                     </el-select>
                                 </template>
                             </el-table-column>
@@ -182,155 +179,159 @@
 </template>
 
 <script>
-    import axios from 'axios'
+import axios from 'axios'
 
-    export default {
-        created() {
-            this.$http.get({
-                url: '/genCode/getSrcPath'
-            }).then(res => {
-                if (res.success) {
-                    this.formData.rootPath = res.data.root;
-                    this.formData.javaPathRelative = res.data.javaPath;
-                    this.formData.viewPathRelative = res.data.viewPath;
-                }
-            })
-        },
-        data() {
-            return {
-                fieldTypes: ['char', 'varchar', 'int', 'text', 'timestamp', 'datetime', 'decimal', 'float'],
-                searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'between', 'like', 'left like', 'right like'],
-                formTypes: [
-                    {label: '单行文本', value: 'singleLineText'},
-                    {label: '多行文本', value: 'textarea'},
-                    {label: '富文本', value: 'richText'},
-                    {label: '数字', value: 'number'},
-                    {label: '日期选择', value: 'date'},
-                    {label: '单选下拉框', value: 'select'},
-                    {label: '多选下拉框', value: 'multiSelect'},
-                    {label: '单图上传', value: 'singleImage'},
-                    {label: '多图上传', value: 'multiImage'},
-                    {label: '文件上传', value: 'fileUpload'},
-                    {label: '树形选择', value: 'tree'},
-                    {label: '开关', value: 'switch'}
-                ],
-                validatorTypes: [
-                    {label: '英文', value: 'english'},
-                    {label: '数字', value: 'number'},
-                    {label: '手机', value: 'phone'},
-                    {label: '网址', value: 'url'},
-                    {label: '电子邮件', value: 'email'},
-                    {label: '身份证', value: 'id'}
-                ],
-                rules: {
-                    tableName: [
-                        {required: true, message: '请填写表名', trigger: 'blur'},
-                        {
-                            validator: (rule, value, callback) => {
-                                if (value) {
-                                    if (/^[a-zA-Z0-9_]*$/.test(value)) {
-                                        callback();
-                                    } else {
-                                        callback(new Error('表名不正确'));
-                                    }
-                                }
-                            }, trigger: 'blur'
-                        }
-                    ],
-                    remark: [{required: true, message: '请填写描述', trigger: 'blur'}],
-                    rootPath: [{required: true, message: '请填写生成目录', trigger: 'blur'}]
-                },
-                formData: {
-                    tableName: '',
-                    remark: '',
-                    genTable: true,
-                    genClass: true,
-                    genList: true,
-                    genForm: true,
-                    rootPath: '',
-                    javaPathRelative: '',
-                    viewPathRelative: '',
-                    dataBaseType:'Mysql'
-                },
-                fields: [{
-                    name: 'id',
-                    jdbcType: 'int',
-                    notNull: true,
-                    primaryKey: true,
-                    autoIncrease: true,
-                    remark: '',
-                    showInList: false,
-                    showInForm: false,
-                    searchable: false
-                },
-                    {
-                        name: 'del_flag',
-                        jdbcType: 'char',
-                        notNull: true,
-                        primaryKey: false,
-                        autoIncrease: false,
-                        remark: '删除标识',
-                        showInList: false,
-                        showInForm: false,
-                        searchable: false,
-                        defaultValue:'N',
-                        length:1
-                    },
-                ]
-            }
-        },
-        computed: {
-            editableFields() {
-                return this.fields.filter(i => {
-                    return i.name
-                });
+export default {
+    created() {
+        this.$http.get({
+            url: '/genCode/getSrcPath'
+        }).then(res => {
+            if (res.success) {
+                this.formData.rootPath = res.data.root;
+                this.formData.javaPathRelative = res.data.javaPath;
+                this.formData.viewPathRelative = res.data.viewPath;
             }
-        },
-        methods: {
-            onSave() {
-                this.$refs.form.validate((valid) => {
-                    if (valid) {
-                        this.submit();
-                    } else {
-                        return false;
+        })
+    },
+    data() {
+        return {
+            fieldTypes: ['char', 'varchar', 'int', 'text', 'timestamp', 'datetime', 'decimal', 'float'],
+            searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'between', 'like', 'left like', 'right like'],
+            formTypes: [
+                { label: '单行文本', value: 'singleLineText' },
+                { label: '多行文本', value: 'textarea' },
+                { label: '富文本', value: 'richText' },
+                { label: '数字', value: 'number' },
+                { label: '日期选择', value: 'date' },
+                { label: '单选下拉框', value: 'select' },
+                { label: '多选下拉框', value: 'multiSelect' },
+                { label: '单图上传', value: 'singleImage' },
+                { label: '多图上传', value: 'multiImage' },
+                { label: '文件上传', value: 'fileUpload' },
+                { label: '树形选择', value: 'tree' },
+                { label: '开关', value: 'switch' }
+            ],
+            validatorTypes: [
+                { label: '英文', value: 'english' },
+                { label: '数字', value: 'number' },
+                { label: '手机', value: 'phone' },
+                { label: '网址', value: 'url' },
+                { label: '电子邮件', value: 'email' },
+                { label: '身份证', value: 'id' }
+            ],
+            rules: {
+                tableName: [
+                    { required: true, message: '请填写表名', trigger: 'blur' },
+                    {
+                        validator: (rule, value, callback) => {
+                            if (value) {
+                                if (/^[\u4e00-\u9fa5a-zA-Z0-9_]*$/.test(value)) {
+                                    callback();
+                                } else {
+                                    callback(new Error('表名不正确'));
+                                }
+                            }
+                        }, trigger: 'blur'
                     }
-                });
+                ],
+                remark: [{ required: true, message: '请填写描述', trigger: 'blur' }],
+                rootPath: [{ required: true, message: '请填写生成目录', trigger: 'blur' }]
             },
-            submit() {
-                this.formData.fields = this.fields;
-                this.formData.javaPath = this.formData.rootPath + this.formData.javaPathRelative;
-                this.formData.viewPath = this.formData.rootPath + this.formData.viewPathRelative;
-                axios.post('/genCode/save', this.formData).then(res => {
-                    this.$msgbox({title: '提示', type: 'success', message: '代码生成成功'});
-                })
+            formData: {
+                tableName: '',
+                remark: '',
+                genTable: true,
+                genClass: true,
+                genList: true,
+                genForm: true,
+                rootPath: '',
+                javaPathRelative: '',
+                viewPathRelative: '',
+                dataBaseType: 'Mysql',
+                readTable: false,
             },
-            addField() {
-                this.fields.push({
-                    name: '',
-                    type: 'varchar',
-                    notNull: false,
-                    primaryKey: false,
-                    autoIncrease: false,
-                    remark: '',
-                    showInList: true,
-                    showInForm: true,
-                    searchable: false,
-                    formType:'singleLineText'
-                });
+            fields: [{
+                name: 'id',
+                jdbcType: 'int',
+                notNull: true,
+                primaryKey: true,
+                autoIncrease: true,
+                remark: '',
+                showInList: false,
+                showInForm: false,
+                searchable: false
             },
-            removeField(i) {
-                if (this.fields.length > 1) {
-                    this.fields.splice(i, 1);
-                }
+            {
+                name: 'del_flag',
+                jdbcType: 'char',
+                notNull: true,
+                primaryKey: false,
+                autoIncrease: false,
+                remark: '删除标识',
+                showInList: false,
+                showInForm: false,
+                searchable: false,
+                defaultValue: 'N',
+                length: 1
             },
-            tabClick(tab) {
-                window.xxx = tab;
-                setTimeout(() => tab.$nextTick(), 1000);
-            }
+            ]
+        }
+    },
+    computed: {
+        editableFields() {
+            return this.fields.filter(i => {
+                return i.name
+            });
         }
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate((valid) => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            this.formData.fields = this.fields;
+            this.formData.javaPath = this.formData.rootPath + this.formData.javaPathRelative;
+            this.formData.viewPath = this.formData.rootPath + this.formData.viewPathRelative;
+            axios.post('/genCode/save', this.formData).then(res => {
+                this.$msgbox({ title: '提示', type: 'success', message: '代码生成成功' });
+            })
+        },
+        addField() {
+            this.fields.push({
+                name: '',
+                jdbcType: 'varchar',
+                notNull: false,
+                primaryKey: false,
+                autoIncrease: false,
+                remark: '',
+                showInList: true,
+                showInForm: true,
+                searchable: false,
+                formType: 'singleLineText'
+            });
+        },
+        removeField(i) {
+            if (this.fields.length > 1) {
+                this.fields.splice(i, 1);
+            }
+        },
+        tabClick(tab) {
+            window.xxx = tab;
+            setTimeout(() => tab.$nextTick(), 1000);
+        },
+        updateReadTable() {
+            this.formData.readTable = !this.formData.readTable;
+            this.formData.genTable = !this.formData.readTable;
+        },
     }
+}
 </script>
 
 <style lang="less" scoped>
-
 </style>

+ 96 - 0
src/main/vue/src/pages/TableShouyiYaopinxinxi.vue

@@ -0,0 +1,96 @@
+<template>
+    <div>
+        <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small"
+                 style="max-width: 500px;">
+                                                                                        <el-form-item prop="药品编号" label="药品编号">
+                <el-input v-model="formData.药品编号"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="药品名称" label="药品名称">
+                <el-input v-model="formData.药品名称"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="计量单位" label="计量单位">
+                <el-input v-model="formData.计量单位"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="规格" label="规格">
+                <el-input v-model="formData.规格"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="主要成分" label="主要成分">
+                <el-input v-model="formData.主要成分"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="有效成分" label="有效成分">
+                <el-input v-model="formData.有效成分"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="单价" label="单价">
+                <el-input v-model="formData.单价"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="生产厂家" label="生产厂家">
+                <el-input v-model="formData.生产厂家"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="药品制定部门" label="药品制定部门">
+                <el-input v-model="formData.药品制定部门"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="flagcolumn" label="FlagColumn">
+                <el-input v-model="formData.flagcolumn"></el-input>
+            </el-form-item>
+                                                                                                                                                                                                                                                                    <el-form-item>
+                <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
+                <el-button @click="$router.go(-1)">取消</el-button>
+            </el-form-item>
+        </el-form>
+    </div>
+</template>
+<script>
+    import formValidator from '../formValidator'
+
+    export default {
+        created() {
+            if (this.$route.query.id) {
+                this.$http.get({
+                    url: '/tableShouyiYaopinxinxi/getOne',
+                    data: {
+                        id: this.$route.query.id
+                    }
+                }).then(res => {
+                    if (res.success) {
+                        this.formData = res.data;
+                    }
+                })
+            }
+        },
+        data() {
+            return {
+                saving: false,
+                formData: {},
+                rules: {
+                                                                                                                                                                                                                                                                                                                                        },
+        }
+        },
+        methods: {
+            onSave() {
+                this.$refs.form.validate((valid) => {
+                    if (valid) {
+                        this.submit();
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            submit() {
+                var data = JSON.parse(JSON.stringify(this.formData));
+                this.$http.post({
+                    url: this.formData.id ? '/tableShouyiYaopinxinxi/update' : '/tableShouyiYaopinxinxi/save',
+                    data: data
+                }).then(res => {
+                    if (res.success) {
+                        this.$message.success('成功');
+                        this.$router.go(-1);
+                    } else {
+                        this.$message.warning('失败')
+                    }
+                });
+            }
+        }
+    }
+</script>
+<style lang="less" scoped>
+</style>

+ 282 - 0
src/main/vue/src/pages/TableShouyiYaopinxinxis.vue

@@ -0,0 +1,282 @@
+<template>
+    <div>
+        <div class="filters-container">
+          
+            <el-input placeholder="用户名" size="small" v-model="filter1" clearable class="filter-item"></el-input>
+            <el-select placeholder="性别" size="small" v-model="filter2" clearable class="filter-item">
+                <el-option
+                        label="女"
+                        value="item1">
+                </el-option>
+                <el-option
+                        label="男"
+                        value="item2">
+                </el-option>
+            </el-select>
+
+            <el-button @click="getData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
+            </el-button>
+            <el-button @click="$router.push('/tableShouyiYaopinxinxi')" type="primary" size="small" icon="el-icon-edit"
+                       class="filter-item">添加
+            </el-button>
+            <el-dropdown trigger="click" size="medium" class="table-column-filter">
+                <span>
+                  筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
+                </span>
+                <el-dropdown-menu slot="dropdown" class="table-column-filter-wrapper">
+                    <el-checkbox v-for="item in tableColumns" :key="item.value" v-model="item.show">{{item.label}}
+                    </el-checkbox>
+                </el-dropdown-menu>
+            </el-dropdown>
+        </div>
+        <el-table
+                :data="tableData"
+                :height="tableHeight"
+                row-key="id"
+                ref="table">
+            <el-table-column
+                    v-if="multipleMode"
+                    align="center"
+                    type="selection"
+                    width="50">
+            </el-table-column>
+            <el-table-column
+                    type="index"
+                    min-width="50"
+                    align="center">
+            </el-table-column>
+                                        <el-table-column
+                    v-if="isColumnShow('id')"
+                    prop="id"
+                    label="ID"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('药品编号')"
+                    prop="药品编号"
+                    label="药品编号"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('药品名称')"
+                    prop="药品名称"
+                    label="药品名称"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('计量单位')"
+                    prop="计量单位"
+                    label="计量单位"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('规格')"
+                    prop="规格"
+                    label="规格"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('主要成分')"
+                    prop="主要成分"
+                    label="主要成分"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('有效成分')"
+                    prop="有效成分"
+                    label="有效成分"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('单价')"
+                    prop="单价"
+                    label="单价"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('生产厂家')"
+                    prop="生产厂家"
+                    label="生产厂家"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('药品制定部门')"
+                    prop="药品制定部门"
+                    label="药品制定部门"
+                    min-width="100">
+            </el-table-column>
+                                                        <el-table-column
+                    v-if="isColumnShow('flagcolumn')"
+                    prop="flagcolumn"
+                    label="FlagColumn"
+                    min-width="100">
+            </el-table-column>
+                                        <el-table-column
+                    label="操作"
+                    align="center"
+                    fixed="right">
+                <template slot-scope="scope">
+                    <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <div class="multiple-mode-wrapper">
+                <el-button size="small" v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button size="small" @click="operation1">批量操作1</el-button>
+                    <el-button size="small" @click="operation2">批量操作2</el-button>
+                    <el-button size="small" @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div>
+            <el-pagination
+                    background
+                    @size-change="pageSizeChange"
+                    @current-change="currentPageChange"
+                    :current-page="currentPage"
+                    :page-sizes="[10, 20, 30, 40, 50]"
+                    :page-size="pageSize"
+                    layout="total, sizes, prev, pager, next, jumper"
+                    :total="totalNumber">
+            </el-pagination>
+        </div>
+    </div>
+</template>
+<script>
+    import {mapState} from 'vuex'
+
+    export default {
+        created() {
+            this.getData();
+        },
+        data() {
+            return {
+                totalNumber: 0,
+                totalPage: 10,
+                currentPage: 1,
+                pageSize: 20,
+                tableData: [],
+                filter1: '',
+                filter2: '',
+                tableColumns: [
+                                        {
+                        label: 'ID',
+                        value: 'id',
+                        show: true
+                    },
+                                                    {
+                        label: '药品编号',
+                        value: '药品编号',
+                        show: true
+                    },
+                                                    {
+                        label: '药品名称',
+                        value: '药品名称',
+                        show: true
+                    },
+                                                    {
+                        label: '计量单位',
+                        value: '计量单位',
+                        show: true
+                    },
+                                                    {
+                        label: '规格',
+                        value: '规格',
+                        show: true
+                    },
+                                                    {
+                        label: '主要成分',
+                        value: '主要成分',
+                        show: true
+                    },
+                                                    {
+                        label: '有效成分',
+                        value: '有效成分',
+                        show: true
+                    },
+                                                    {
+                        label: '单价',
+                        value: '单价',
+                        show: true
+                    },
+                                                    {
+                        label: '生产厂家',
+                        value: '生产厂家',
+                        show: true
+                    },
+                                                    {
+                        label: '药品制定部门',
+                        value: '药品制定部门',
+                        show: true
+                    },
+                                                    {
+                        label: 'FlagColumn',
+                        value: 'flagcolumn',
+                        show: true
+                    },
+                                    ],
+                multipleMode: false
+            }
+        },
+        computed: {
+            ...mapState(['tableHeight']),
+            selection() {
+                return this.$refs.table.selection.map(i => i.id);
+            }
+        },
+        methods: {
+            pageSizeChange(size) {
+                this.pageSize = size;
+                this.getData();
+            },
+            currentPageChange(page) {
+                this.currentPage = page;
+                this.getData();
+            },
+            getData() {
+                this.$http.get({
+                url: '/tableShouyiYaopinxinxi/page',
+                data: {
+                    currentPage: this.currentPage,
+                    pageNumber: this.pageSize
+                }
+                }).then(res => {
+                    if (res.success) {
+                        this.totalNumber = res.data.page.totalNumber;
+                        this.tableData = res.data.pp;
+                    }
+                })
+            },
+            isColumnShow(column) {
+                var row = this.tableColumns.find(i => i.value === column);
+                return row ? row.show : false;
+            },
+            toggleMultipleMode(multipleMode) {
+                this.multipleMode = multipleMode;
+                if (!multipleMode) {
+                    this.$refs.table.clearSelection();
+                }
+            },
+            editRow(row) {
+                this.$router.push({
+                    path: '/tableShouyiYaopinxinxi',
+                    query: {
+                        id: row.id
+                    }
+                })
+            },
+            operation1() {
+                this.$notify({
+                    title: '提示',
+                    message: this.selection
+                });
+            },
+            operation2() {
+                this.$message('操作2');
+            }
+        }
+    }
+</script>
+<style lang="less" scoped>
+
+</style>

+ 2 - 16
src/main/vue/src/pages/TestAaa.vue

@@ -2,13 +2,7 @@
     <div>
         <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small"
                  style="max-width: 500px;">
-                                                                                        <el-form-item prop="delFlag" label="删除标识">
-                <el-input v-model="formData.delFlag"></el-input>
-            </el-form-item>
-                                                                                                                                                                                                                                                                                                        <el-form-item prop="nameTest" label="123">
-                <el-input v-model="formData.nameTest"></el-input>
-            </el-form-item>
-                                                                                                                                                                                                                                                                    <el-form-item>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
             </el-form-item>
@@ -38,15 +32,7 @@
                 saving: false,
                 formData: {},
                 rules: {
-                                                                            delFlag:
-                    [
-                        {required: true, message: '请输入 删除标识', trigger: 'blur'},
-                                                                                                                                                                                                                                                                    ],
-                                                                nameTest:
-                    [
-                        {required: true, message: '请输入 123', trigger: 'blur'},
-                                            ],
-                                    },
+                                                                                                                                    },
         }
         },
         methods: {

+ 16 - 16
src/main/vue/src/pages/TestAaas.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <div class="filters-container">
-
+          
             <el-input placeholder="用户名" size="small" v-model="filter1" clearable class="filter-item"></el-input>
             <el-select placeholder="性别" size="small" v-model="filter2" clearable class="filter-item">
                 <el-option
@@ -45,16 +45,16 @@
                     min-width="50"
                     align="center">
             </el-table-column>
-                                                                    <el-table-column
-                    v-if="isColumnShow('delFlag')"
-                    prop="delFlag"
-                    label="删除标识"
+                                                                                                <el-table-column
+                    v-if="isColumnShow('testName')"
+                    prop="testName"
+                    label=""
                     min-width="100">
             </el-table-column>
                                                         <el-table-column
-                    v-if="isColumnShow('nameTest')"
-                    prop="nameTest"
-                    label="123"
+                    v-if="isColumnShow('remark')"
+                    prop="remark"
+                    label=""
                     min-width="100">
             </el-table-column>
                                         <el-table-column
@@ -98,22 +98,22 @@
         data() {
             return {
                 totalNumber: 0,
-                totalPage: 0,
+                totalPage: 10,
                 currentPage: 1,
                 pageSize: 20,
                 tableData: [],
                 filter1: '',
                 filter2: '',
                 tableColumns: [
-                                                            {
-                        label: '删除标识',
-                        value: 'delFlag',
-                        show: false
+                                                                                {
+                        label: '',
+                        value: 'testName',
+                        show: true
                     },
                                                     {
-                        label: '123',
-                        value: 'nameTest',
-                        show: false
+                        label: '',
+                        value: 'remark',
+                        show: true
                     },
                                     ],
                 multipleMode: false

+ 12 - 5
src/main/vue/src/router/index.js

@@ -125,7 +125,17 @@ const router = new Router({
                     path: '/myTasks',
                     name: 'myTasks',
                     component: () => import('../pages/MyTasks')
-                }
+                },
+                {
+                    path: '/tableShouyiYaopinxinxis',
+                    name: 'tableShouyiYaopinxinxis',
+                    component: () => import('../pages/TableShouyiYaopinxinxis')
+                },
+                {
+                    path: '/tableShouyiYaopinxinxi',
+                    name: 'tableShouyiYaopinxinxi',
+                    component: () => import('../pages/TableShouyiYaopinxinxi')
+                },
             ]
         },
         {
@@ -133,10 +143,7 @@ const router = new Router({
             name: 'login',
             component: () => import('../pages/Login')
         },
-        {
-            path: '*',
-            component: () => import('../pages/404')
-        },
+        
         {
             path: '/appLineChart',
             name: 'appLineChart',