Browse Source

查询接口修改、新增接口

Michael 8 years ago
parent
commit
68690b2455

+ 2 - 2
generatorConfig.xml

@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
 <generatorConfiguration>
-  <classPathEntry location="E:/mysql-connector-java-5.1.40.jar" />
+  <classPathEntry location="E:/mysql-connector-java-5.1.44.jar" />
   <context id="context1">	
     <jdbcConnection connectionURL="jdbc:mysql://192.168.1.213:3306/aft" 
     	driverClass="com.mysql.jdbc.Driver" password="123456" userId="dev" />
     <javaModelGenerator targetPackage="com.goafanti.common.model" targetProject="AFT" />
     <sqlMapGenerator targetPackage="com.goafanti.common.mapper" targetProject="AFT" />
     <javaClientGenerator targetPackage="com.goafanti.common.dao" targetProject="AFT" type="XMLMAPPER" />
-    <table schema="aft" tableName="user_identity"/>
+    <table schema="aft" tableName="organization_management"/>
   </context>
 </generatorConfiguration>

+ 83 - 1
src/main/java/com/goafanti/common/dao/OrganizationManagementMapper.java

@@ -1,5 +1,87 @@
 package com.goafanti.common.dao;
 
+import java.util.List;
+
+import com.goafanti.organization.bo.OrganizationListOut;
+import com.goafanti.common.model.OrganizationManagement;
+import com.goafanti.common.model.OrganizationManagementExample;
+import org.apache.ibatis.annotations.Param;
+
 public interface OrganizationManagementMapper {
-	int selectsuperId (String name);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	long countByExample(OrganizationManagementExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int deleteByExample(OrganizationManagementExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int deleteByPrimaryKey(String id);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int insert(OrganizationManagement record);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int insertSelective(OrganizationManagement record);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	List<OrganizationManagement> selectByExample(OrganizationManagementExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	OrganizationManagement selectByPrimaryKey(String id);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int updateByExampleSelective(@Param("record") OrganizationManagement record,
+			@Param("example") OrganizationManagementExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int updateByExample(@Param("record") OrganizationManagement record,
+			@Param("example") OrganizationManagementExample example);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int updateByPrimaryKeySelective(OrganizationManagement record);
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table organization_management
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	int updateByPrimaryKey(OrganizationManagement record);
+	List<OrganizationListOut> selectSuperId();
+	/**
+	 * 新增
+	 * @param olo
+	 * @return
+	 */
+	int insert1(OrganizationListOut olo);
+	/**
+	 * 根�组织�称查组织编�?
+	 */
+	String selectDepNoByName(String name);
+	/**
+	 * 查询相�上级下编�数�?
+	 */
+	int selectDepNoCount(String depNo);
+	/**
+	 * 根�组织�称查找负责�?
+	 */
+	String selectManagerIdByName(String name);
 }

+ 439 - 16
src/main/java/com/goafanti/common/mapper/OrganizationManagementMapper.xml

@@ -1,17 +1,411 @@
 <?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.goafanti.common.dao.OrganizationManagementMapper">
-	<select id="selectOrganizationList" resultType="com.goafanti.organization.bo.OrganizationListOut" parameterType="String">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.OrganizationManagement">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="create_id" jdbcType="VARCHAR" property="createId" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="deleted_sign" jdbcType="VARCHAR" property="deletedSign" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="type" jdbcType="VARCHAR" property="type" />
+    <result column="manager_id" jdbcType="VARCHAR" property="managerId" />
+    <result column="dep_no" jdbcType="VARCHAR" property="depNo" />
+    <result column="super_id" jdbcType="VARCHAR" property="superId" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="status" jdbcType="VARCHAR" property="status" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    <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>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    <where>
+      <foreach collection="example.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>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    id, create_id, create_time, update_time, deleted_sign, name, type, manager_id, dep_no, 
+    super_id, remarks, status
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.OrganizationManagementExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from organization_management
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from organization_management
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    delete from organization_management
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.OrganizationManagementExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    delete from organization_management
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.OrganizationManagement">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    insert into organization_management (id, create_id, create_time, 
+      update_time, deleted_sign, name, 
+      type, manager_id, dep_no, 
+      super_id, remarks, status
+      )
+    values (#{id,jdbcType=VARCHAR}, #{createId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{updateTime,jdbcType=TIMESTAMP}, #{deletedSign,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
+      #{type,jdbcType=VARCHAR}, #{managerId,jdbcType=VARCHAR}, #{depNo,jdbcType=VARCHAR}, 
+      #{superId,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.OrganizationManagement">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    insert into organization_management
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="createId != null">
+        create_id,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="updateTime != null">
+        update_time,
+      </if>
+      <if test="deletedSign != null">
+        deleted_sign,
+      </if>
+      <if test="name != null">
+        name,
+      </if>
+      <if test="type != null">
+        type,
+      </if>
+      <if test="managerId != null">
+        manager_id,
+      </if>
+      <if test="depNo != null">
+        dep_no,
+      </if>
+      <if test="superId != null">
+        super_id,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="status != null">
+        status,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="createId != null">
+        #{createId,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="deletedSign != null">
+        #{deletedSign,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="managerId != null">
+        #{managerId,jdbcType=VARCHAR},
+      </if>
+      <if test="depNo != null">
+        #{depNo,jdbcType=VARCHAR},
+      </if>
+      <if test="superId != null">
+        #{superId,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.OrganizationManagementExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    select count(*) from organization_management
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    update organization_management
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createId != null">
+        create_id = #{record.createId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.updateTime != null">
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.deletedSign != null">
+        deleted_sign = #{record.deletedSign,jdbcType=VARCHAR},
+      </if>
+      <if test="record.name != null">
+        name = #{record.name,jdbcType=VARCHAR},
+      </if>
+      <if test="record.type != null">
+        type = #{record.type,jdbcType=VARCHAR},
+      </if>
+      <if test="record.managerId != null">
+        manager_id = #{record.managerId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.depNo != null">
+        dep_no = #{record.depNo,jdbcType=VARCHAR},
+      </if>
+      <if test="record.superId != null">
+        super_id = #{record.superId,jdbcType=VARCHAR},
+      </if>
+      <if test="record.remarks != null">
+        remarks = #{record.remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="record.status != null">
+        status = #{record.status,jdbcType=VARCHAR},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    update organization_management
+    set id = #{record.id,jdbcType=VARCHAR},
+      create_id = #{record.createId,jdbcType=VARCHAR},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+      deleted_sign = #{record.deletedSign,jdbcType=VARCHAR},
+      name = #{record.name,jdbcType=VARCHAR},
+      type = #{record.type,jdbcType=VARCHAR},
+      manager_id = #{record.managerId,jdbcType=VARCHAR},
+      dep_no = #{record.depNo,jdbcType=VARCHAR},
+      super_id = #{record.superId,jdbcType=VARCHAR},
+      remarks = #{record.remarks,jdbcType=VARCHAR},
+      status = #{record.status,jdbcType=VARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrganizationManagement">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    update organization_management
+    <set>
+      <if test="createId != null">
+        create_id = #{createId,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateTime != null">
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="deletedSign != null">
+        deleted_sign = #{deletedSign,jdbcType=VARCHAR},
+      </if>
+      <if test="name != null">
+        name = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        type = #{type,jdbcType=VARCHAR},
+      </if>
+      <if test="managerId != null">
+        manager_id = #{managerId,jdbcType=VARCHAR},
+      </if>
+      <if test="depNo != null">
+        dep_no = #{depNo,jdbcType=VARCHAR},
+      </if>
+      <if test="superId != null">
+        super_id = #{superId,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OrganizationManagement">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Nov 30 11:09:29 CST 2017.
+    -->
+    update organization_management
+    set create_id = #{createId,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
+      deleted_sign = #{deletedSign,jdbcType=VARCHAR},
+      name = #{name,jdbcType=VARCHAR},
+      type = #{type,jdbcType=VARCHAR},
+      manager_id = #{managerId,jdbcType=VARCHAR},
+      dep_no = #{depNo,jdbcType=VARCHAR},
+      super_id = #{superId,jdbcType=VARCHAR},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      status = #{status,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+	<select id="selectOrganizationList" parameterType="String" resultType="com.goafanti.organization.bo.OrganizationListOut">
 		select
-		u.id as uid,om.id,om.create_id as createId,om.create_time as createTime,
+		om.id,om.create_id as createId,om.create_time as createTime,
 		om.update_time as updateTime,om.deleted_sign as deletedSign,
 		om.name,om.type,om.manager_id as managerId,
 		om.dep_no as depNo,
 		om.super_id as superId,
-		om.desc
-		from user u
-		left join organization_management om on om.id = u.id
+		om.remarks,om.status
+		from organization_management om 
 		where
+		om.deleted_sign = '0'
 		<if test="name !=null">
 			AND om.name=#{name,jdbcType=VARCHAR}
 		</if>
@@ -24,16 +418,16 @@
 		<if test="depNo !=null">
 			AND om.dep_no=#{depNo,jdbcType=VARCHAR}
 		</if>
+		<if test="page_sql != null">
+    		${page_sql}
+   		</if>
 	</select>
 	<select id="selectOrganizationCount" resultType="java.lang.Integer">
 		select
 		count(0)
-		from 
-		(select
-		id
-		from idorganization_management
-		)as a
+		from organization_management om
 		where
+		om.deleted_sign='0'
 		<if test="name !=null">
 			AND om.name=#{name,jdbcType=VARCHAR}
 		</if>
@@ -47,13 +441,42 @@
 			AND om.dep_no=#{depNo,jdbcType=VARCHAR}
 		</if>	
 	</select>
-	<select id="selectsuperId" resultType="String">
+	<select id="selectSuperId" resultType="com.goafanti.organization.bo.OrganizationListOut">
 		select
-		om.super_id
-		from organization_management om
+		id,name,dep_no as depNo
+		from organization_management
+	</select>
+	<insert id="insert1" parameterType="com.goafanti.organization.bo.OrganizationListOut">
+		insert into organization_management(
+		id,create_id,create_time,update_time,deleted_sign,
+		name,type,manager_id,dep_no,super_id,desc,status)
+		values(#{id,jdbcType=VARCHAR},#{createId,jdbcType=VARCHAR},
+		#{createTime,jdbcType=VARCHAR},#{updateTime,jdbcType=VARCHAR},
+		#{deletedSign,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},
+		#{type,jdbcType=VARCHAR},#{managerId,jdbcType=VARCHAR},
+		#{depNo,jdbcType=VARCHAR},#{superId,jdbcType=VARCHAR},
+		#{desc,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR})	
+	</insert>
+	<select id="selectDepNoByName" resultType="String">
+		select
+		dep_no as depNo
+		from organization_management
 		where
-		<if test="name !=null">
-			AND om.name=#{name,jdbcType=VARCHAR}
-		</if> 
+		name=#{name,jdbcType=VARCHAR}
+	</select>
+	<select id="selectDepNoCount" parameterType="String" resultType="java.lang.Integer">
+		select
+		count(0)
+		from organization_management
+		where
+		dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
+	</select>
+	<select id="selectManagerIdByName" resultType="String">
+		select
+		manager_id
+		from organization_management
+		where
+		name=#{name,jdbcType=VARCHAR}
 	</select>
+	
 </mapper>

+ 283 - 0
src/main/java/com/goafanti/common/model/OrganizationManagement.java

@@ -0,0 +1,283 @@
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+public class OrganizationManagement {
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.create_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String createId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.create_time
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private Date createTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.update_time
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private Date updateTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.deleted_sign
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String deletedSign;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.name
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String name;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.type
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String type;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.manager_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String managerId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.dep_no
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String depNo;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.super_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String superId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.remarks
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String remarks;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column organization_management.status
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	private String status;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.id
+	 * @return  the value of organization_management.id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.id
+	 * @param id  the value for organization_management.id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.create_id
+	 * @return  the value of organization_management.create_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getCreateId() {
+		return createId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.create_id
+	 * @param createId  the value for organization_management.create_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setCreateId(String createId) {
+		this.createId = createId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.create_time
+	 * @return  the value of organization_management.create_time
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.create_time
+	 * @param createTime  the value for organization_management.create_time
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.update_time
+	 * @return  the value of organization_management.update_time
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.update_time
+	 * @param updateTime  the value for organization_management.update_time
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.deleted_sign
+	 * @return  the value of organization_management.deleted_sign
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getDeletedSign() {
+		return deletedSign;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.deleted_sign
+	 * @param deletedSign  the value for organization_management.deleted_sign
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setDeletedSign(String deletedSign) {
+		this.deletedSign = deletedSign;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.name
+	 * @return  the value of organization_management.name
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.name
+	 * @param name  the value for organization_management.name
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.type
+	 * @return  the value of organization_management.type
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.type
+	 * @param type  the value for organization_management.type
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.manager_id
+	 * @return  the value of organization_management.manager_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getManagerId() {
+		return managerId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.manager_id
+	 * @param managerId  the value for organization_management.manager_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setManagerId(String managerId) {
+		this.managerId = managerId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.dep_no
+	 * @return  the value of organization_management.dep_no
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getDepNo() {
+		return depNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.dep_no
+	 * @param depNo  the value for organization_management.dep_no
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setDepNo(String depNo) {
+		this.depNo = depNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.super_id
+	 * @return  the value of organization_management.super_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getSuperId() {
+		return superId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.super_id
+	 * @param superId  the value for organization_management.super_id
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setSuperId(String superId) {
+		this.superId = superId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.remarks
+	 * @return  the value of organization_management.remarks
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getRemarks() {
+		return remarks;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.remarks
+	 * @param remarks  the value for organization_management.remarks
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column organization_management.status
+	 * @return  the value of organization_management.status
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public String getStatus() {
+		return status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column organization_management.status
+	 * @param status  the value for organization_management.status
+	 * @mbg.generated  Thu Nov 30 11:09:29 CST 2017
+	 */
+	public void setStatus(String status) {
+		this.status = status;
+	}
+}

File diff suppressed because it is too large
+ 1082 - 0
src/main/java/com/goafanti/common/model/OrganizationManagementExample.java


+ 25 - 13
src/main/java/com/goafanti/organization/bo/OrganizationListOut.java

@@ -8,9 +8,9 @@ public class OrganizationListOut {
 	/**创建人**/
 	private String createId;
 	/**创建时间**/
-	private String updateTime;
+	private String createTime;
 	/**更新时间**/
-	private String datetime;
+	private String updateTime;
 	/**删除标识**/
 	private String deletedSign;
 	/**组织名称**/
@@ -24,7 +24,9 @@ public class OrganizationListOut {
 	/**上级组织**/
 	private String superId;
 	/**组织职能说明**/
-	private String desc;
+	private String remarks;
+	/**组织状态**/
+	private String status;
 	public String getUid() {
 		return uid;
 	}
@@ -43,18 +45,18 @@ public class OrganizationListOut {
 	public void setCreateId(String createId) {
 		this.createId = createId;
 	}
+	public String getCreateTime() {
+		return createTime;
+	}
+	public void setCreateTime(String createTime) {
+		this.createTime = createTime;
+	}
 	public String getUpdateTime() {
 		return updateTime;
 	}
 	public void setUpdateTime(String updateTime) {
 		this.updateTime = updateTime;
 	}
-	public String getDatetime() {
-		return datetime;
-	}
-	public void setDatetime(String datetime) {
-		this.datetime = datetime;
-	}
 	public String getDeletedSign() {
 		return deletedSign;
 	}
@@ -91,11 +93,21 @@ public class OrganizationListOut {
 	public void setSuperId(String superId) {
 		this.superId = superId;
 	}
-	public String getDesc() {
-		return desc;
+	public String getRemarks() {
+		return remarks;
+	}
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+	public String getStatus() {
+		return status;
 	}
-	public void setDesc(String desc) {
-		this.desc = desc;
+	public void setStatus(String status) {
+		this.status = status;
 	}
+	
+	
+	
+	
 
 }

+ 21 - 6
src/main/java/com/goafanti/organization/controller/OrganizationManagementController.java

@@ -7,12 +7,14 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.utils.StringUtils;
 import com.goafanti.organization.bo.OrganizationListOut;
 import com.goafanti.organization.service.OrganizationService;
 
 @RestController
-@RequestMapping("api/admin/organization")
-public class OrganizationManagementController {
+@RequestMapping("open/api/admin/organization")
+public class OrganizationManagementController extends BaseApiController{
 	@Resource
 	private OrganizationService organizationService;
 	/**部门组织管理列表 **/
@@ -24,9 +26,22 @@ public class OrganizationManagementController {
 		return res;		
 	}
 	/**部门组织管理上级组织查询 **/
-	@RequestMapping(value = "/selectsuperId" , method = RequestMethod.POST)
-	public int selectsuperId(String name){
-		int superid=organizationService.selectsuperId(name);
-		return superid;
+	@RequestMapping(value = "/selectSuperId" , method = RequestMethod.POST)
+	public Result selectsuperId(){
+		Result res = new Result();
+		res.setData(organizationService.selectSuperId());
+		return res;
+	}
+	/**部门组织管理新增**/
+	@RequestMapping(value = "/addOrganization" , method = RequestMethod.POST)
+	public Result addOrganization(String name, String managerId, String type, String superId, String remarks) throws Exception{
+		Result res = new Result();
+		if(StringUtils.isBlank(name) || StringUtils.isBlank(type) 
+				|| StringUtils.isBlank(superId)){
+			res.getError().add(buildError("组织名称、组织类型、上级组织不能为空"));
+			return res;
+		}
+		organizationService.addOrganization(name, managerId, type, superId, remarks);
+		return res;
 	}
 }

+ 13 - 1
src/main/java/com/goafanti/organization/service/OrganizationService.java

@@ -1,5 +1,7 @@
 package com.goafanti.organization.service;
 
+import java.util.List;
+
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.organization.bo.OrganizationListOut;
 
@@ -14,5 +16,15 @@ public interface OrganizationService {
 	Pagination<OrganizationListOut> 
 	listOrganizationManagement(OrganizationListOut olo,Integer pageNo, Integer pageSize);
 	/**组织名称查上级组织*/
-	int selectsuperId (String name);
+	List<OrganizationListOut> selectSuperId();
+	/**
+	 * 
+	 * @param name 组织名称
+	 * @param managerId 负责人ID
+	 * @param type 组织类型
+	 * @param superId 上级组织
+	 * @param desc 组织职能说明
+	 * @return
+	 */
+	int addOrganization(String name,String managerId,String type,String superId,String desc);
 }

+ 57 - 15
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -1,8 +1,12 @@
 package com.goafanti.organization.service.impl;
 
+import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.core.mybatis.page.Pagination;
@@ -10,16 +14,17 @@ import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.organization.bo.OrganizationListOut;
 import com.goafanti.organization.service.OrganizationService;
 import com.goafanti.common.dao.OrganizationManagementMapper;
-import com.goafanti.common.dao.UserMapper;
+import com.goafanti.common.model.OrganizationManagement;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 @Service
-public class OrganizationServiceImpl extends BaseMybatisDao<UserMapper> implements OrganizationService {
+public class OrganizationServiceImpl extends BaseMybatisDao<OrganizationManagementMapper> implements OrganizationService {
+	@Autowired
 	private OrganizationManagementMapper organizationManagementMapper;
 	@Override
 	public Pagination<OrganizationListOut> listOrganizationManagement(OrganizationListOut olo, Integer pageNo,
 			Integer pageSize) {
-		olo.setId(TokenManager.getAdminId());
+		/*olo.setCreateId(TokenManager.getAdminId());*/
 		Map<String,Object> params =disposeParams(olo);
 		@SuppressWarnings("unchecked")
 		Pagination<OrganizationListOut> list=(Pagination<OrganizationListOut>)findPage("selectOrganizationList","selectOrganizationCount",params,pageNo,pageSize);
@@ -28,22 +33,59 @@ public class OrganizationServiceImpl extends BaseMybatisDao<UserMapper> implemen
 	private Map<String,Object> disposeParams(OrganizationListOut olo){
 		Map<String,Object> params = new HashMap<String, Object>();		
 		if(StringUtils.isNotBlank(olo.getId())) params.put("id", olo.getId());
-		if(StringUtils.isNotBlank(olo.getCreateId())) params.put("id", olo.getCreateId());
-		if(StringUtils.isNotBlank(olo.getUpdateTime())) params.put("id", olo.getUpdateTime());
-		if(StringUtils.isNotBlank(olo.getDatetime())) params.put("id", olo.getDatetime());
-		if(StringUtils.isNotBlank(olo.getDeletedSign())) params.put("id", olo.getDeletedSign());
-		if(StringUtils.isNotBlank(olo.getName())) params.put("id", olo.getName());
+		if(StringUtils.isNotBlank(olo.getCreateId())) params.put("createId", olo.getCreateId());
+		if(StringUtils.isNotBlank(olo.getCreateTime())) params.put("createTime", olo.getCreateTime());
+		if(StringUtils.isNotBlank(olo.getUpdateTime())) params.put("updateTime", olo.getUpdateTime());
+		if(StringUtils.isNotBlank(olo.getDeletedSign())) params.put("deletedSign", olo.getDeletedSign());
+		if(StringUtils.isNotBlank(olo.getName())) params.put("name", olo.getName());
 		if(StringUtils.isNotBlank(olo.getType())) params.put("type", olo.getType());
-		if(StringUtils.isNotBlank(olo.getManagerId())) params.put("id", olo.getManagerId());
-		if(StringUtils.isNotBlank(olo.getDepNo())) params.put("id", olo.getDepNo());
-		if(StringUtils.isNotBlank(olo.getSuperId())) params.put("id", olo.getSuperId());
-		if(StringUtils.isNotBlank(olo.getDesc())) params.put("id", olo.getDesc());
+		if(StringUtils.isNotBlank(olo.getManagerId())) params.put("managerId", olo.getManagerId());
+		if(StringUtils.isNotBlank(olo.getDepNo())) params.put("depNo", olo.getDepNo());
+		if(StringUtils.isNotBlank(olo.getSuperId())) params.put("superId", olo.getSuperId());
+		if(StringUtils.isNotBlank(olo.getRemarks())) params.put("remarks", olo.getRemarks());
+		if(StringUtils.isNotBlank(olo.getStatus())) params.put("status", olo.getStatus());
 		return params;
 	}
 	@Override
-	public int selectsuperId(String name) {
-		int superid=(int)organizationManagementMapper.selectsuperId(name);
-		return superid;
+	public List<OrganizationListOut> selectSuperId() {
+		return organizationManagementMapper.selectSuperId();
+	}
+	/**
+	 *   XXIn form 提交 ,bo包中
+	 *   xxOut 输出 bo包中
+	 *   domain 类 model中
+	 *
+	 */
+	@Override
+	public int addOrganization(String name, String managerId, String type, String superId, String remarks) {
+		String id = UUID.randomUUID().toString();
+		Date now = new Date();
+		OrganizationManagement om=new OrganizationManagement(); 
+		om.setId(id);
+		om.setCreateId(TokenManager.getAdminId());
+		/*om.setCreateId("123");*/
+		om.setCreateTime(now);
+		om.setUpdateTime(now);
+		om.setDeletedSign("0");
+		om.setName(name);
+		om.setType(type);
+		om.setManagerId(managerId);
+		if(superId!=null){
+			String sdepNo=organizationManagementMapper.selectDepNoByName(superId);
+			int Count=organizationManagementMapper.selectDepNoCount(sdepNo);
+			if(Count<10){
+			om.setDepNo(sdepNo+"0"+Count);
+			}if(Count>=10){
+				om.setDepNo(sdepNo+Count);
+			}	
+		}else{
+			om.setDepNo("null");
+		}
+		om.setSuperId(superId);
+		om.setRemarks(remarks);
+		om.setStatus("0");
+		organizationManagementMapper.insert(om);
+		return 1;
 	}