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

net.mingsoft.organization.dao.IOrganizationDao.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.IOrganizationDao">

	<resultMap id="resultMap" type="net.mingsoft.organization.entity.OrganizationEntity">
			<id column="id" property="id" /><!--编号 -->
				<result column="organization_title" property="organizationTitle" /><!--部门名称 -->
				<result column="organization_id" property="organizationId" /><!--所属部门 -->
				<result column="organization_status" property="organizationStatus" /><!--部门状态 -->
				<result column="organization_code" property="organizationCode" /><!--部门编号 -->
				<result column="organization_leaders" property="organizationLeaders" /><!--分管领导 -->
				<result column="organization_leader" property="organizationLeader" /><!--负责人 -->
				<result column="organization_parent_id" property="organizationParentId" /><!--父级ids -->
				<result column="organization_type" property="organizationType" /><!--机构类型 -->
				<result column="organization_description" property="organizationDescription" /><!--机构描述 -->
				<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>

	<!--保存-->
	<insert id="saveEntity" useGeneratedKeys="true" keyProperty="id"
			parameterType="net.mingsoft.organization.entity.OrganizationEntity" >
		insert into organization
		<trim prefix="(" suffix=")" suffixOverrides=",">
				<if test="organizationTitle != null and organizationTitle != ''">organization_title,</if>
				<if test="organizationId != null and organizationId != ''">organization_id,</if>
				<if test="organizationStatus != null and organizationStatus != ''">organization_status,</if>
				<if test="organizationCode != null and organizationCode != ''">organization_code,</if>
				<if test="organizationLeaders != null">organization_leaders,</if>
				<if test="organizationLeader != null">organization_leader,</if>
				<if test="organizationParentId != null and organizationParentId != ''">organization_parent_id,</if>
				<if test="organizationType != null and organizationType != ''">organization_type,</if>
				<if test="organizationDescription != null and organizationDescription != ''">organization_description,</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="organizationTitle != null and organizationTitle != ''">#{organizationTitle},</if>
				<if test="organizationId != null and organizationId != ''">#{organizationId},</if>
				<if test="organizationStatus != null and organizationStatus != ''">#{organizationStatus},</if>
				<if test="organizationCode != null and organizationCode != ''">#{organizationCode},</if>
				<if test="organizationLeaders != null">#{organizationLeaders},</if>
				<if test="organizationLeader != null">#{organizationLeader},</if>
				<if test="organizationParentId != null and organizationParentId != ''">#{organizationParentId},</if>
				<if test="organizationType != null and organizationType != ''">#{organizationType},</if>
				<if test="organizationDescription != null and organizationDescription != ''">#{organizationDescription},</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.OrganizationEntity">
			update organization
			<set>
				<if test="organizationTitle != null and organizationTitle != ''">organization_title=#{organizationTitle},</if>
				organization_id=#{organizationId},
				<if test="organizationStatus != null and organizationStatus != ''">organization_status=#{organizationStatus},</if>
				<if test="organizationCode != null and organizationCode != ''">organization_code=#{organizationCode},</if>
				<if test="organizationLeaders != null">organization_leaders=#{organizationLeaders},</if>
				<if test="organizationLeader != null">organization_leader=#{organizationLeader},</if>
				<if test="organizationParentId != null and organizationParentId != ''">organization_parent_id=#{organizationParentId},</if>
				<if test="organizationType != null and organizationType != ''">organization_type=#{organizationType},</if>
				<if test="organizationDescription != null and organizationDescription != ''">organization_description=#{organizationDescription},</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 where id=#{id}
		</select>

		<!--根据实体获取-->
		<select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.organization.entity.OrganizationEntity">
			select * from organization
			<where>
				<if test="organizationTitle != null and organizationTitle != ''">and  organization_title like CONCAT('%',#{organizationTitle},'%')</if>
				<if test="organizationId != null and organizationId != ''">and organization_id=#{organizationId}</if>
				<if test="organizationStatus != null and organizationStatus != ''">and organization_status=#{organizationStatus}</if>
				<if test="organizationCode != null and organizationCode != ''">and organization_code=#{organizationCode}</if>
				<if test="organizationLeaders != null"> and organization_leaders=#{organizationLeaders} </if>
				<if test="organizationLeader != null"> and organization_leader=#{organizationLeader} </if>
				<if test="organizationParentId != null and organizationParentId != ''">and organization_parent_id=#{organizationParentId}</if>
				<if test="organizationType != null and organizationType != ''">and organization_type=#{organizationType}</if>
				<if test="organizationDescription != null and organizationDescription != ''">and organization_description=#{organizationDescription}</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  where id=#{id}
		</delete>

		<!--批量删除-->
		<delete id="delete" >
			delete from organization
			<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 order by id desc
		</select>
	<!--条件查询-->
	<select id="query" resultMap="resultMap">
		select * from organization
		<where>
			<if test="organizationTitle != null and organizationTitle != ''"> and  organization_title like CONCAT('%',#{organizationTitle},'%')</if>
			<if test="organizationId != null and organizationId != ''"> and organization_id=#{organizationId}</if>
			<if test="organizationStatus != null and organizationStatus != ''"> and organization_status=#{organizationStatus}</if>
			<if test="organizationCode != null and organizationCode != ''"> and organization_code=#{organizationCode}</if>
			<if test="organizationLeaders != null"> and organization_leaders=#{organizationLeaders} </if>
			<if test="organizationLeader != null"> and organization_leader=#{organizationLeader} </if>
			<if test="organizationParentId != null and organizationParentId != ''"> and organization_parent_id=#{organizationParentId}</if>
			<if test="organizationType != null and organizationType != ''"> and organization_type=#{organizationType}</if>
			<if test="organizationDescription != null and organizationDescription != ''"> and organization_description=#{organizationDescription}</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>
    <select id="queryChildren" resultType="net.mingsoft.organization.entity.OrganizationEntity">
		select * from organization
		where find_in_set(#{id},organization_parent_id)
	</select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy