DepartmentMapper.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.wzy.dao.DepartmentMapper"><resultMap id="BaseResultMap" type="com.wzy.pojo.Department"><id column="dept_id" jdbcType="INTEGER" property="deptId" /><result column="dept_name" jdbcType="VARCHAR" property="deptName" /></resultMap><sql id="Example_Where_Clause"><where><foreach collection="oredCriteria" item="criteria" separator="or"><if test="criteria.valid"><trim prefix="(" prefixOverrides="and" suffix=")"><foreach collection="criteria.criteria" item="criterion"><choose><when test="criterion.noValue">and ${criterion.condition}</when><when test="criterion.singleValue">and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue">and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue">and ${criterion.condition}<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Update_By_Example_Where_Clause"><where><foreach collection="example.oredCriteria" item="criteria" separator="or"><if test="criteria.valid"><trim prefix="(" prefixOverrides="and" suffix=")"><foreach collection="criteria.criteria" item="criterion"><choose><when test="criterion.noValue">and ${criterion.condition}</when><when test="criterion.singleValue">and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue">and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue">and ${criterion.condition}<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Base_Column_List">dept_id, dept_name</sql><select id="selectByExample" parameterType="com.wzy.pojo.DepartmentExample" resultMap="BaseResultMap">select<if test="distinct">distinct</if><include refid="Base_Column_List" />from myb_dept<if test="_parameter != null"><include refid="Example_Where_Clause" /></if><if test="orderByClause != null">order by ${orderByClause}</if></select><select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">select<include refid="Base_Column_List" />from myb_deptwhere dept_id = #{deptId,jdbcType=INTEGER}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">delete from myb_deptwhere dept_id = #{deptId,jdbcType=INTEGER}</delete><delete id="deleteByExample" parameterType="com.wzy.pojo.DepartmentExample">delete from myb_dept<if test="_parameter != null"><include refid="Example_Where_Clause" /></if></delete><insert id="insert" parameterType="com.wzy.pojo.Department">insert into myb_dept (dept_id, dept_name)values (#{deptId,jdbcType=INTEGER}, #{deptName,jdbcType=VARCHAR})</insert><insert id="insertSelective" parameterType="com.wzy.pojo.Department">insert into myb_dept<trim prefix="(" suffix=")" suffixOverrides=","><if test="deptId != null">dept_id,</if><if test="deptName != null">dept_name,</if></trim><trim prefix="values (" suffix=")" suffixOverrides=","><if test="deptId != null">#{deptId,jdbcType=INTEGER},</if><if test="deptName != null">#{deptName,jdbcType=VARCHAR},</if></trim></insert><select id="countByExample" parameterType="com.wzy.pojo.DepartmentExample" resultType="java.lang.Long">select count(*) from myb_dept<if test="_parameter != null"><include refid="Example_Where_Clause" /></if></select><update id="updateByExampleSelective" parameterType="map">update myb_dept<set><if test="record.deptId != null">dept_id = #{record.deptId,jdbcType=INTEGER},</if><if test="record.deptName != null">dept_name = #{record.deptName,jdbcType=VARCHAR},</if></set><if test="_parameter != null"><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByExample" parameterType="map">update myb_deptset dept_id = #{record.deptId,jdbcType=INTEGER},dept_name = #{record.deptName,jdbcType=VARCHAR}<if test="_parameter != null"><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByPrimaryKeySelective" parameterType="com.wzy.pojo.Department">update myb_dept<set><if test="deptName != null">dept_name = #{deptName,jdbcType=VARCHAR},</if></set>where dept_id = #{deptId,jdbcType=INTEGER}</update><update id="updateByPrimaryKey" parameterType="com.wzy.pojo.Department">update myb_deptset dept_name = #{deptName,jdbcType=VARCHAR}where dept_id = #{deptId,jdbcType=INTEGER}</update></mapper>
