99 lines
3.5 KiB
XML
99 lines
3.5 KiB
XML
<?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.bonus.sys.dao.OrgDao" >
|
|
<resultMap id="BaseResultMap" type="com.bonus.sys.beans.OrgBean" >
|
|
<id column="ID" property="id" jdbcType="INTEGER" />
|
|
<result column="NAME" property="name" jdbcType="VARCHAR" />
|
|
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
|
|
<result column="PARENT_ID" property="parentId" jdbcType="INTEGER" />
|
|
<result column="IS_ACTIVE" property="isActive" jdbcType="CHAR" />
|
|
</resultMap>
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
select ID,NAME,DESCRIPTION,PARENT_ID,IS_ACTIVE
|
|
from pm_organization
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="com.bonus.sys.beans.OrgBean" >
|
|
delete from pm_organization
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<insert id="insertBean" parameterType="com.bonus.sys.beans.OrgBean" >
|
|
insert into pm_organization (ID, NAME, DESCRIPTION,
|
|
PARENT_ID, IS_ACTIVE)
|
|
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
|
#{parentId,jdbcType=INTEGER}, "1")
|
|
<selectKey resultType="int" keyProperty="id" >
|
|
SELECT last_insert_id() as ID;
|
|
</selectKey>
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.bonus.sys.beans.OrgBean" >
|
|
insert into pm_organization
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >
|
|
ID,
|
|
</if>
|
|
<if test="name != null" >
|
|
NAME,
|
|
</if>
|
|
<if test="description != null" >
|
|
DESCRIPTION,
|
|
</if>
|
|
<if test="parentId != null" >
|
|
PARENT_ID,
|
|
</if>
|
|
<if test="isActive != null" >
|
|
IS_ACTIVE,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="name != null" >
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="description != null" >
|
|
#{description,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="parentId != null" >
|
|
#{parentId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="isActive != null" >
|
|
#{isActive,jdbcType=CHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.sys.beans.OrgBean" >
|
|
update pm_organization
|
|
<set >
|
|
<if test="name != null" >
|
|
NAME = #{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="description != null" >
|
|
DESCRIPTION = #{description,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="parentId != null" >
|
|
PARENT_ID = #{parentId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="isActive != null" >
|
|
IS_ACTIVE = #{isActive,jdbcType=CHAR},
|
|
</if>
|
|
</set>
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.bonus.sys.beans.OrgBean" >
|
|
update pm_organization
|
|
set NAME = #{name,jdbcType=VARCHAR},
|
|
DESCRIPTION = #{description,jdbcType=VARCHAR},
|
|
PARENT_ID = #{parentId,jdbcType=INTEGER},
|
|
IS_ACTIVE = #{isActive,jdbcType=CHAR}
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<select id="findRepairGroup" parameterType="com.bonus.sys.beans.OrgBean" resultMap="BaseResultMap" >
|
|
SELECT p.ID,p.`NAME`
|
|
FROM pm_organization p
|
|
WHERE p.PARENT_ID = 6
|
|
order by p.ID asc
|
|
</select>
|
|
</mapper> |