All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.mingsoft.organization.dao.IEmployeeDao.xml Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
<?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="net.mingsoft.organization.dao.IEmployeeDao">

	<resultMap id="resultMap" type="net.mingsoft.organization.entity.EmployeeEntity">
			<id column="id" property="id" /><!--编号 -->
				<result column="employee_code" property="employeeCode" /><!--员工编号 -->
				<result column="employee_status" property="employeeStatus" /><!--员工状态 -->
				<result column="employee_sex" property="employeeSex" /><!--性别 -->
				<result column="employee_role" property="employeeRole" /><!--所属角色 -->
				<result column="post_ids" property="postIds" /><!--岗位 -->
				<result column="organization_id" property="organizationId" /><!--所属部门 -->
				<result column="organization_title" property="organizationTitle" /><!--所属部门名称 -->
				<result column="politics" property="politics" /><!--政治面貌 -->
				<result column="education" property="education" /><!--员工学历 -->
				<result column="age" property="age" /><!--年龄 -->
				<result column="phone" property="phone" /><!--手机号 -->
				<result column="manager_name" property="managerName" />
				<result column="manager_nickname" property="managerNickName" />
				<result column="manager_id" property="managerId" /><!--管理员id -->
				<result column="create_by" property="createBy" /><!--创建人 -->
				<result column="create_date" property="createDate" /><!--创建时间 -->
				<result column="update_by" property="updateBy" /><!--修改人 -->
				<result column="update_date" property="updateDate" /><!--修改时间 -->
				<result column="del" property="del" /><!--删除标记 -->
	</resultMap>

	<resultMap id="modelResultMap" type="net.mingsoft.basic.entity.ModelEntity">
		<id column="MODEL_ID" property="modelId" /><!--模块自增长id -->
		<result column="MODEL_TITLE" property="modelTitle" /><!--模块标题 -->
		<result column="MODEL_CODE" property="modelCode" /><!--模块编码 -->
		<result column="MODEL_MODELID" property="modelModelId" /><!--模块的父模块id -->
		<result column="MODEL_URL" property="modelUrl" /><!--模块连接地址 -->
		<result column="MODEL_DATETIME" property="modelDatetime" /><!-- -->
		<result column="MODEL_ICON" property="modelIcon" /><!--模块图标 -->
		<result column="MODEL_MODELMANAGERID" property="modelManagerId" /><!--模块关联的关联员id -->
		<result column="MODEL_SORT" property="modelSort" /><!--模块的排序 -->
		<result column="MODEL_ISMENU" property="modelIsMenu" /><!--模块是否是菜单 -->
		<result column="MODEL_PARENT_IDS" property="modelParentIds" /><!--模块是否是菜单 -->
		<result column="IS_CHILD" property="isChild" /><!--菜单类型-->
		<result column="CHILD_NUM" property="childNum" /><!--菜单子集数量-->
		<result column="DEPTH" property="depth" /><!--菜单层级-->
	</resultMap>

	<!--保存-->
	<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
			parameterType="net.mingsoft.organization.entity.EmployeeEntity" >
		insert into organization_employee
		<trim prefix="(" suffix=")" suffixOverrides=",">
				<if test="employeeCode != null and employeeCode != ''">employee_code,</if>
				<if test="employeeStatus != null and employeeStatus != ''">employee_status,</if>
				<if test="employeeSex != null">employee_sex,</if>
				<if test="employeeRole != null and employeeRole != ''">employee_role,</if>
				<if test="postIds != null and postIds != ''">post_ids,</if>
				<if test="organizationId != null and organizationId != ''">organization_id,</if>
				<if test="politics != null and politics != ''">politics,</if>
				<if test="education != null and education != ''">education,</if>
				<if test="age != null">age,</if>
				<if test="phone != null and phone != ''">phone,</if>
				<if test="managerId != null and managerId>0">manager_id,</if>
				<if test="createBy &gt; 0">create_by,</if>
				<if test="createDate != null">create_date,</if>
				<if test="updateBy &gt; 0">update_by,</if>
				<if test="updateDate != null">update_date,</if>
				<if test="del != null">del,</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
				<if test="employeeCode != null and employeeCode != ''">#{employeeCode},</if>
				<if test="employeeStatus != null and employeeStatus != ''">#{employeeStatus},</if>
				<if test="employeeSex != null">#{employeeSex},</if>
				<if test="employeeRole != null and employeeRole != ''">#{employeeRole},</if>
				<if test="postIds != null and postIds != ''">#{postIds},</if>
				<if test="organizationId != null and organizationId != ''">#{organizationId},</if>
				<if test="politics != null and politics != ''">#{politics},</if>
				<if test="education != null and education != ''">#{education},</if>
				<if test="age != null">#{age},</if>
				<if test="phone != null and phone != ''">#{phone},</if>
				<if test="managerId != null and managerId>0">#{managerId},</if>
				<if test="createBy &gt; 0">#{createBy},</if>
				<if test="createDate != null">#{createDate},</if>
				<if test="updateBy &gt; 0">#{updateBy},</if>
				<if test="updateDate != null">#{updateDate},</if>
				<if test="del != null">#{del},</if>
		</trim>
	</insert>

		<!--更新-->
		<update id="updateEntity" parameterType="net.mingsoft.organization.entity.EmployeeEntity">
			update organization_employee
			<set>
				<if test="employeeCode != null and employeeCode != ''">employee_code=#{employeeCode},</if>
				<if test="employeeStatus != null and employeeStatus != ''">employee_status=#{employeeStatus},</if>
				<if test="employeeSex != null">employee_sex=#{employeeSex},</if>
				<if test="employeeRole != null and employeeRole != ''">employee_role=#{employeeRole},</if>
				<if test="postIds != null and postIds != ''">post_ids=#{postIds},</if>
				<if test="organizationId != null and organizationId != ''">organization_id=#{organizationId},</if>
				<if test="politics != null and politics != ''">politics=#{politics},</if>
				<if test="education != null and education != ''">education=#{education},</if>
				<if test="age != null">age=#{age},</if>
				<if test="phone != null and phone != ''">phone=#{phone},</if>
				<if test="managerId != null and managerId>0">manager_id=#{managerId},</if>
				<if test="createBy &gt; 0">create_by=#{createBy},</if>
				<if test="createDate != null">create_date=#{createDate},</if>
				<if test="updateBy &gt; 0">update_by=#{updateBy},</if>
				<if test="updateDate != null">update_date=#{updateDate},</if>
				<if test="del != null">del=#{del},</if>
			</set>
			where id = #{id}
		</update>

		<!--根据id获取-->
		<select id="getEntity" resultMap="resultMap" parameterType="int">
			select * from organization_employee left join manager
			on organization_employee.manager_id = manager.manager_id
			 where id=#{id}
		</select>

		<!--根据实体获取-->
		<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.organization.entity.EmployeeEntity">
			select * from organization_employee
			left join manager
			on organization_employee.manager_id = manager.manager_id
			<where>
				<if test="employeeCode != null and employeeCode != ''">and employee_code=#{employeeCode}</if>
				<if test="employeeStatus != null and employeeStatus != ''">and employee_status=#{employeeStatus}</if>
				<if test="employeeSex != null"> and employee_sex=#{employeeSex} </if>
				<if test="employeeRole != null and employeeRole != ''">and employee_role=#{employeeRole}</if>
				<if test="postIds != null and postIds != ''">and  post_ids like CONCAT('%',#{postIds},'%')</if>
				<if test="organizationId != null and organizationId != ''">and organization_id=#{organizationId}</if>
				<if test="politics != null and politics != ''">and politics=#{politics}</if>
				<if test="education != null and education != ''">and education=#{education}</if>
				<if test="age != null"> and age=#{age} </if>
				<if test="phone != null and phone != ''">and  phone like CONCAT('%',#{phone},'%')</if>
				<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
				<if test="createDate != null"> and create_date=#{createDate} </if>
				<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
				<if test="updateDate != null"> and update_date=#{updateDate} </if>
				<if test="del != null"> and del=#{del} </if>
			</where>
			limit 0,1
		</select>


		<!--删除-->
		<delete id="deleteEntity" parameterType="int">
			delete from organization_employee  where id=#{id}
		</delete>

		<!--批量删除-->
		<delete id="delete" >
			delete from organization_employee
			<where>
				id  in <foreach collection="ids" item="item" index="index"
										 open="(" separator="," close=")">#{item}</foreach>
			</where>
		</delete>
		<!--查询全部-->
		<select id="queryAll" resultMap="resultMap">
			select * from organization_employee order by id desc
		</select>
	<!--条件查询-->
	<select id="query" resultMap="resultMap">
		select organization_employee.*,manager.*,organization.organization_title from organization_employee
		left join manager
		on organization_employee.manager_id = manager.manager_id
		left join organization
		on organization_employee.organization_id = organization.id
		<where>
			<if test="employeeCode != null and employeeCode != ''"> and employee_code=#{employeeCode}</if>
			<if test="employeeStatus != null and employeeStatus != ''"> and employee_status=#{employeeStatus}</if>
			<if test="employeeSex != null"> and employee_sex=#{employeeSex} </if>
			<if test="employeeRole != null and employeeRole != ''"> and employee_role=#{employeeRole}</if>
			<if test="postIds != null and postIds != ''"> and  post_ids like CONCAT('%',#{postIds},'%')</if>
			<if test="organizationId != null and organizationId != ''"> and organization_employee.organization_id=#{organizationId}</if>
			<if test="politics != null and politics != ''"> and politics=#{politics}</if>
			<if test="education != null and education != ''"> and education=#{education}</if>
			<if test="age != null"> and age=#{age} </if>
			<if test="phone != null and phone != ''"> and  phone like CONCAT('%',#{phone},'%')</if>
			<if test="createBy &gt; 0"> and organization_employee.create_by=#{createBy} </if>
			<if test="createDate != null"> and organization_employee.create_date=#{createDate} </if>
			<if test="updateBy &gt; 0"> and organization_employee.update_by=#{updateBy} </if>
			<if test="updateDate != null"> and organization_employee.update_date=#{updateDate} </if>
			<if test="del != null"> and organization_employee.del=#{del} </if>
			<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
		</where>
		order by id desc
	</select>

	<select id="queryModelByRoleIds" resultMap="modelResultMap"
			parameterType="int">
		select
		distinct *
		from model
		where model_id in (select RM_MODELID from role_model where
		RM_ROLEID in
		<foreach collection="ids" index="index" item="id" open="(" separator="," close=")">
			#{id}
		</foreach>
		)
		order by MODEL_SORT desc,MODEL_ID desc
	</select>
	<select id="queryListByOrganization" resultMap="resultMap">
		select * from organization_employee
		left join manager
		on organization_employee.manager_id = manager.manager_id
		<where>
			<if test="employeeCode != null and employeeCode != ''"> and employee_code=#{employeeCode}</if>
			<if test="employeeStatus != null and employeeStatus != ''"> and employee_status=#{employeeStatus}</if>
			<if test="employeeSex != null"> and employee_sex=#{employeeSex} </if>
			<if test="employeeRole != null and employeeRole != ''"> and employee_role=#{employeeRole}</if>
			<if test="postIds != null and postIds != ''"> and  post_ids like CONCAT('%',#{postIds},'%')</if>
			<if test="organizationId != null and organizationId != ''">
				and organization_id in ((select id from organization
				where find_in_set(#{organizationId},organization_parent_id) or id = #{organizationId}))
			</if>
			<if test="politics != null and politics != ''"> and politics=#{politics}</if>
			<if test="education != null and education != ''"> and education=#{education}</if>
			<if test="age != null"> and age=#{age} </if>
			<if test="phone != null and phone != ''"> and  phone like CONCAT('%',#{phone},'%')</if>
			<if test="createBy &gt; 0"> and create_by=#{createBy} </if>
			<if test="createDate != null"> and create_date=#{createDate} </if>
			<if test="updateBy &gt; 0"> and update_by=#{updateBy} </if>
			<if test="updateDate != null"> and update_date=#{updateDate} </if>
			<if test="del != null"> and del=#{del} </if>
			<include refid="net.mingsoft.base.dao.IBaseDao.sqlWhere"></include>
		</where>
		order by id desc
	</select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy