From dba54bf8c8f9299d61c05bf3a941708ea399c998 Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Sun, 26 Apr 2020 15:20:22 +0800
Subject: [PATCH] update excel多个工作表导出

---
 src/main/resources/mapper/OrganizationMapper.xml |  175 +++++++++++++++++++++++++++++++---------------------------
 1 files changed, 93 insertions(+), 82 deletions(-)

diff --git a/src/main/resources/mapper/OrganizationMapper.xml b/src/main/resources/mapper/OrganizationMapper.xml
index 7865ab7..3450060 100644
--- a/src/main/resources/mapper/OrganizationMapper.xml
+++ b/src/main/resources/mapper/OrganizationMapper.xml
@@ -1,106 +1,117 @@
 <?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.moral.mapper.OrganizationMapper">
-  <resultMap id="BaseResultMap" type="com.moral.entity.Organization">
-    <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="rank" jdbcType="INTEGER" property="rank" />
-    <result column="province_code" jdbcType="INTEGER" property="provinceCode" />
-    <result column="city_code" jdbcType="INTEGER" property="cityCode" />
-    <result column="area_code" jdbcType="INTEGER" property="areaCode" />
-    <result column="town_code" jdbcType="BIGINT" property="townCode" />
-    <result column="village_code" jdbcType="BIGINT" property="villageCode" />
-    <result column="address" jdbcType="VARCHAR" property="address" />
-    <result column="telephone" jdbcType="VARCHAR" property="telephone" />
-    <result column="email" jdbcType="VARCHAR" property="email" />
-    <result column="is_delete" jdbcType="CHAR" property="isDelete" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
-    <result column="description" jdbcType="VARCHAR" property="description" />
-      <!-- ������������������������������ -->
-      <association property="areaNames" javaType="com.moral.entity.AreaNames">
-          <result column="province_name" property="provinceName" jdbcType="VARCHAR" />
-          <result column="city_name" property="cityName" jdbcType="VARCHAR" />
-          <result column="area_name" property="areaName" jdbcType="VARCHAR" />
-          <result column="town_name" property="townName" jdbcType="VARCHAR" />
-          <result column="village_name" property="villageName" jdbcType="VARCHAR" />
-      </association>
-  </resultMap>
-  <sql id="Example_Where_Clause">
-    <where>
-      <foreach collection="oredCriteria" item="criteria" separator="or">
-        <if test="criteria.valid">
-          <trim prefix="(" prefixOverrides="and" suffix=")">
-            <foreach collection="criteria.criteria" item="criterion">
-              <choose>
-                <when test="criterion.noValue">
-                  and ${criterion.condition}
-                </when>
-                <when test="criterion.singleValue">
-                  and ${criterion.condition} #{criterion.value}
-                </when>
-                <when test="criterion.betweenValue">
-                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
-                </when>
-                <when test="criterion.listValue">
-                  and ${criterion.condition}
-                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+    <resultMap id="BaseResultMap" type="com.moral.entity.Organization">
+        <id column="id" jdbcType="INTEGER" property="id"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="rank" jdbcType="INTEGER" property="rank"/>
+        <result column="province_code" jdbcType="INTEGER" property="provinceCode"/>
+        <result column="city_code" jdbcType="INTEGER" property="cityCode"/>
+        <result column="area_code" jdbcType="INTEGER" property="areaCode"/>
+        <result column="town_code" jdbcType="BIGINT" property="townCode"/>
+        <result column="village_code" jdbcType="BIGINT" property="villageCode"/>
+        <result column="address" jdbcType="VARCHAR" property="address"/>
+        <result column="telephone" jdbcType="VARCHAR" property="telephone"/>
+        <result column="email" jdbcType="VARCHAR" property="email"/>
+        <result column="is_delete" jdbcType="CHAR" property="isDelete"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
+        <result column="description" jdbcType="VARCHAR" property="description"/>
+        <!-- ������������������������������ -->
+        <association property="areaNames" javaType="com.moral.entity.AreaNames">
+            <result column="province_name" property="provinceName" jdbcType="VARCHAR"/>
+            <result column="city_name" property="cityName" jdbcType="VARCHAR"/>
+            <result column="area_name" property="areaName" jdbcType="VARCHAR"/>
+            <result column="town_name" property="townName" jdbcType="VARCHAR"/>
+            <result column="village_name" property="villageName" jdbcType="VARCHAR"/>
+        </association>
+    </resultMap>
+    <sql id="Example_Where_Clause">
+        <where>
+            <foreach collection="oredCriteria" item="criteria" separator="or">
+                <if test="criteria.valid">
+                    <trim prefix="(" prefixOverrides="and" suffix=")">
+                        <foreach collection="criteria.criteria" item="criterion">
+                            <choose>
+                                <when test="criterion.noValue">
+                                    and ${criterion.condition}
+                                </when>
+                                <when test="criterion.singleValue">
+                                    and ${criterion.condition} #{criterion.value}
+                                </when>
+                                <when test="criterion.betweenValue">
+                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                                </when>
+                                <when test="criterion.listValue">
+                                    and ${criterion.condition}
+                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
+                                             separator=",">
                     #{listItem}
                   </foreach>
-                </when>
-              </choose>
+                                </when>
+                            </choose>
+                        </foreach>
+                    </trim>
+                </if>
             </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Base_Column_List">
+        </where>
+    </sql>
+    <sql id="Base_Column_List">
     id, name, rank, province_code, city_code, area_code, address, telephone, email, is_delete, 
     create_time, expire_time, description
   </sql>
-   <sql id="Relation_Province_City_Area_List">
+    <sql id="Relation_Province_City_Area_List">
        are.area_name, cti.city_name, pro.province_name,tow.town_name,vil.village_name
   </sql>
-  <select id="selectWithAreaNameByExample" parameterType="tk.mybatis.mapper.entity.Example" resultMap="BaseResultMap">
-    select
-    <if test="distinct">
+    <select id="selectWithAreaNameByExample" parameterType="tk.mybatis.mapper.entity.Example" resultMap="BaseResultMap">
+        select
+        <if test="distinct">
       distinct
     </if>
-      organization.*
-      ,
-      <include refid="Relation_Province_City_Area_List" />
-      from organization
-      left join village vil on organization.village_code = vil.village_code
-      left join town tow on organization.town_code = tow.town_code
-      left join area are on organization.area_code = are.area_code
-      left join city cti on organization.city_code = cti.city_code
-      left join province pro on organization.province_code = pro.province_code
-    <if test="_parameter != null">
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null">
+        organization.*
+        ,
+        <include refid="Relation_Province_City_Area_List"/>
+        from organization
+        left join village vil on organization.village_code = vil.village_code
+        left join town tow on organization.town_code = tow.town_code
+        left join area are on organization.area_code = are.area_code
+        left join city cti on organization.city_code = cti.city_code
+        left join province pro on organization.province_code = pro.province_code
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause"/>
+        </if>
+        <if test="orderByClause != null">
       order by ${orderByClause}
     </if>
-  </select>
-  	<select id="getOrganizationsByAreaName" resultType="com.moral.entity.Organization">
-		SELECT
-			o.*
-		FROM
-			organization o,
-			area a
-		<if test="cityName != null">
+    </select>
+    <select id="getOrganizationsByAreaName" resultType="com.moral.entity.Organization">
+        SELECT
+        o.*
+        FROM
+        organization o,
+        area a
+        <if test="cityName != null">
 			,city c
 		</if>
-		WHERE
-			o.area_code = a.area_code
-			AND a.area_name = #{areaName}
-		<if test="cityName != null">
+        WHERE
+        o.area_code = a.area_code
+        AND a.area_name = #{areaName}
+        <if test="cityName != null">
 			AND c.city_name = #{cityName}
 			AND o.city_code = c.city_code
 		</if>
-	</select>
+    </select>
     <select id="selectLowerOrgIds" resultType="java.lang.Integer">
             call proc_lowerOrgIds_GetByOrgId(#{orgId,jdbcType=INTEGER});
     </select>
+
+    <select id="getOrganizationList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from organization
+        where is_delete=0
+        <if test="organizationName != 'null'">
+            and name like concat('%',#{organizationName},'%')
+        </if>
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0