From 7894fc69ea496dbcc024870d002850af71b68f49 Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Fri, 08 Dec 2017 17:31:37 +0800
Subject: [PATCH] app 接口

---
 src/main/resources/mapper/OrganizationMapper.xml |  350 ++--------------------------------------------------------
 1 files changed, 13 insertions(+), 337 deletions(-)

diff --git a/src/main/resources/mapper/OrganizationMapper.xml b/src/main/resources/mapper/OrganizationMapper.xml
index aa64439..cfbdada 100644
--- a/src/main/resources/mapper/OrganizationMapper.xml
+++ b/src/main/resources/mapper/OrganizationMapper.xml
@@ -1,338 +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.moral.mapper.OrganizationMapper" >
-  <resultMap id="BaseResultMap" type="com.moral.entity.Organization" >
-    <id column="id" property="id" jdbcType="INTEGER" />
-    <result column="name" property="name" jdbcType="VARCHAR" />
-    <result column="rank" property="rank" jdbcType="INTEGER" />
-    <result column="province_code" property="provinceCode" jdbcType="INTEGER" />
-    <result column="city_code" property="cityCode" jdbcType="INTEGER" />
-    <result column="area_code" property="areaCode" jdbcType="INTEGER" />
-    <result column="address" property="address" jdbcType="VARCHAR" />
-    <result column="telephone" property="telephone" jdbcType="VARCHAR" />
-    <result column="email" property="email" jdbcType="VARCHAR" />
-    <result column="is_delete" property="isDelete" jdbcType="CHAR" />
-    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
-    <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP" />
-    <result column="description" property="description" jdbcType="VARCHAR" />
-  </resultMap>
-  <sql id="Example_Where_Clause" >
-    <where >
-      <foreach collection="oredCriteria" item="criteria" separator="or" >
-        <if test="criteria.valid" >
-          <trim prefix="(" suffix=")" prefixOverrides="and" >
-            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </where>
-  </sql>
-  <sql id="Update_By_Example_Where_Clause" >
-    <where >
-      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
-        <if test="criteria.valid" >
-          <trim prefix="(" suffix=")" prefixOverrides="and" >
-            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
-                    #{listItem}
-                  </foreach>
-                </when>
-              </choose>
-            </foreach>
-          </trim>
-        </if>
-      </foreach>
-    </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>
-  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.entity.OrganizationExample" >
-    select
-    <if test="distinct" >
-      distinct
-    </if>
-    <include refid="Base_Column_List" />
-    from organization
-    <if test="_parameter != null" >
-      <include refid="Example_Where_Clause" />
-    </if>
-    <if test="orderByClause != null" >
-      order by ${orderByClause}
-    </if>
-  </select>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
-    select 
-    <include refid="Base_Column_List" />
-    from organization
-    where id = #{id,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
-    delete from organization
-    where id = #{id,jdbcType=INTEGER}
-  </delete>
-  <delete id="deleteByExample" parameterType="com.moral.entity.OrganizationExample" >
-    delete from organization
-    <if test="_parameter != null" >
-      <include refid="Example_Where_Clause" />
-    </if>
-  </delete>
-  <insert id="insert" parameterType="com.moral.entity.Organization" >
-    insert into organization (id, name, rank, 
-      province_code, city_code, area_code, 
-      address, telephone, email, 
-      is_delete, create_time, expire_time, 
-      description)
-    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{rank,jdbcType=INTEGER}, 
-      #{provinceCode,jdbcType=INTEGER}, #{cityCode,jdbcType=INTEGER}, #{areaCode,jdbcType=INTEGER}, 
-      #{address,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, 
-      #{isDelete,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{expireTime,jdbcType=TIMESTAMP}, 
-      #{description,jdbcType=VARCHAR})
-  </insert>
-  <insert id="insertSelective" parameterType="com.moral.entity.Organization" >
-    insert into organization
-    <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
-        id,
-      </if>
-      <if test="name != null" >
-        name,
-      </if>
-      <if test="rank != null" >
-        rank,
-      </if>
-      <if test="provinceCode != null" >
-        province_code,
-      </if>
-      <if test="cityCode != null" >
-        city_code,
-      </if>
-      <if test="areaCode != null" >
-        area_code,
-      </if>
-      <if test="address != null" >
-        address,
-      </if>
-      <if test="telephone != null" >
-        telephone,
-      </if>
-      <if test="email != null" >
-        email,
-      </if>
-      <if test="isDelete != null" >
-        is_delete,
-      </if>
-      <if test="createTime != null" >
-        create_time,
-      </if>
-      <if test="expireTime != null" >
-        expire_time,
-      </if>
-      <if test="description != null" >
-        description,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
-        #{id,jdbcType=INTEGER},
-      </if>
-      <if test="name != null" >
-        #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="rank != null" >
-        #{rank,jdbcType=INTEGER},
-      </if>
-      <if test="provinceCode != null" >
-        #{provinceCode,jdbcType=INTEGER},
-      </if>
-      <if test="cityCode != null" >
-        #{cityCode,jdbcType=INTEGER},
-      </if>
-      <if test="areaCode != null" >
-        #{areaCode,jdbcType=INTEGER},
-      </if>
-      <if test="address != null" >
-        #{address,jdbcType=VARCHAR},
-      </if>
-      <if test="telephone != null" >
-        #{telephone,jdbcType=VARCHAR},
-      </if>
-      <if test="email != null" >
-        #{email,jdbcType=VARCHAR},
-      </if>
-      <if test="isDelete != null" >
-        #{isDelete,jdbcType=CHAR},
-      </if>
-      <if test="createTime != null" >
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="expireTime != null" >
-        #{expireTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="description != null" >
-        #{description,jdbcType=VARCHAR},
-      </if>
-    </trim>
-  </insert>
-  <select id="countByExample" parameterType="com.moral.entity.OrganizationExample" resultType="java.lang.Integer" >
-    select count(*) from organization
-    <if test="_parameter != null" >
-      <include refid="Example_Where_Clause" />
-    </if>
-  </select>
-  <update id="updateByExampleSelective" parameterType="map" >
-    update organization
-    <set >
-      <if test="record.id != null" >
-        id = #{record.id,jdbcType=INTEGER},
-      </if>
-      <if test="record.name != null" >
-        name = #{record.name,jdbcType=VARCHAR},
-      </if>
-      <if test="record.rank != null" >
-        rank = #{record.rank,jdbcType=INTEGER},
-      </if>
-      <if test="record.provinceCode != null" >
-        province_code = #{record.provinceCode,jdbcType=INTEGER},
-      </if>
-      <if test="record.cityCode != null" >
-        city_code = #{record.cityCode,jdbcType=INTEGER},
-      </if>
-      <if test="record.areaCode != null" >
-        area_code = #{record.areaCode,jdbcType=INTEGER},
-      </if>
-      <if test="record.address != null" >
-        address = #{record.address,jdbcType=VARCHAR},
-      </if>
-      <if test="record.telephone != null" >
-        telephone = #{record.telephone,jdbcType=VARCHAR},
-      </if>
-      <if test="record.email != null" >
-        email = #{record.email,jdbcType=VARCHAR},
-      </if>
-      <if test="record.isDelete != null" >
-        is_delete = #{record.isDelete,jdbcType=CHAR},
-      </if>
-      <if test="record.createTime != null" >
-        create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.expireTime != null" >
-        expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="record.description != null" >
-        description = #{record.description,jdbcType=VARCHAR},
-      </if>
-    </set>
-    <if test="_parameter != null" >
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByExample" parameterType="map" >
-    update organization
-    set id = #{record.id,jdbcType=INTEGER},
-      name = #{record.name,jdbcType=VARCHAR},
-      rank = #{record.rank,jdbcType=INTEGER},
-      province_code = #{record.provinceCode,jdbcType=INTEGER},
-      city_code = #{record.cityCode,jdbcType=INTEGER},
-      area_code = #{record.areaCode,jdbcType=INTEGER},
-      address = #{record.address,jdbcType=VARCHAR},
-      telephone = #{record.telephone,jdbcType=VARCHAR},
-      email = #{record.email,jdbcType=VARCHAR},
-      is_delete = #{record.isDelete,jdbcType=CHAR},
-      create_time = #{record.createTime,jdbcType=TIMESTAMP},
-      expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
-      description = #{record.description,jdbcType=VARCHAR}
-    <if test="_parameter != null" >
-      <include refid="Update_By_Example_Where_Clause" />
-    </if>
-  </update>
-  <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.Organization" >
-    update organization
-    <set >
-      <if test="name != null" >
-        name = #{name,jdbcType=VARCHAR},
-      </if>
-      <if test="rank != null" >
-        rank = #{rank,jdbcType=INTEGER},
-      </if>
-      <if test="provinceCode != null" >
-        province_code = #{provinceCode,jdbcType=INTEGER},
-      </if>
-      <if test="cityCode != null" >
-        city_code = #{cityCode,jdbcType=INTEGER},
-      </if>
-      <if test="areaCode != null" >
-        area_code = #{areaCode,jdbcType=INTEGER},
-      </if>
-      <if test="address != null" >
-        address = #{address,jdbcType=VARCHAR},
-      </if>
-      <if test="telephone != null" >
-        telephone = #{telephone,jdbcType=VARCHAR},
-      </if>
-      <if test="email != null" >
-        email = #{email,jdbcType=VARCHAR},
-      </if>
-      <if test="isDelete != null" >
-        is_delete = #{isDelete,jdbcType=CHAR},
-      </if>
-      <if test="createTime != null" >
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="expireTime != null" >
-        expire_time = #{expireTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="description != null" >
-        description = #{description,jdbcType=VARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.moral.entity.Organization" >
-    update organization
-    set name = #{name,jdbcType=VARCHAR},
-      rank = #{rank,jdbcType=INTEGER},
-      province_code = #{provinceCode,jdbcType=INTEGER},
-      city_code = #{cityCode,jdbcType=INTEGER},
-      area_code = #{areaCode,jdbcType=INTEGER},
-      address = #{address,jdbcType=VARCHAR},
-      telephone = #{telephone,jdbcType=VARCHAR},
-      email = #{email,jdbcType=VARCHAR},
-      is_delete = #{isDelete,jdbcType=CHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      expire_time = #{expireTime,jdbcType=TIMESTAMP},
-      description = #{description,jdbcType=VARCHAR}
-    where id = #{id,jdbcType=INTEGER}
-  </update>
+<?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">
+	<select id="getOrganizationsByAreaName" resultType="com.moral.entity.Organization">
+		SELECT
+			o.* 
+		FROM
+			organization o,
+			area a 
+		WHERE
+			o.area_code = a.area_code 
+		AND a.area_name = #{areaName}
+	</select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0