SysMechanicMapper.xml 8.04 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.glsx.usercenter.mapper.SysMechanicMapper">
  <resultMap id="BaseResultMap" type="com.glsx.usercenter.pojo.user.SysMechanicEntity">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_id" jdbcType="INTEGER" property="userId" />
    <result column="district" jdbcType="VARCHAR" property="district" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="work_time_start" jdbcType="VARCHAR" property="workTimeStart" />
    <result column="work_time_end" jdbcType="VARCHAR" property="workTimeEnd" />
    <result column="dispatch_type" jdbcType="TINYINT" property="dispatchType" />
    <result column="service_type" jdbcType="TINYINT" property="serviceType" />
    <result column="IDCard" jdbcType="VARCHAR" property="idcard" />
    <result column="mechanic_status" jdbcType="VARCHAR" property="mechanicStatus" />
    <result column="work_status" jdbcType="TINYINT" property="workStatus" />
    <result column="send_type" jdbcType="TINYINT" property="sendType" />
    <result column="bank_card_no" jdbcType="VARCHAR" property="bankCardNo" />
    <result column="real_name" jdbcType="VARCHAR" property="realName" />
  </resultMap>
  <sql id="Base_Column_List">
    id, user_id, district, address, work_time_start, work_time_end, dispatch_type, service_type, 
    IDCard, mechanic_status, work_status, send_type, bank_card_no, real_name
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_mechanic
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from sys_mechanic
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_mechanic (user_id, district, address, 
      work_time_start, work_time_end, dispatch_type, 
      service_type, IDCard, mechanic_status, 
      work_status, send_type, bank_card_no, 
    
      real_name)
    values (#{userId,jdbcType=INTEGER}, #{district,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, 
      #{workTimeStart,jdbcType=VARCHAR}, #{workTimeEnd,jdbcType=VARCHAR}, #{dispatchType,jdbcType=TINYINT}, 
      #{serviceType,jdbcType=TINYINT}, #{idcard,jdbcType=VARCHAR}, #{mechanicStatus,jdbcType=VARCHAR}, 
      #{workStatus,jdbcType=TINYINT}, #{sendType,jdbcType=TINYINT}, #{bankCardNo,jdbcType=VARCHAR}, 
       #{realName,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_mechanic
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        user_id,
      </if>
      <if test="district != null">
        district,
      </if>
      <if test="address != null">
        address,
      </if>
      <if test="workTimeStart != null">
        work_time_start,
      </if>
      <if test="workTimeEnd != null">
        work_time_end,
      </if>
      <if test="dispatchType != null">
        dispatch_type,
      </if>
      <if test="serviceType != null">
        service_type,
      </if>
      <if test="idcard != null">
        IDCard,
      </if>
      <if test="mechanicStatus != null">
        mechanic_status,
      </if>
      <if test="workStatus != null">
        work_status,
      </if>
      <if test="sendType != null">
        send_type,
      </if>
      <if test="bankCardNo != null">
        bank_card_no,
      </if>
      <if test="realName != null">
        real_name,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="district != null">
        #{district,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="workTimeStart != null">
        #{workTimeStart,jdbcType=VARCHAR},
      </if>
      <if test="workTimeEnd != null">
        #{workTimeEnd,jdbcType=VARCHAR},
      </if>
      <if test="dispatchType != null">
        #{dispatchType,jdbcType=TINYINT},
      </if>
      <if test="serviceType != null">
        #{serviceType,jdbcType=TINYINT},
      </if>
      <if test="idcard != null">
        #{idcard,jdbcType=VARCHAR},
      </if>
      <if test="mechanicStatus != null">
        #{mechanicStatus,jdbcType=VARCHAR},
      </if>
      <if test="workStatus != null">
        #{workStatus,jdbcType=TINYINT},
      </if>
      <if test="sendType != null">
        #{sendType,jdbcType=TINYINT},
      </if>
      <if test="bankCardNo != null">
        #{bankCardNo,jdbcType=VARCHAR},
      </if>   
      <if test="realName != null">
        #{realName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
    update sys_mechanic
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="district != null">
        district = #{district,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="workTimeStart != null">
        work_time_start = #{workTimeStart,jdbcType=VARCHAR},
      </if>
      <if test="workTimeEnd != null">
        work_time_end = #{workTimeEnd,jdbcType=VARCHAR},
      </if>
      <if test="dispatchType != null">
        dispatch_type = #{dispatchType,jdbcType=TINYINT},
      </if>
      <if test="serviceType != null">
        service_type = #{serviceType,jdbcType=TINYINT},
      </if>
      <if test="idcard != null">
        IDCard = #{idcard,jdbcType=VARCHAR},
      </if>
      <if test="mechanicStatus != null">
        mechanic_status = #{mechanicStatus,jdbcType=VARCHAR},
      </if>
      <if test="workStatus != null">
        work_status = #{workStatus,jdbcType=TINYINT},
      </if>
      <if test="sendType != null">
        send_type = #{sendType,jdbcType=TINYINT},
      </if>
      <if test="bankCardNo != null">
        bank_card_no = #{bankCardNo,jdbcType=VARCHAR},
      </if>
      <if test="realName != null">
        real_name = #{realName,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.glsx.usercenter.pojo.user.SysMechanicEntity">
    update sys_mechanic
    set user_id = #{userId,jdbcType=INTEGER},
      district = #{district,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR},
      work_time_start = #{workTimeStart,jdbcType=VARCHAR},
      work_time_end = #{workTimeEnd,jdbcType=VARCHAR},
      dispatch_type = #{dispatchType,jdbcType=TINYINT},
      service_type = #{serviceType,jdbcType=TINYINT},
      IDCard = #{idcard,jdbcType=VARCHAR},
      mechanic_status = #{mechanicStatus,jdbcType=VARCHAR},
      work_status = #{workStatus,jdbcType=TINYINT},
      send_type = #{sendType,jdbcType=TINYINT},
      bank_card_no = #{bankCardNo,jdbcType=VARCHAR},      
      real_name = #{realName,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>

	<select id="selectByUserIdAndCheckStatus" resultMap="BaseResultMap">
	select
	<include refid="Base_Column_List" />
	from sys_mechanic
	<where>
		<if test="userId != null">
			and user_id = #{userId,jdbcType=INTEGER}
		</if>
		<if test="mechanicStatus != null">
			and mechanic_status = #{mechanicStatus,jdbcType=VARCHAR}
		</if>
	</where>

</select>
</mapper>