SysDeptMapper.xml 6.6 KB
<?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.tianbo.warehouse.dao.SysDeptMapper">
  <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.SysDept">
    <id column="ID" jdbcType="INTEGER" property="id" />
    <result column="PID" jdbcType="INTEGER" property="pid" />
    <result column="DEPTNAME" jdbcType="VARCHAR" property="deptname" />
    <result column="DEPTDESC" jdbcType="VARCHAR" property="deptdesc" />
    <result column="DEPTTYPE" jdbcType="VARCHAR" property="depttype" />
    <result column="ISROOT" jdbcType="BIT" property="isroot" />
    <result column="CREATEBY" jdbcType="VARCHAR" property="createby" />
    <result column="CREATETIME" jdbcType="TIMESTAMP" property="createtime" />
    <result column="UPDATEBY" jdbcType="VARCHAR" property="updateby" />
    <result column="UPDATETME" jdbcType="TIMESTAMP" property="updatetme" />
    <result column="ISDELETE" jdbcType="BIT" property="isdelete" />
    <result column="REMARK" jdbcType="VARCHAR" property="remark" />
    <result column="REMARK1" jdbcType="VARCHAR" property="remark1" />
  </resultMap>
  <sql id="Base_Column_List">
    ID, PID, DEPTNAME, DEPTDESC, DEPTTYPE, ISROOT, CREATEBY, CREATETIME, UPDATEBY, UPDATETME,
    ISDELETE, REMARK, REMARK1
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from sys_dept
    where ID = #{id,jdbcType=INTEGER}
  </select>
  <select id="findAllDept" resultMap="BaseResultMap">
    select <include refid="Base_Column_List"></include>
    from sys_dept where ISDELETE = 0
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from sys_dept
    where ID = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.tianbo.warehouse.model.SysDept">
    insert into sys_dept (ID, PID, DEPTNAME,
      DEPTDESC, DEPTTYPE, ISROOT,
      CREATEBY, CREATETIME, UPDATEBY,
      UPDATETME, ISDELETE, REMARK,
      REMARK1)
    values (#{id,jdbcType=INTEGER}, #{pid,jdbcType=INTEGER}, #{deptname,jdbcType=VARCHAR},
      #{deptdesc,jdbcType=VARCHAR}, #{depttype,jdbcType=VARCHAR}, #{isroot,jdbcType=BIT},
      #{createby,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP}, #{updateby,jdbcType=VARCHAR},
      #{updatetme,jdbcType=TIMESTAMP}, #{isdelete,jdbcType=BIT}, #{remark,jdbcType=VARCHAR},
      #{remark1,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.SysDept">
    insert into sys_dept
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="pid != null">
        PID,
      </if>
      <if test="deptname != null">
        DEPTNAME,
      </if>
      <if test="deptdesc != null">
        DEPTDESC,
      </if>
      <if test="depttype != null">
        DEPTTYPE,
      </if>
      <if test="isroot != null">
        ISROOT,
      </if>
      <if test="createby != null">
        CREATEBY,
      </if>
      <if test="createtime != null">
        CREATETIME,
      </if>
      <if test="updateby != null">
        UPDATEBY,
      </if>
      <if test="updatetme != null">
        UPDATETME,
      </if>
      <if test="isdelete != null">
        ISDELETE,
      </if>
      <if test="remark != null">
        REMARK,
      </if>
      <if test="remark1 != null">
        REMARK1,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="pid != null">
        #{pid,jdbcType=INTEGER},
      </if>
      <if test="deptname != null">
        #{deptname,jdbcType=VARCHAR},
      </if>
      <if test="deptdesc != null">
        #{deptdesc,jdbcType=VARCHAR},
      </if>
      <if test="depttype != null">
        #{depttype,jdbcType=VARCHAR},
      </if>
      <if test="isroot != null">
        #{isroot,jdbcType=BIT},
      </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="updatetme != null">
        #{updatetme,jdbcType=TIMESTAMP},
      </if>
      <if test="isdelete != null">
        #{isdelete,jdbcType=BIT},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="remark1 != null">
        #{remark1,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.SysDept">
    update sys_dept
    <set>
      <if test="pid != null">
        PID = #{pid,jdbcType=INTEGER},
      </if>
      <if test="deptname != null">
        DEPTNAME = #{deptname,jdbcType=VARCHAR},
      </if>
      <if test="deptdesc != null">
        DEPTDESC = #{deptdesc,jdbcType=VARCHAR},
      </if>
      <if test="depttype != null">
        DEPTTYPE = #{depttype,jdbcType=VARCHAR},
      </if>
      <if test="isroot != null">
        ISROOT = #{isroot,jdbcType=BIT},
      </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="updatetme != null">
        UPDATETME = #{updatetme,jdbcType=TIMESTAMP},
      </if>
      <if test="isdelete != null">
        ISDELETE = #{isdelete,jdbcType=BIT},
      </if>
      <if test="remark != null">
        REMARK = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="remark1 != null">
        REMARK1 = #{remark1,jdbcType=VARCHAR},
      </if>
    </set>
    where ID = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.SysDept">
    update sys_dept
    set PID = #{pid,jdbcType=INTEGER},
      DEPTNAME = #{deptname,jdbcType=VARCHAR},
      DEPTDESC = #{deptdesc,jdbcType=VARCHAR},
      DEPTTYPE = #{depttype,jdbcType=VARCHAR},
      ISROOT = #{isroot,jdbcType=BIT},
      CREATEBY = #{createby,jdbcType=VARCHAR},
      CREATETIME = #{createtime,jdbcType=TIMESTAMP},
      UPDATEBY = #{updateby,jdbcType=VARCHAR},
      UPDATETME = #{updatetme,jdbcType=TIMESTAMP},
      ISDELETE = #{isdelete,jdbcType=BIT},
      REMARK = #{remark,jdbcType=VARCHAR},
      REMARK1 = #{remark1,jdbcType=VARCHAR}
    where ID = #{id,jdbcType=INTEGER}
  </update>
</mapper>