InsuranceAddDeviceConfigMapper.xml 4.25 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="cn.com.glsx.dj.insure.mapper.InsuranceAddDeviceConfigMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.insure.model.InsuranceAddDeviceConfig">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="province_id" jdbcType="INTEGER" property="provinceId" />
    <result column="province_name" jdbcType="VARCHAR" property="provinceName" />
    <result column="car_brand_id" jdbcType="INTEGER" property="carBrandId" />
    <result column="car_brand_name" jdbcType="VARCHAR" property="carBrandName" />
    <result column="car_series_id" jdbcType="INTEGER" property="carSeriesId" />
    <result column="car_series_name" jdbcType="VARCHAR" property="carSeriesName" />
    <result column="min_device_count" jdbcType="TINYINT" property="minDeviceCount" />
    <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
    <result column="created_date" jdbcType="TIMESTAMP" property="createdDate" />
    <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
    <result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" />
    <result column="delete_flag" jdbcType="CHAR" property="deleteFlag" />
  </resultMap>

  <sql id="Base_Column_List">
    id, province_id, province_name, car_brand_id, car_brand_name, car_series_id, car_series_name, 
    min_device_count, created_by, created_date, updated_by, updated_date, delete_flag
  </sql>
  <select id="list" parameterType="cn.com.glsx.dj.insure.model.InsuranceAddDeviceConfig" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from dj_insurance_add_device_config
    <where>
    	delete_flag = 'N'
    	<if test="id != null">
    		and id = #{id}
    	</if>
    	<if test="provinceId != null">
    		and province_id = #{provinceId}
    	</if>
    	<if test="carBrandId != null">
    		and car_brand_id = #{carBrandId}
    	</if>
    	<if test="carSeriesId != null">
    		and car_series_id = #{carSeriesId}
    	</if>
    </where>
  </select>

  <insert id="insert" parameterType="cn.com.glsx.dj.insure.model.InsuranceAddDeviceConfig" useGeneratedKeys="true" keyProperty="id">
    insert into dj_insurance_add_device_config (<include refid="Base_Column_List" />)
    values (#{id,jdbcType=INTEGER}, #{provinceId,jdbcType=INTEGER}, #{provinceName,jdbcType=VARCHAR}, 
      #{carBrandId,jdbcType=INTEGER}, #{carBrandName,jdbcType=VARCHAR}, #{carSeriesId,jdbcType=INTEGER}, 
      #{carSeriesName,jdbcType=VARCHAR}, #{minDeviceCount,jdbcType=TINYINT},
      #{createdBy,jdbcType=VARCHAR}, #{createdDate,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, 
      #{updatedDate,jdbcType=TIMESTAMP}, #{deleteFlag,jdbcType=CHAR})
  </insert>
  
  <update id="update" parameterType="cn.com.glsx.dj.insure.model.InsuranceAddDeviceConfig">
    update dj_insurance_add_device_config
    <set>
      <if test="provinceId != null">
        province_id = #{provinceId,jdbcType=INTEGER},
      </if>
      <if test="provinceName != null">
        province_name = #{provinceName,jdbcType=VARCHAR},
      </if>
      <if test="carBrandId != null">
        car_brand_id = #{carBrandId,jdbcType=INTEGER},
      </if>
      <if test="carBrandName != null">
        car_brand_name = #{carBrandName,jdbcType=VARCHAR},
      </if>
      <if test="carSeriesId != null">
        car_series_id = #{carSeriesId,jdbcType=INTEGER},
      </if>
      <if test="carSeriesName != null">
        car_series_name = #{carSeriesName,jdbcType=VARCHAR},
      </if>
      <if test="minDeviceCount != null">
        min_device_count = #{minDeviceCount,jdbcType=TINYINT},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="createdDate != null">
        created_date = #{createdDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedDate != null">
        updated_date = #{updatedDate,jdbcType=TIMESTAMP},
      </if>
      <if test="deleteFlag != null">
        delete_flag = #{deleteFlag,jdbcType=CHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>