net.mingsoft.organization.dao.IPostDao.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ms-morganization Show documentation
Show all versions of ms-morganization Show documentation
ms-morganization tools Library
<?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.IPostDao"> <resultMap id="resultMap" type="net.mingsoft.organization.entity.PostEntity"> <id column="id" property="id" /><!--编号 --> <result column="post_name" property="postName" /><!--岗位名称 --> <result column="post_code" property="postCode" /><!--岗位编号 --> <result column="post_desc" property="postDesc" /><!--岗位描述 --> <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.PostEntity" > insert into organization_post <trim prefix="(" suffix=")" suffixOverrides=","> <if test="postName != null and postName != ''">post_name,</if> <if test="postCode != null and postCode != ''">post_code,</if> <if test="postDesc != null and postDesc != ''">post_desc,</if> <if test="createBy > 0">create_by,</if> <if test="createDate != null">create_date,</if> <if test="updateBy > 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="postName != null and postName != ''">#{postName},</if> <if test="postCode != null and postCode != ''">#{postCode},</if> <if test="postDesc != null and postDesc != ''">#{postDesc},</if> <if test="createBy > 0">#{createBy},</if> <if test="createDate != null">#{createDate},</if> <if test="updateBy > 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.PostEntity"> update organization_post <set> <if test="postName != null and postName != ''">post_name=#{postName},</if> <if test="postCode != null and postCode != ''">post_code=#{postCode},</if> <if test="postDesc != null and postDesc != ''">post_desc=#{postDesc},</if> <if test="createBy > 0">create_by=#{createBy},</if> <if test="createDate != null">create_date=#{createDate},</if> <if test="updateBy > 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_post where id=#{id} </select> <!--根据实体获取--> <select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.organization.entity.PostEntity"> select * from organization_post <where> <if test="postName != null and postName != ''">and post_name like CONCAT('%',#{postName},'%')</if> <if test="postCode != null and postCode != ''">and post_code=#{postCode}</if> <if test="postDesc != null and postDesc != ''">and post_desc=#{postDesc}</if> <if test="createBy > 0"> and create_by=#{createBy} </if> <if test="createDate != null"> and create_date=#{createDate} </if> <if test="updateBy > 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_post where id=#{id} </delete> <!--批量删除--> <delete id="delete" > delete from organization_post <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_post order by id desc </select> <!--条件查询--> <select id="query" resultMap="resultMap"> select * from organization_post <where> <if test="postName != null and postName != ''"> and post_name like CONCAT('%',#{postName},'%')</if> <if test="postCode != null and postCode != ''"> and post_code=#{postCode}</if> <if test="postDesc != null and postDesc != ''"> and post_desc=#{postDesc}</if> <if test="createBy > 0"> and create_by=#{createBy} </if> <if test="createDate != null"> and create_date=#{createDate} </if> <if test="updateBy > 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>