Browse Source

Merge remote-tracking branch 'origin/master'

xiongzhu 8 years ago
parent
commit
881fca5af8

+ 302 - 204
src/main/java/com/izouma/awesomeadmin/dao/TableShouyiYaopinxinxiMapper.xml

@@ -2,18 +2,18 @@
 <!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>
+                                    <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">
@@ -30,104 +30,104 @@
             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>
+                                                                            <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>
+                                                                            <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>
+                                                                            <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"
@@ -137,38 +137,87 @@
         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 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>
+            
+            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR" >
+                                                                                                                    OR  药品编号 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  药品名称 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  计量单位 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  规格 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  主要成分 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  有效成分 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  单价 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  生产厂家 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  药品制定部门 LIKE concat('%',#{record.searchKey},'%')
+                                                                                                OR  FlagColumn LIKE concat('%',#{record.searchKey},'%')
+                                                            </trim>
+            </if>
+            <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
+                <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
             </if>
         </where>
         order by id desc
@@ -180,38 +229,87 @@
         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 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>
+            
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR" >
+                                                                                                                    OR  药品编号 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  药品名称 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  计量单位 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  规格 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  主要成分 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  有效成分 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  单价 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  生产厂家 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  药品制定部门 LIKE concat('%',#{searchKey},'%')
+                                                                                                OR  FlagColumn LIKE concat('%',#{searchKey},'%')
+                                                            </trim>
+            </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
             </if>
         </where>
         order by id desc
@@ -223,40 +321,40 @@
         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>
-
+                            <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">
@@ -271,7 +369,7 @@
         from Table_兽医_药品信息
         <where>
             and FlagColumn = 0
-        </where>
+                                                                                                                                                                                                                                                                                                                                        </where>
         order by id desc
     </select>
 </mapper>

+ 117 - 108
src/main/java/com/izouma/awesomeadmin/dao/TestAaaMapper.xml

@@ -1,14 +1,14 @@
 <?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.TestAaaMapper" >
-    <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="test_name" property="testName" jdbcType="VARCHAR" />
-                                <result column="remark" property="remark" jdbcType="VARCHAR" />
-            </resultMap>
-    <sql id="Base_Column_List" >
-        <trim  suffixOverrides="," >
+<mapper namespace="com.izouma.awesomeadmin.dao.TestAaaMapper">
+    <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="test_name" property="testName" jdbcType="VARCHAR"/>
+        <result column="remark" property="remark" jdbcType="VARCHAR"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <trim suffixOverrides=",">
             id,
 
             del_flag,
@@ -17,90 +17,93 @@
 
             remark,
 
-            </trim>
+        </trim>
     </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 test_aaa
         where id = #{id,jdbcType=INTEGER}
     </select>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
         delete from test_aaa
         where id = #{id,jdbcType=INTEGER}
     </delete>
-    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.TestAaa" useGeneratedKeys="true" keyProperty="id">
+    <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" >
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id!= null">
                 id,
             </if>
-                <if test="delFlag!= null" >
+            <if test="delFlag!= null">
                 del_flag,
             </if>
-                <if test="testName!= null" >
+            <if test="testName!= null">
                 test_name,
             </if>
-                <if test="remark!= null" >
+            <if test="remark!= null">
                 remark,
             </if>
-            </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-                    <if test="id != null" >
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
                 #{id,jdbcType=INTEGER},
             </if>
-                    <if test="delFlag != null" >
+            <if test="delFlag != null">
                 #{delFlag,jdbcType=CHAR},
             </if>
-                    <if test="testName != null" >
+            <if test="testName != null">
                 #{testName,jdbcType=VARCHAR},
             </if>
-                    <if test="remark != null" >
+            <if test="remark != null">
                 #{remark,jdbcType=VARCHAR},
             </if>
-                </trim>
+        </trim>
     </insert>
-    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.TestAaa" >
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.TestAaa">
         update test_aaa
-        <set >
-                    <if test="id != null" >
-               id= #{id,jdbcType=INTEGER},
+        <set>
+            <if test="id != null">
+                id= #{id,jdbcType=INTEGER},
             </if>
-                     <if test="delFlag != null" >
-               del_flag= #{delFlag,jdbcType=CHAR},
+            <if test="delFlag != null">
+                del_flag= #{delFlag,jdbcType=CHAR},
             </if>
-                     <if test="testName != null" >
-               test_name= #{testName,jdbcType=VARCHAR},
+            <if test="testName != null">
+                test_name= #{testName,jdbcType=VARCHAR},
             </if>
-                     <if test="remark != null" >
-               remark= #{remark,jdbcType=VARCHAR},
+            <if test="remark != null">
+                remark= #{remark,jdbcType=VARCHAR},
             </if>
-                 </set>
+        </set>
         where id = #{id,jdbcType=INTEGER}
     </update>
     <select id="queryTestAaaByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestAaa">
-        select <include refid="Base_Column_List"/> from test_aaa
+        select
+        <include refid="Base_Column_List"/>
+        from test_aaa
         <where>
             and del_flag = 'N'
-                    <if test="record.id != null and !&quot;&quot;.equals(record.id)">
-                and  id = #{record.id}
+            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
+                and id = #{record.id}
             </if>
-                     <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
-                and  del_flag = #{record.delFlag}
+            <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
+                and del_flag = #{record.delFlag}
             </if>
-                     <if test="record.testName != null and !&quot;&quot;.equals(record.testName)">
-                and  test_name = #{record.testName}
+            <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 test="record.remark != null and !&quot;&quot;.equals(record.remark)">
+                and remark = #{record.remark}
+            </if>
+            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR del_flag LIKE concat('%',#{record.searchKey},'%')
+                    OR test_name LIKE concat('%',#{record.searchKey},'%')
+                    OR remark LIKE concat('%',#{record.searchKey},'%')
+                </trim>
             </if>
-                  <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
-             <trim prefix="and (" suffix=")" prefixOverrides="OR" >
-                                                                                               OR  del_flag LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  test_name LIKE concat('%',#{record.searchKey},'%')
-                                                                                                    OR  remark LIKE concat('%',#{record.searchKey},'%')
-                                                             </trim>
-         </if>
 
             <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
                 <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
@@ -141,82 +144,86 @@
         order by id desc
     </select>
     <select id="queryAllTestAaa" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestAaa">
-        select <include refid="Base_Column_List"/> from test_aaa
+        select
+        <include refid="Base_Column_List"/>
+        from test_aaa
         <where>
             and del_flag = 'N'
-                    <if test="id != null and !&quot;&quot;.equals(id)">
-                and  id = #{id}
-            </if>
-                    <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
-                and  del_flag = #{delFlag}
-            </if>
-                    <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>
-                    <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
-                <trim prefix="and (" suffix=")" prefixOverrides="OR" >
-                                                                                                                                                OR  del_flag LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  test_name LIKE concat('%',#{searchKey},'%')
-                                                                                                                                                        OR  remark LIKE concat('%',#{searchKey},'%')
-                                                                                        </trim>
-            </if>
-<if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
-    <foreach item="item" index="index" collection="advancedQuery.split('_;')">
-        <choose>
-            <when test="item.indexOf('like') != -1">
-                <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
-                    <if test="detailIndex == 3">
-                        concat('%',#{itemDetail},'%')
-                    </if>
-
-                    <if test="detailIndex &lt; 3">
-                        ${itemDetail}
-                    </if>
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <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>
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR del_flag LIKE concat('%',#{searchKey},'%')
+                    OR test_name LIKE concat('%',#{searchKey},'%')
+                    OR remark LIKE concat('%',#{searchKey},'%')
+                </trim>
+            </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
 
-                </foreach>
-            </when>
-            <otherwise>
-                <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
-                    <if test="detailIndex == 3">
-                        #{itemDetail}
-                    </if>
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
 
-                    <if test="detailIndex &lt; 3">
-                        ${itemDetail}
-                    </if>
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
 
-                </foreach>
-            </otherwise>
-        </choose>
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
 
+                            </foreach>
+                        </otherwise>
+                    </choose>
 
-    </foreach>
+
+                </foreach>
 
 
-</if>
+            </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
+        <include refid="Base_Column_List"/>
+        from test_aaa
         <where>
             and del_flag = 'N'
-                    <if test="id != null and !&quot;&quot;.equals(id)">
+            <if test="id != null and !&quot;&quot;.equals(id)">
                 and id = #{id}
             </if>
-                     <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                 and del_flag = #{delFlag}
             </if>
-                     <if test="testName != null and !&quot;&quot;.equals(testName)">
+            <if test="testName != null and !&quot;&quot;.equals(testName)">
                 and test_name = #{testName}
             </if>
-                     <if test="remark != null and !&quot;&quot;.equals(remark)">
+            <if test="remark != null and !&quot;&quot;.equals(remark)">
                 and remark = #{remark}
             </if>
-         
+
         </where>
         LIMIT 1
     </select>
@@ -227,10 +234,12 @@
         </where>
     </update>
     <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestAaa">
-        select <include refid="Base_Column_List"/> from test_aaa
+        select
+        <include refid="Base_Column_List"/>
+        from test_aaa
         <where>
             and del_flag = 'N'
-                                                                                                                                    </where>
+        </where>
         order by id desc
     </select>
 </mapper>

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

@@ -21,6 +21,13 @@ public class TableShouyiYaopinxinxi{
     private String 药品制定部门;
     private Integer flagcolumn;
 
+private String searchKey;
+
+/**
+* and,test_name,like,value;or,remark,=,123
+*/
+private String advancedQuery;
+
     public Integer getId(){
         return this.id;
     }
@@ -99,6 +106,21 @@ public class TableShouyiYaopinxinxi{
         this.flagcolumn = flagcolumn;
     }
 
+public String getSearchKey() {
+    return searchKey;
+}
+
+public void setSearchKey(String searchKey) {
+    this.searchKey = searchKey;
+}
+
+public String getAdvancedQuery() {
+    return advancedQuery;
+}
+
+public void setAdvancedQuery(String advancedQuery) {
+    this.advancedQuery = advancedQuery;
+}
 
 }
 

+ 55 - 51
src/main/java/com/izouma/awesomeadmin/util/ExportExcelUtil.java

@@ -94,34 +94,36 @@ public class ExportExcelUtil {
                 cell.setCellStyle(style);
             }
 
+
+            // 为数据内容设置特点新单元格样式1 自动换行 上下居中
+            HSSFCellStyle zidonghuanhang = wb.createCellStyle();
+            zidonghuanhang.setWrapText(true);// 设置自动换行
+            zidonghuanhang.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个居中格式
+
+            // 设置边框
+            zidonghuanhang.setBottomBorderColor(HSSFColor.BLACK.index);
+            zidonghuanhang.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang.setBorderRight(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang.setBorderTop(HSSFCellStyle.BORDER_THIN);
+
+            // 为数据内容设置特点新单元格样式2 自动换行 上下居中左右也居中
+            HSSFCellStyle zidonghuanhang2 = wb.createCellStyle();
+            zidonghuanhang2.setWrapText(true);// 设置自动换行
+            zidonghuanhang2
+                    .setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个上下居中格式
+            zidonghuanhang2.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中
+
+            // 设置边框
+            zidonghuanhang2.setBottomBorderColor(HSSFColor.BLACK.index);
+            zidonghuanhang2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang2.setBorderRight(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang2.setBorderTop(HSSFCellStyle.BORDER_THIN);
             // 第五步,创建单元格,并设置值
             for (int i = 0; i < dataList.length; i++) {
                 row = sheet.createRow((int) i + 2);
-                // 为数据内容设置特点新单元格样式1 自动换行 上下居中
-                HSSFCellStyle zidonghuanhang = wb.createCellStyle();
-                zidonghuanhang.setWrapText(true);// 设置自动换行
-                zidonghuanhang.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个居中格式
-
-                // 设置边框
-                zidonghuanhang.setBottomBorderColor(HSSFColor.BLACK.index);
-                zidonghuanhang.setBorderBottom(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang.setBorderLeft(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang.setBorderRight(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang.setBorderTop(HSSFCellStyle.BORDER_THIN);
-
-                // 为数据内容设置特点新单元格样式2 自动换行 上下居中左右也居中
-                HSSFCellStyle zidonghuanhang2 = wb.createCellStyle();
-                zidonghuanhang2.setWrapText(true);// 设置自动换行
-                zidonghuanhang2
-                        .setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个上下居中格式
-                zidonghuanhang2.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中
-
-                // 设置边框
-                zidonghuanhang2.setBottomBorderColor(HSSFColor.BLACK.index);
-                zidonghuanhang2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang2.setBorderRight(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang2.setBorderTop(HSSFCellStyle.BORDER_THIN);
+
                 HSSFCell datacell = null;
                 for (int j = 0; j < columnNumber; j++) {
                     datacell = row.createCell(j);
@@ -232,35 +234,37 @@ public class ExportExcelUtil {
                 cell.setCellStyle(style);
             }
 
+            // 为数据内容设置特点新单元格样式1 自动换行 上下居中
+            HSSFCellStyle zidonghuanhang = wb.createCellStyle();
+            zidonghuanhang.setWrapText(true);// 设置自动换行
+            zidonghuanhang
+                    .setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个居中格式
+
+            // 设置边框
+            zidonghuanhang.setBottomBorderColor(HSSFColor.BLACK.index);
+            zidonghuanhang.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang.setBorderRight(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang.setBorderTop(HSSFCellStyle.BORDER_THIN);
+
+            // 为数据内容设置特点新单元格样式2 自动换行 上下居中左右也居中
+            HSSFCellStyle zidonghuanhang2 = wb.createCellStyle();
+            zidonghuanhang2.setWrapText(true);// 设置自动换行
+            zidonghuanhang2
+                    .setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个上下居中格式
+            zidonghuanhang2.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中
+
+            // 设置边框
+            zidonghuanhang2.setBottomBorderColor(HSSFColor.BLACK.index);
+            zidonghuanhang2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang2.setBorderRight(HSSFCellStyle.BORDER_THIN);
+            zidonghuanhang2.setBorderTop(HSSFCellStyle.BORDER_THIN);
+
             // 第五步,创建单元格,并设置值
             for (int i = 0; i < dataList.length; i++) {
                 row = sheet.createRow((int) i + 2);
-                // 为数据内容设置特点新单元格样式1 自动换行 上下居中
-                HSSFCellStyle zidonghuanhang = wb.createCellStyle();
-                zidonghuanhang.setWrapText(true);// 设置自动换行
-                zidonghuanhang
-                        .setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个居中格式
-
-                // 设置边框
-                zidonghuanhang.setBottomBorderColor(HSSFColor.BLACK.index);
-                zidonghuanhang.setBorderBottom(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang.setBorderLeft(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang.setBorderRight(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang.setBorderTop(HSSFCellStyle.BORDER_THIN);
-
-                // 为数据内容设置特点新单元格样式2 自动换行 上下居中左右也居中
-                HSSFCellStyle zidonghuanhang2 = wb.createCellStyle();
-                zidonghuanhang2.setWrapText(true);// 设置自动换行
-                zidonghuanhang2
-                        .setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); // 创建一个上下居中格式
-                zidonghuanhang2.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 左右居中
-
-                // 设置边框
-                zidonghuanhang2.setBottomBorderColor(HSSFColor.BLACK.index);
-                zidonghuanhang2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang2.setBorderLeft(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang2.setBorderRight(HSSFCellStyle.BORDER_THIN);
-                zidonghuanhang2.setBorderTop(HSSFCellStyle.BORDER_THIN);
+
                 HSSFCell datacell = null;
                 for (int j = 0; j < columnNumber; j++) {
                     datacell = row.createCell(j);

+ 51 - 1
src/main/java/com/izouma/awesomeadmin/web/TableShouyiYaopinxinxiController.java

@@ -1,6 +1,9 @@
 package com.izouma.awesomeadmin.web;
 
 import java.util.*;
+
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresAuthentication;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -11,6 +14,9 @@ import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.TableShouyiYaopinxinxi;
 import com.izouma.awesomeadmin.service.TableShouyiYaopinxinxiService;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 /**
 *  controller类
 */
@@ -108,5 +114,49 @@ public class TableShouyiYaopinxinxiController extends BaseController{
         }
         return new Result(false, "删除异常");
     }
-}
+
+    /**
+    * 导出Excel
+    * @param request
+    * @param response
+    * @param record
+    * @throws Exception
+    */
+    @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
+    @ResponseBody
+    public void exportExcel(HttpServletRequest request, HttpServletResponse response, TableShouyiYaopinxinxi record) throws Exception {
+
+    List<TableShouyiYaopinxinxi> tableShouyiYaopinxinxis = tableShouyiYaopinxinxiService.getTableShouyiYaopinxinxiList(record);
+
+
+        String sheetName = "Table_兽医_药品信息";
+        String titleName = "Table_兽医_药品信息数据表";
+        String fileName = "Table_兽医_药品信息表";
+        int columnNumber = 11;
+        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
+        String[] columnName = {  "ID" ,   "药品编号" ,   "药品名称" ,   "计量单位" ,   "规格" ,   "主要成分" ,   "有效成分" ,   "单价" ,   "生产厂家" ,   "药品制定部门" ,   "FlagColumn"  };
+        String[][] dataList = new String[tableShouyiYaopinxinxis.size()][11];
+
+        for (int i = 0; i < tableShouyiYaopinxinxis.size(); i++) {
+
+                        dataList[i][0] = String.valueOf(tableShouyiYaopinxinxis.get(i).getId());
+                        dataList[i][1] = String.valueOf(tableShouyiYaopinxinxis.get(i).get药品编号());
+                        dataList[i][2] = String.valueOf(tableShouyiYaopinxinxis.get(i).get药品名称());
+                        dataList[i][3] = String.valueOf(tableShouyiYaopinxinxis.get(i).get计量单位());
+                        dataList[i][4] = String.valueOf(tableShouyiYaopinxinxis.get(i).get规格());
+                        dataList[i][5] = String.valueOf(tableShouyiYaopinxinxis.get(i).get主要成分());
+                        dataList[i][6] = String.valueOf(tableShouyiYaopinxinxis.get(i).get有效成分());
+                        dataList[i][7] = String.valueOf(tableShouyiYaopinxinxis.get(i).get单价());
+                        dataList[i][8] = String.valueOf(tableShouyiYaopinxinxis.get(i).get生产厂家());
+                        dataList[i][9] = String.valueOf(tableShouyiYaopinxinxis.get(i).get药品制定部门());
+                        dataList[i][10] = String.valueOf(tableShouyiYaopinxinxis.get(i).getFlagcolumn());
+                    }
+
+
+        ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
+        columnNumber, columnWidth, columnName, dataList, response);
+
+
+        }
+    }
 

+ 65 - 21
src/main/java/com/izouma/awesomeadmin/web/TestAaaController.java

@@ -1,6 +1,9 @@
 package com.izouma.awesomeadmin.web;
 
 import java.util.*;
+
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresAuthentication;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -11,19 +14,22 @@ import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.TestAaa;
 import com.izouma.awesomeadmin.service.TestAaaService;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 /**
-*  controller类
-*/
+ * controller类
+ */
 @Controller
 @RequestMapping("/testAaa")
-public class TestAaaController extends BaseController{
+public class TestAaaController extends BaseController {
 
     @Autowired
     private TestAaaService testAaaService;
 
     /**
-    * <p>获取全部记录。</p>
-    */
+     * <p>获取全部记录。</p>
+     */
     @RequiresAuthentication
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
@@ -33,8 +39,8 @@ public class TestAaaController extends BaseController{
     }
 
     /**
-    * <p>根据Id。</p>
-    */
+     * <p>根据Id。</p>
+     */
     @RequestMapping(value = "/getTestAaa", method = RequestMethod.GET)
     @ResponseBody
     public Result getTestAaa(@RequestParam(required = false, value = "id") String id) {
@@ -43,8 +49,8 @@ public class TestAaaController extends BaseController{
     }
 
     /**
-    * <p>根据条件获取。</p>
-    */
+     * <p>根据条件获取。</p>
+     */
     @RequestMapping(value = "/getOne", method = RequestMethod.GET)
     @ResponseBody
     public Result getOne(TestAaa record) {
@@ -54,14 +60,14 @@ public class TestAaaController extends BaseController{
 
 
     /**
-    * <p>分页查询。</p>
-    */
+     * <p>分页查询。</p>
+     */
     @RequestMapping(value = "/page", method = RequestMethod.GET)
     @ResponseBody
     public Result page(Page page, TestAaa record) {
         Map<String, Object> result = new HashMap<>();
 
-        List<TestAaa> pp =testAaaService.getTestAaaByPage(page, record);
+        List<TestAaa> pp = testAaaService.getTestAaaByPage(page, record);
 
         result.put(AppConstant.PAGE, page);
         result.put("pp", pp);
@@ -70,43 +76,81 @@ public class TestAaaController extends BaseController{
 
 
     /**
-    * <p>保存。</p>
-    */
+     * <p>保存。</p>
+     */
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ResponseBody
     public Result save(TestAaa record) {
         boolean num = testAaaService.createTestAaa(record);
         if (num) {
-        return new Result(true, record.getId());
+            return new Result(true, record.getId());
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>更新信息。</p>
-    */
+     * <p>更新信息。</p>
+     */
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ResponseBody
     public Result updateTestAaa(TestAaa record) {
         boolean num = testAaaService.updateTestAaa(record);
         if (num) {
-        return new Result(true, "保存成功");
+            return new Result(true, "保存成功");
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>删除。</p>
-    */
+     * <p>删除。</p>
+     */
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @ResponseBody
     public Result deleteTestAaa(@RequestParam(required = true, value = "id") String id) {
 
         boolean num = testAaaService.deleteTestAaa(id);
         if (num) {
-        return new Result(true, "删除成功");
+            return new Result(true, "删除成功");
         }
         return new Result(false, "删除异常");
     }
+
+    /**
+     * 导出Excel
+     *
+     * @param request
+     * @param response
+     * @param record
+     * @throws Exception
+     */
+    @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
+    @ResponseBody
+    public void exportExcel(HttpServletRequest request, HttpServletResponse response, TestAaa record) throws Exception {
+
+        List<TestAaa> testAaas = testAaaService.getTestAaaList(record);
+
+
+        String sheetName = "test_aaa";
+        String titleName = "测试aaa数据表";
+        String fileName = "测试aaa表";
+        int columnNumber = 4;
+        int[] columnWidth = {20, 20, 20, 20};
+        String[] columnName = {"id", "删除标识", "名字", "备注"};
+        String[][] dataList = new String[testAaas.size()][4];
+
+        for (int i = 0; i < testAaas.size(); i++) {
+
+            dataList[i][0] = testAaas.get(i).getId();
+            dataList[i][1] = testAaas.get(i).getDelFlag();
+            dataList[i][2] = testAaas.get(i).getTestName();
+            dataList[i][3] = testAaas.get(i).getRemark();
+        }
+
+
+        ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
+                columnNumber, columnWidth, columnName, dataList, response);
+
+
+    }
 }
 

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

@@ -24,6 +24,8 @@ public class ControllerGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -22,6 +22,8 @@ public class EditViewGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -49,6 +49,8 @@ public class GenList {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, "/Users/xiongzhu/Projects/Java/awesomeAdmin/src/main/java/com/izouma/ModelGenerator/templates");
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -22,6 +22,8 @@ public class ListViewGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -24,6 +24,8 @@ public class MapperGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -23,6 +23,8 @@ public class MapperXmlGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -25,6 +25,8 @@ public class ModelGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -24,6 +24,8 @@ public class ServiceGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

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

@@ -24,6 +24,8 @@ public class ServiceImplGenerator {
             Properties pro = new Properties();
             pro.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
             pro.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templatePath);
+            pro.setProperty("directive.foreach.counter.name", "velocityCount");
+            pro.setProperty("directive.foreach.counter.initial.value", "1");
             Velocity.init(pro);
             ToolManager manager = new ToolManager(true, true);
             VelocityContext context = new VelocityContext(manager.createContext());

+ 7 - 0
src/main/java/com/izouma/codegenerator/TableGenerator.java

@@ -159,6 +159,13 @@ public class TableGenerator {
             }
             String str = sql.substring(0, sql.lastIndexOf(","));
             String sql1 = str + " )";
+
+            if (StringUtils.isNotEmpty(model.getRemark())) {
+                if ("Mysql".equals(model.getDataBaseType())) {
+                    sql1 += " comment = " + "'" + model.getRemark() + "'";
+                }
+            }
+
             System.out.println(sql1);
             int result = stmt.executeUpdate(sql1);
             if (result != -1) {

+ 44 - 1
src/main/resources/templates/ControllerTemplate.vm

@@ -4,6 +4,9 @@ package com.izouma.awesomeadmin.web;
 $import
 #end
 import java.util.*;
+
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresAuthentication;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -14,6 +17,9 @@ import com.izouma.awesomeadmin.dto.Result;
 import com.izouma.awesomeadmin.model.${model.className};
 import com.izouma.awesomeadmin.service.${model.className}Service;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 /**
 *  controller类
 */
@@ -111,5 +117,42 @@ public class ${model.className}Controller extends BaseController{
         }
         return new Result(false, "删除异常");
     }
-}
+
+    /**
+    * 导出Excel
+    * @param request
+    * @param response
+    * @param record
+    * @throws Exception
+    */
+    @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
+    @ResponseBody
+    public void exportExcel(HttpServletRequest request, HttpServletResponse response, ${model.className} record) throws Exception {
+
+    List<${model.className}> ${display.uncapitalize(${model.className})}s = ${display.uncapitalize(${model.className})}Service.get${model.className}List(record);
+
+
+        String sheetName = "${model.tableName}";
+        String titleName = "${model.remark}数据表";
+        String fileName = "${model.remark}表";
+        int columnNumber = ${model.fields.size()};
+        int[] columnWidth = {#foreach(${field} in ${model.fields}) 20#if(${velocityCount} != ${model.fields.size()}),#end #end};
+        String[] columnName = {#foreach(${field} in ${model.fields}) #if(${field.remark}) "${field.remark}" #else "${field.modelName}"#end#if(${velocityCount} != ${model.fields.size()}),#end #end};
+        String[][] dataList = new String[${display.uncapitalize(${model.className})}s.size()][${model.fields.size()}];
+
+        for (int i = 0; i < ${display.uncapitalize(${model.className})}s.size(); i++) {
+
+            #foreach(${field} in ${model.fields})
+                #set($fund=$velocityCount - 1)
+            dataList[i][$fund] = String.valueOf(${display.uncapitalize(${model.className})}s.get(i).get${display.capitalize($field.modelName)}());
+            #end
+        }
+
+
+        ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
+        columnNumber, columnWidth, columnName, dataList, response);
+
+
+        }
+    }
 

+ 8 - 3
src/main/resources/templates/ListTemplate.vm

@@ -7,7 +7,7 @@
              #end
              #end*#
             <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-select placeholder="性别" size="small" v-model="filter2" clearable class="filter-item">
                 <el-option
                         label="女"
                         value="item1">
@@ -16,7 +16,7 @@
                         label="男"
                         value="item2">
                 </el-option>
-            </el-select>
+            </el-select>-->
             <el-button @click="showAdvancedQueryDialog = !showAdvancedQueryDialog" type="primary" size="small" icon="el-icon-search" class="filter-item">高级查询
             </el-button>
             <el-button @click="getData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
@@ -24,6 +24,8 @@
             <el-button @click="${esc.d}router.push('/${display.uncapitalize($model.className)}')" type="primary" size="small" icon="el-icon-edit"
                        class="filter-item">添加
             </el-button>
+            <el-button @click="exportExcel" type="primary" size="small" icon="el-icon-share" class="filter-item">导出EXCEL
+            </el-button>
             <el-dropdown trigger="click" size="medium" class="table-column-filter">
                 <span>
                   筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
@@ -277,7 +279,10 @@
 
                 this.getData();
                 this.showAdvancedQueryDialog = false;
-            }
+            },
+            exportExcel() {
+                window.location.href = this.$baseUrl + "/${display.uncapitalize($model.className)}/exportExcel?searchKey=" + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey
+            },
 
         }
     }

+ 151 - 7
src/main/vue/src/pages/TableShouyiYaopinxinxis.vue

@@ -2,8 +2,8 @@
     <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-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">
@@ -12,13 +12,16 @@
                         label="男"
                         value="item2">
                 </el-option>
-            </el-select>
-
+            </el-select>-->
+            <el-button @click="showAdvancedQueryDialog = !showAdvancedQueryDialog" type="primary" size="small" icon="el-icon-search" class="filter-item">高级查询
+            </el-button>
             <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-button @click="exportExcel" type="primary" size="small" icon="el-icon-share" class="filter-item">导出EXCEL
+            </el-button>
             <el-dropdown trigger="click" size="medium" class="table-column-filter">
                 <span>
                   筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
@@ -140,6 +143,53 @@
                     :total="totalNumber">
             </el-pagination>
         </div>
+        <el-dialog title="高级查询" :visible.sync="showAdvancedQueryDialog">
+            <el-button @click="addField" type="text" icon="el-icon-plus">添加</el-button>
+            <el-table :data="advancedQueryFields">
+
+                <el-table-column prop="link" label="链接符" align="center">
+                    <template slot-scope="{row}">
+                        <el-select placeholder="链接" size="small" v-model="row.link" class="filter-item">
+                            <el-option label="AND" value="AND">
+                            </el-option>
+                            <el-option label="OR" value="OR">
+                            </el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="name" label="字段" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.name">
+
+                            <el-option v-for="item in advancedQueryColumns" :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-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="value" label="参数" align="center">
+                    <template slot-scope="{row}">
+                        <el-input v-model="row.value"></el-input>
+                    </template>
+                </el-table-column>
+                <el-table-column width="60" align="center">
+                    <template slot-scope="{ row, column, $index }">
+                        <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+
+            <span slot="footer" class="dialog-footer">
+
+                <el-button @click="advancedQuery" :loading="$store.state.fetchingData">确定</el-button>
+            </span>
+        </el-dialog>
+
     </div>
 </template>
 <script>
@@ -215,7 +265,57 @@
                         show: true
                     },
                                     ],
-                multipleMode: false
+                multipleMode: false,
+                showAdvancedQueryDialog: false,
+                advancedQueryFields: [],
+                searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
+                advancedQueryColumns: [
+                                                                        {
+                                label: 'ID',
+                                value: 'ID'
+                            },
+                                                                                                {
+                                label: '药品编号',
+                                value: '药品编号'
+                            },
+                                                                                                {
+                                label: '药品名称',
+                                value: '药品名称'
+                            },
+                                                                                                {
+                                label: '计量单位',
+                                value: '计量单位'
+                            },
+                                                                                                {
+                                label: '规格',
+                                value: '规格'
+                            },
+                                                                                                {
+                                label: '主要成分',
+                                value: '主要成分'
+                            },
+                                                                                                {
+                                label: '有效成分',
+                                value: '有效成分'
+                            },
+                                                                                                {
+                                label: '单价',
+                                value: '单价'
+                            },
+                                                                                                {
+                                label: '生产厂家',
+                                value: '生产厂家'
+                            },
+                                                                                                {
+                                label: '药品制定部门',
+                                value: '药品制定部门'
+                            },
+                                                                                                {
+                                label: 'FlagColumn',
+                                value: 'FlagColumn'
+                            },
+                                                            ],
+                advancedQuerySearchKey: '',
             }
         },
         computed: {
@@ -226,6 +326,7 @@
         },
         methods: {
             pageSizeChange(size) {
+                this.currentPage = 1;
                 this.pageSize = size;
                 this.getData();
             },
@@ -238,7 +339,9 @@
                 url: '/tableShouyiYaopinxinxi/page',
                 data: {
                     currentPage: this.currentPage,
-                    pageNumber: this.pageSize
+                    pageNumber: this.pageSize,
+                    searchKey: this.filter1,
+                    advancedQuery: this.advancedQuerySearchKey,
                 }
                 }).then(res => {
                     if (res.success) {
@@ -273,7 +376,48 @@
             },
             operation2() {
                 this.$message('操作2');
-            }
+            },
+            addField() {
+                this.advancedQueryFields.push({
+                    link: 'AND',
+                    name: '',
+                    searchMethod: '=',
+                    value: '',
+                });
+            },
+            removeField(i) {
+                if (this.advancedQueryFields.length > 0) {
+                    this.advancedQueryFields.splice(i, 1);
+                }
+            },
+            advancedQuery() {
+
+                this.advancedQuerySearchKey = '';
+
+                if (this.advancedQueryFields.length > 0) {
+
+                    var templist = [];
+
+                    this.advancedQueryFields.forEach(item => {
+                        if (item.link && item.name && item.searchMethod && item.value) {
+                            var tempItem = item.link + '_,' + item.name + '_,' + item.searchMethod + '_,' + item.value;
+                            templist.push(tempItem);
+                        }
+                    })
+
+                    if (templist.length > 0) {
+
+                        this.advancedQuerySearchKey = templist.join('_;');
+                    }
+                }
+
+                this.getData();
+                this.showAdvancedQueryDialog = false;
+            },
+            exportExcel() {
+                window.location.href = this.$baseUrl + "/tableShouyiYaopinxinxi/exportExcel?searchKey=" + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey
+            },
+
         }
     }
 </script>

+ 160 - 198
src/main/vue/src/pages/TestAaas.vue

@@ -1,28 +1,26 @@
 <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-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 label="男" value="item2">
                 </el-option>
-            </el-select>
+            </el-select> -->
             <el-button @click="showAdvancedQueryDialog = !showAdvancedQueryDialog" type="primary" size="small" icon="el-icon-search" class="filter-item">高级查询
             </el-button>
             <el-button @click="getData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
             </el-button>
-            <el-button @click="$router.push('/testAaa')" type="primary" size="small" icon="el-icon-edit"
-                       class="filter-item">添加
+            <el-button @click="$router.push('/testAaa')" type="primary" size="small" icon="el-icon-edit" class="filter-item">添加
+            </el-button>
+            <el-button @click="exportExcel" type="primary" size="small" icon="el-icon-share" class="filter-item">导出EXCEL
             </el-button>
             <el-dropdown trigger="click" size="medium" class="table-column-filter">
                 <span>
-                  筛选数据<i class="el-icon-arrow-down el-icon--right"></i>
+                    筛选数据
+                    <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}}
@@ -30,50 +28,20 @@
                 </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 :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 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 v-if="isColumnShow('id')" prop="id" label="id" min-width="100">
             </el-table-column>
-                                                        <el-table-column
-                    v-if="isColumnShow('delFlag')"
-                    prop="delFlag"
-                    label="删除标识"
-                    min-width="100">
+            <el-table-column v-if="isColumnShow('delFlag')" prop="delFlag" label="删除标识" min-width="100">
             </el-table-column>
-                                                        <el-table-column
-                    v-if="isColumnShow('testName')"
-                    prop="testName"
-                    label="名字"
-                    min-width="100">
+            <el-table-column v-if="isColumnShow('testName')" prop="testName" label="名字" min-width="100">
             </el-table-column>
-                                                        <el-table-column
-                    v-if="isColumnShow('remark')"
-                    prop="remark"
-                    label="备注"
-                    min-width="100">
+            <el-table-column v-if="isColumnShow('remark')" prop="remark" label="备注" min-width="100">
             </el-table-column>
-                                        <el-table-column
-                    label="操作"
-                    align="center"
-                    fixed="right">
+            <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>
@@ -88,15 +56,7 @@
                     <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 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>
         <el-dialog title="高级查询" :visible.sync="showAdvancedQueryDialog">
@@ -149,86 +109,86 @@
     </div>
 </template>
 <script>
-    import {mapState} from 'vuex'
+import { mapState } from 'vuex'
 
-    export default {
-        created() {
+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: 'delFlag',
+                    show: true
+                },
+                {
+                    label: '名字',
+                    value: 'testName',
+                    show: true
+                },
+                {
+                    label: '备注',
+                    value: 'remark',
+                    show: true
+                },
+            ],
+            multipleMode: false,
+            showAdvancedQueryDialog: false,
+            advancedQueryFields: [],
+            searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
+            advancedQueryColumns: [
+                {
+                    label: 'id',
+                    value: 'id'
+                },
+                {
+                    label: '删除标识',
+                    value: 'del_flag'
+                },
+                {
+                    label: '名字',
+                    value: 'test_name'
+                },
+                {
+                    label: '备注',
+                    value: 'remark'
+                },
+            ],
+            advancedQuerySearchKey: '',
+        }
+    },
+    computed: {
+        ...mapState(['tableHeight']),
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        pageSizeChange(size) {
+            this.currentPage = 1;
+            this.pageSize = size;
             this.getData();
         },
-        data() {
-            return {
-                totalNumber: 0,
-                totalPage: 10,
-                currentPage: 1,
-                pageSize: 20,
-                tableData: [],
-                filter1: '',
-                filter2: '',
-                tableColumns: [
-                                        {
-                        label: 'id',
-                        value: 'id',
-                        show: true
-                    },
-                                                    {
-                        label: '删除标识',
-                        value: 'delFlag',
-                        show: true
-                    },
-                                                    {
-                        label: '名字',
-                        value: 'testName',
-                        show: true
-                    },
-                                                    {
-                        label: '备注',
-                        value: 'remark',
-                        show: true
-                    },
-                                    ],
-                multipleMode: false,
-                showAdvancedQueryDialog: false,
-                advancedQueryFields: [],
-                searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
-                advancedQueryColumns: [
-                                                                        {
-                                label: 'id',
-                                value: 'id'
-                            },
-                                                                                                {
-                                label: '删除标识',
-                                value: 'del_flag'
-                            },
-                                                                                                {
-                                label: '名字',
-                                value: 'test_name'
-                            },
-                                                                                                {
-                                label: '备注',
-                                value: 'remark'
-                            },
-                                                            ],
-                advancedQuerySearchKey: '',
-            }
-        },
-        computed: {
-            ...mapState(['tableHeight']),
-            selection() {
-                return this.$refs.table.selection.map(i => i.id);
-            }
+        currentPageChange(page) {
+            this.currentPage = page;
+            this.getData();
         },
-        methods: {
-            pageSizeChange(size) {
-                this.currentPage = 1;
-                this.pageSize = size;
-                this.getData();
-            },
-            currentPageChange(page) {
-                this.currentPage = page;
-                this.getData();
-            },
-            getData() {
-                this.$http.get({
+        getData() {
+            this.$http.get({
                 url: '/testAaa/page',
                 data: {
                     currentPage: this.currentPage,
@@ -236,81 +196,83 @@
                     searchKey: this.filter1,
                     advancedQuery: this.advancedQuerySearchKey,
                 }
-                }).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();
+            }).then(res => {
+                if (res.success) {
+                    this.totalNumber = res.data.page.totalNumber;
+                    this.tableData = res.data.pp;
                 }
-            },
-            editRow(row) {
-                this.$router.push({
-                    path: '/testAaa',
-                    query: {
-                        id: row.id
-                    }
-                })
-            },
-            operation1() {
-                this.$notify({
-                    title: '提示',
-                    message: this.selection
-                });
-            },
-            operation2() {
-                this.$message('操作2');
-            },
-            addField() {
-                this.advancedQueryFields.push({
-                    link: 'AND',
-                    name: '',
-                    searchMethod: '=',
-                    value: '',
-                });
-            },
-            removeField(i) {
-                if (this.advancedQueryFields.length > 0) {
-                    this.advancedQueryFields.splice(i, 1);
+            })
+        },
+        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: '/testAaa',
+                query: {
+                    id: row.id
                 }
-            },
-            advancedQuery() {
+            })
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        },
+        addField() {
+            this.advancedQueryFields.push({
+                link: 'AND',
+                name: '',
+                searchMethod: '=',
+                value: '',
+            });
+        },
+        removeField(i) {
+            if (this.advancedQueryFields.length > 0) {
+                this.advancedQueryFields.splice(i, 1);
+            }
+        },
+        advancedQuery() {
 
-                this.advancedQuerySearchKey = '';
+            this.advancedQuerySearchKey = '';
 
-                if (this.advancedQueryFields.length > 0) {
+            if (this.advancedQueryFields.length > 0) {
 
-                    var templist = [];
+                var templist = [];
 
-                    this.advancedQueryFields.forEach(item => {
-                        if (item.link && item.name && item.searchMethod && item.value) {
-                            var tempItem = item.link + '_,' + item.name + '_,' + item.searchMethod + '_,' + item.value;
-                            templist.push(tempItem);
-                        }
-                    })
+                this.advancedQueryFields.forEach(item => {
+                    if (item.link && item.name && item.searchMethod && item.value) {
+                        var tempItem = item.link + '_,' + item.name + '_,' + item.searchMethod + '_,' + item.value;
+                        templist.push(tempItem);
+                    }
+                })
 
-                    if (templist.length > 0) {
+                if (templist.length > 0) {
 
-                        this.advancedQuerySearchKey = templist.join('_;');
-                    }
+                    this.advancedQuerySearchKey = templist.join('_;');
                 }
-
-                this.getData();
-                this.showAdvancedQueryDialog = false;
             }
 
-        }
+            this.getData();
+            this.showAdvancedQueryDialog = false;
+        },
+        exportExcel() {
+            window.location.href = this.$baseUrl + "/testAaa/exportExcel?searchKey=" + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey
+        },
+
     }
+}
 </script>
 <style lang="less" scoped>
-
 </style>