|
@@ -3,102 +3,120 @@
|
|
|
<mapper namespace="com.jiuzhekan.cbkj.mapper.sysApp.SysDepartmentMapper">
|
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.jiuzhekan.cbkj.beans.sysExt.SysDepartment">
|
|
|
- <id column="DEP_ID" jdbcType="VARCHAR" property="depId" />
|
|
|
- <result column="dept_name" jdbcType="VARCHAR" property="deptName" />
|
|
|
- <result column="APP_ID" jdbcType="VARCHAR" property="appId" />
|
|
|
- <result column="INS_CODE" jdbcType="VARCHAR" property="insCode" />
|
|
|
- <result column="DEP_ORIGIN_ID" jdbcType="VARCHAR" property="depOriginId" />
|
|
|
- <result column="DEP_PARENT_ID" jdbcType="VARCHAR" property="depParentId" />
|
|
|
- <result column="DEP_PARENT_NAME" jdbcType="VARCHAR" property="depParentName" />
|
|
|
- <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
|
|
|
- <result column="CREATE_USER" jdbcType="VARCHAR" property="createUser" />
|
|
|
- <result column="CREATE_USERNAME" jdbcType="VARCHAR" property="createUsername" />
|
|
|
- <result column="status" jdbcType="VARCHAR" property="status" />
|
|
|
- <result column="APP_NAME" jdbcType="VARCHAR" property="appName" />
|
|
|
- <result column="INS_NAME" jdbcType="VARCHAR" property="insName" />
|
|
|
- <result column="ins_parent_code" jdbcType="VARCHAR" property="insParentCode" />
|
|
|
- <result column="DEPT_ID" jdbcType="VARCHAR" property="deptId" />
|
|
|
+ <!--<id column="DEP_ID" jdbcType="VARCHAR" property="deptId" />-->
|
|
|
+ <id column="dept_id" jdbcType="VARCHAR" property="deptId"/>
|
|
|
+ <result column="dept_name" jdbcType="VARCHAR" property="deptName"/>
|
|
|
+ <result column="APP_ID" jdbcType="VARCHAR" property="appId"/>
|
|
|
+ <result column="INS_CODE" jdbcType="VARCHAR" property="insCode"/>
|
|
|
+ <result column="dept_origin_id" jdbcType="VARCHAR" property="depOriginId"/>
|
|
|
+ <result column="dept_parent_id" jdbcType="VARCHAR" property="depParentId"/>
|
|
|
+ <result column="dept_parent_name" jdbcType="VARCHAR" property="depParentName"/>
|
|
|
+ <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate"/>
|
|
|
+ <result column="CREATE_USER" jdbcType="VARCHAR" property="createUser"/>
|
|
|
+ <result column="create_user_name" jdbcType="VARCHAR" property="createUserName"/>
|
|
|
+ <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
|
|
|
+ <result column="update_user" jdbcType="VARCHAR" property="updateUser"/>
|
|
|
+ <result column="update_user_name" jdbcType="VARCHAR" property="updateUserName"/>
|
|
|
+ <result column="status" jdbcType="VARCHAR" property="status"/>
|
|
|
+ <result column="dept_type" jdbcType="VARCHAR" property="deptType"/>
|
|
|
+ <result column="APP_NAME" jdbcType="VARCHAR" property="appName"/>
|
|
|
+ <result column="INS_NAME" jdbcType="VARCHAR" property="insName"/>
|
|
|
+ <result column="ins_parent_code" jdbcType="VARCHAR" property="insParentCode"/>
|
|
|
+
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="BaseResultMap2" type="com.jiuzhekan.cbkj.beans.sysExt.SysHisDepartment">
|
|
|
- <id column="ID" jdbcType="VARCHAR" property="id" />
|
|
|
- <result column="DEP_ID" jdbcType="VARCHAR" property="depId" />
|
|
|
- <result column="DEP_ID_HIS" jdbcType="VARCHAR" property="depIdHis" />
|
|
|
- <result column="dept_name" jdbcType="VARCHAR" property="deptName" />
|
|
|
- <result column="DEP_INS_NAME" jdbcType="VARCHAR" property="depInsName" />
|
|
|
+ <id column="ID" jdbcType="VARCHAR" property="id"/>
|
|
|
+ <result column="DEP_ID" jdbcType="VARCHAR" property="depId"/>
|
|
|
+ <result column="DEP_ID_HIS" jdbcType="VARCHAR" property="depIdHis"/>
|
|
|
+ <result column="dept_name" jdbcType="VARCHAR" property="depName"/>
|
|
|
+ <result column="DEP_INS_NAME" jdbcType="VARCHAR" property="depInsName"/>
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
- DEP_ID,dept_name,APP_ID,INS_CODE,DEP_ORIGIN_ID,DEP_PARENT_ID,DEP_PARENT_NAME,CREATE_DATE,CREATE_USER,CREATE_USERNAME,status
|
|
|
+ dept_id
|
|
|
+ ,dept_name,APP_ID,INS_CODE,dept_origin_id,dept_parent_id,dept_parent_name,CREATE_DATE,CREATE_USER,create_user_name,updateDate,updateUser,updateUserName,status,dept_type
|
|
|
</sql>
|
|
|
|
|
|
<delete id="deleteByPrimaryKey" parameterType="SysDepartment">
|
|
|
- delete from sys_department where DEP_ID = #{ depId }
|
|
|
+ delete
|
|
|
+ from sys_department
|
|
|
+ where dept_id = #{deptId}
|
|
|
</delete>
|
|
|
|
|
|
<!--根据主键批量删除-->
|
|
|
<delete id="deleteBylist" parameterType="ArrayList">
|
|
|
- delete from sys_department where DEP_ID in
|
|
|
+ delete from sys_department where dept_id in
|
|
|
<foreach collection="array" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
+ #{item}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
|
|
|
<!--单个插入-->
|
|
|
- <insert id="insert" parameterType="SysDepartment">
|
|
|
- insert into sys_department (DEP_ID,dept_name,APP_ID,INS_CODE,DEP_ORIGIN_ID,DEP_PARENT_ID,DEP_PARENT_NAME,CREATE_DATE,CREATE_USER,CREATE_USERNAME,status) values
|
|
|
- (#{depId},#{deptName},#{appId},#{insCode},#{depOriginId},#{depParentId},#{depParentName},#{createDate},#{createUser},#{createUsername},#{updateUsername},#{status})
|
|
|
+ <insert id="insert" parameterType="SysDepartment">
|
|
|
+ insert into sys_department (dept_id, dept_name, APP_ID, INS_CODE, dept_origin_id, dept_parent_id, dept_parent_name,
|
|
|
+ CREATE_DATE, CREATE_USER, create_user_name, update_date, update_user,
|
|
|
+ update_user_name, status,dept_type)
|
|
|
+ values (#{deptId}, #{deptName}, #{appId}, #{insCode}, #{depOriginId}, #{depParentId}, #{depParentName},
|
|
|
+ #{createDate}, #{createUser}, #{createUserName}, #{updateDate}, #{updateUser}, #{updateUserName},
|
|
|
+ #{status},#{deptType})
|
|
|
</insert>
|
|
|
|
|
|
<!--批量插入-->
|
|
|
<insert id="insertList" parameterType="List">
|
|
|
- insert into sys_department (DEP_ID,dept_name,APP_ID,INS_CODE,DEP_ORIGIN_ID,DEP_PARENT_ID,DEP_PARENT_NAME,CREATE_DATE,CREATE_USER,CREATE_USERNAME,status) values
|
|
|
- <foreach collection="list" item="item" index="index" separator="," >
|
|
|
- (#{item.depId},#{item.deptName},#{item.appId},#{item.insCode},#{item.depOriginId},#{item.depParentId},#{item.depParentName},#{item.createDate},#{item.createUser},#{item.createUsername},#{item.updateUsername},#{item.status})
|
|
|
+ insert into sys_department
|
|
|
+ (dept_id,dept_name,APP_ID,INS_CODE,dept_origin_id,dept_parent_id,dept_parent_name,CREATE_DATE,CREATE_USER,create_user_name,update_date, update_user,update_user_name,status,dept_type)
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="item" index="index" separator=",">
|
|
|
+ (#{item.deptId},#{item.deptName},#{item.appId},#{item.insCode},#{item.depOriginId},#{item.depParentId},#{item.depParentName},#{item.createDate},#{item.createUser},#{item.createUserName},#{updateDate},#{updateUser},#{updateUserName},#{item.status},#{item.dept_type})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateByPrimaryKey" parameterType="SysDepartment">
|
|
|
update sys_department
|
|
|
<set>
|
|
|
- <if test="deptName != null">
|
|
|
+ <if test="deptName != null">
|
|
|
dept_name = #{ deptName },
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
<if test="appId != null">
|
|
|
APP_ID = #{ appId },
|
|
|
</if>
|
|
|
- <if test="insCode != null">
|
|
|
+ <if test="insCode != null">
|
|
|
INS_CODE = #{ insCode },
|
|
|
- </if>
|
|
|
- <if test="depOriginId != null">
|
|
|
- DEP_ORIGIN_ID = #{ depOriginId },
|
|
|
- </if>
|
|
|
- <if test="depParentId != null">
|
|
|
- DEP_PARENT_ID = #{ depParentId },
|
|
|
- </if>
|
|
|
- <if test="depParentName != null">
|
|
|
- DEP_PARENT_NAME = #{ depParentName },
|
|
|
- </if>
|
|
|
- <if test="createDate != null">
|
|
|
- CREATE_DATE = #{ createDate },
|
|
|
- </if>
|
|
|
- <if test="createUser != null">
|
|
|
- CREATE_USER = #{ createUser },
|
|
|
- </if>
|
|
|
- <if test="createUsername != null">
|
|
|
- CREATE_USERNAME = #{ createUsername },
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
+ </if>
|
|
|
+ <if test="depOriginId != null">
|
|
|
+ dept_origin_id = #{ depOriginId },
|
|
|
+ </if>
|
|
|
+ <if test="depParentId != null">
|
|
|
+ dept_parent_id = #{ depParentId },
|
|
|
+ </if>
|
|
|
+ <if test="depParentName != null">
|
|
|
+ dept_parent_name = #{ depParentName },
|
|
|
+ </if>
|
|
|
+ <if test="updateDate != null">
|
|
|
+ update_date = #{updateDate},
|
|
|
+ </if>
|
|
|
+ <if test="updateUser != null">
|
|
|
+ update_user = #{updateUser},
|
|
|
+ </if>
|
|
|
+ <if test="updateUserName != null">
|
|
|
+ update_user_name = #{updateUserName},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
status = #{ status },
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
+ <if test="deptType != null">
|
|
|
+ dept_type = #{deptType},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
- where DEP_ID = #{ depId }
|
|
|
+ where dept_id = #{deptId}
|
|
|
</update>
|
|
|
|
|
|
<select id="getObjectById" resultMap="BaseResultMap" parameterType="String">
|
|
|
- select <include refid="Base_Column_List" />
|
|
|
- from sys_department where DEP_ID = #{id}
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from sys_department where dept_id = #{id}
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -110,10 +128,10 @@
|
|
|
left join sys_institution ins on dep.ins_code = ins.ins_code AND ins.status = '1'
|
|
|
where dep.status = '1'
|
|
|
<if test="appName != null and appName!='' ">
|
|
|
- and app.APP_NAME like CONCAT('%',trim(#{appName}),'%')
|
|
|
+ and app.APP_NAME like CONCAT('%',trim(#{appName}),'%')
|
|
|
</if>
|
|
|
<if test="deptName != null and deptName!='' ">
|
|
|
- and dep.dept_name like CONCAT('%',trim(#{deptName}),'%')
|
|
|
+ and dep.dept_name like CONCAT('%',trim(#{deptName}),'%')
|
|
|
</if>
|
|
|
<if test="appId != null and appId!='' ">
|
|
|
and dep.APP_ID =#{appId}
|
|
@@ -125,7 +143,7 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="getDepCountByName" resultType="Integer" parameterType="SysDepartment">
|
|
|
+ <select id="getDepCountByName" resultType="Integer" parameterType="SysDepartment">
|
|
|
select count(*)
|
|
|
from sys_department where dept_name = #{deptName} and status = '1'
|
|
|
<if test="appId != null and appId!='' ">
|
|
@@ -134,15 +152,16 @@
|
|
|
<if test="insCode != null and insCode!='' ">
|
|
|
and INS_CODE =#{insCode}
|
|
|
</if>
|
|
|
- <if test="depId != null and depId!='' ">
|
|
|
- and DEP_ID != #{depId}
|
|
|
+ <if test="deptId != null and deptId!='' ">
|
|
|
+ and dept_id != #{deptId}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<select id="getDepCountByParent" parameterType="SysDepartment" resultType="Integer">
|
|
|
SELECT count(*)
|
|
|
from sys_department
|
|
|
- where status = '1' and DEP_PARENT_ID = #{depParentId}
|
|
|
+ where status = '1'
|
|
|
+ and dept_parent_id = #{depParentId}
|
|
|
</select>
|
|
|
|
|
|
|