<?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.cloud.device.dao.OrgDao">
|
<resultMap id="BaseResultMap" type="com.cloud.device.model.Org">
|
<id column="id" jdbcType="INTEGER" property="id" />
|
<result column="orgId" jdbcType="INTEGER" property="orgId" />
|
<result column="parentId" jdbcType="INTEGER" property="parentId" />
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="parentIds" jdbcType="VARCHAR" property="parentIds" />
|
<result column="sort" jdbcType="INTEGER" property="sort" />
|
<result column="createBy" jdbcType="VARCHAR" property="createBy" />
|
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="updateBy" jdbcType="VARCHAR" property="updateBy" />
|
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="delFlag" jdbcType="VARCHAR" property="delFlag" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
id, orgId, parentId, name, parentIds, sort, createBy, createTime, updateBy, updateTime,
|
delFlag
|
</sql>
|
<delete id="deleteById">
|
update org set delFlag = '1'
|
where id = #{id}
|
</delete>
|
<insert id="insert" parameterType="com.cloud.device.model.Org">
|
insert into org (orgId, parentId,
|
name, parentIds, sort,
|
createBy, createTime, updateBy,
|
updateTime, delFlag)
|
values (#{orgId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER},
|
#{name,jdbcType=VARCHAR}, #{parentIds,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER},
|
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
|
#{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=VARCHAR})
|
</insert>
|
<insert id="insertSelective" parameterType="com.cloud.device.model.Org">
|
insert into org
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="orgId != null">
|
orgId,
|
</if>
|
<if test="parentId != null">
|
parentId,
|
</if>
|
<if test="name != null">
|
name,
|
</if>
|
<if test="parentIds != null">
|
parentIds,
|
</if>
|
<if test="sort != null">
|
sort,
|
</if>
|
<if test="createBy != null">
|
createBy,
|
</if>
|
<if test="createTime != null">
|
createTime,
|
</if>
|
<if test="updateBy != null">
|
updateBy,
|
</if>
|
<if test="updateTime != null">
|
updateTime,
|
</if>
|
<if test="delFlag != null">
|
delFlag,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="orgId != null">
|
#{orgId,jdbcType=INTEGER},
|
</if>
|
<if test="parentId != null">
|
#{parentId,jdbcType=INTEGER},
|
</if>
|
<if test="name != null">
|
#{name,jdbcType=VARCHAR},
|
</if>
|
<if test="parentIds != null">
|
#{parentIds,jdbcType=VARCHAR},
|
</if>
|
<if test="sort != null">
|
#{sort,jdbcType=INTEGER},
|
</if>
|
<if test="createBy != null">
|
#{createBy,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateBy != null">
|
#{updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="updateTime != null">
|
#{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="delFlag != null">
|
#{delFlag,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<update id="updateByIdSelective" parameterType="com.cloud.device.model.Org">
|
update org
|
<set>
|
<if test="orgId != null">
|
orgId = #{orgId,jdbcType=INTEGER},
|
</if>
|
<if test="parentId != null">
|
parentId = #{parentId,jdbcType=INTEGER},
|
</if>
|
<if test="name != null">
|
name = #{name,jdbcType=VARCHAR},
|
</if>
|
<if test="parentIds != null">
|
parentIds = #{parentIds,jdbcType=VARCHAR},
|
</if>
|
<if test="sort != null">
|
sort = #{sort,jdbcType=INTEGER},
|
</if>
|
<if test="createBy != null">
|
createBy = #{createBy,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateBy != null">
|
updateBy = #{updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="updateTime != null">
|
updateTime = #{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="delFlag != null">
|
delFlag = #{delFlag,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
<update id="updateById" parameterType="com.cloud.device.model.Org">
|
update org
|
set orgId = #{orgId,jdbcType=INTEGER},
|
parentId = #{parentId,jdbcType=INTEGER},
|
name = #{name,jdbcType=VARCHAR},
|
parentIds = #{parentIds,jdbcType=VARCHAR},
|
sort = #{sort,jdbcType=INTEGER},
|
createBy = #{createBy,jdbcType=VARCHAR},
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
updateBy = #{updateBy,jdbcType=VARCHAR},
|
updateTime = #{updateTime,jdbcType=TIMESTAMP},
|
delFlag = #{delFlag,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
<select id="selectById" resultMap="BaseResultMap">
|
select <include refid="Base_Column_List" />
|
from org
|
where id=#{id,jdbcType=INTEGER}
|
</select>
|
<select id="findAll" resultMap="BaseResultMap">
|
select <include refid="Base_Column_List" />
|
from org where delFlag = '0'
|
<if test="name !=null and name !=''">
|
and name like concat('%',#{name},'%')
|
</if>
|
order by sort
|
</select>
|
<select id="findChildById" resultMap="BaseResultMap">
|
select <include refid="Base_Column_List" />
|
from org where delFlag = '0' and parentId = #{id}
|
</select>
|
</mapper>
|