<?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.superdesk.uniorder.dao.mapper.setting.UnifiedSnConfigMapper">
	<resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.setting.UnifiedSnConfig">
		<id column="id" property="id" jdbcType="BIGINT"/>
		<result column="next_sn" property="nextSn" jdbcType="VARCHAR"/>
		<result column="service_no" property="serviceNo" jdbcType="VARCHAR"/>
		<result column="start_str" property="startStr" jdbcType="VARCHAR"/>
		<result column="end_inivalue" property="endInivalue" jdbcType="INTEGER"/>
		<result column="end_length" property="endLength" jdbcType="INTEGER"/>
		<result column="end_rodom" property="endRodom" jdbcType="TINYINT"/>
		<result column="mid_dateformat" property="midDateformat" jdbcType="VARCHAR"/>
		<result column="remarks" property="remarks" jdbcType="VARCHAR"/>
		<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
		<result column="create_user_id" property="createUserId" jdbcType="BIGINT"/>
		<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
		<result column="update_user_id" property="updateUserId" jdbcType="BIGINT"/>
	</resultMap>
	<sql id="Base_Column_List">
    id, next_sn, service_no, start_str, end_inivalue, end_length, end_rodom, mid_dateformat, 
    remarks, create_time, create_user_id, update_time, update_user_id
  </sql>
	<select id="selectByServiceNo" resultMap="BaseResultMap" parameterType="java.lang.String">
		select
		<include refid="Base_Column_List"/>
		from unified_sn_config
		where service_no = #{serviceNo,jdbcType=VARCHAR}
	</select>

	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
		select
		<include refid="Base_Column_List"/>
		from unified_sn_config
		where id = #{id,jdbcType=BIGINT}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from unified_sn_config
    where id = #{id,jdbcType=BIGINT}
  </delete>
	<insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedSnConfig">
		<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
			SELECT LAST_INSERT_ID()
		</selectKey>
		insert into unified_sn_config (next_sn, service_no, start_str,
		end_inivalue, end_length, end_rodom,
		mid_dateformat, remarks, create_time,
		create_user_id, update_time, update_user_id
		)
		values (#{nextSn,jdbcType=VARCHAR}, #{serviceNo,jdbcType=VARCHAR}, #{startStr,jdbcType=VARCHAR},
		#{endInivalue,jdbcType=INTEGER}, #{endLength,jdbcType=INTEGER}, #{endRodom,jdbcType=TINYINT},
		#{midDateformat,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
		#{createUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}
		)
	</insert>
	<insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedSnConfig">
		<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
			SELECT LAST_INSERT_ID()
		</selectKey>
		insert into unified_sn_config
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="nextSn != null">
				next_sn,
			</if>
			<if test="serviceNo != null">
				service_no,
			</if>
			<if test="startStr != null">
				start_str,
			</if>
			<if test="endInivalue != null">
				end_inivalue,
			</if>
			<if test="endLength != null">
				end_length,
			</if>
			<if test="endRodom != null">
				end_rodom,
			</if>
			<if test="midDateformat != null">
				mid_dateformat,
			</if>
			<if test="remarks != null">
				remarks,
			</if>
			<if test="createTime != null">
				create_time,
			</if>
			<if test="createUserId != null">
				create_user_id,
			</if>
			<if test="updateTime != null">
				update_time,
			</if>
			<if test="updateUserId != null">
				update_user_id,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="nextSn != null">
				#{nextSn,jdbcType=VARCHAR},
			</if>
			<if test="serviceNo != null">
				#{serviceNo,jdbcType=VARCHAR},
			</if>
			<if test="startStr != null">
				#{startStr,jdbcType=VARCHAR},
			</if>
			<if test="endInivalue != null">
				#{endInivalue,jdbcType=INTEGER},
			</if>
			<if test="endLength != null">
				#{endLength,jdbcType=INTEGER},
			</if>
			<if test="endRodom != null">
				#{endRodom,jdbcType=TINYINT},
			</if>
			<if test="midDateformat != null">
				#{midDateformat,jdbcType=VARCHAR},
			</if>
			<if test="remarks != null">
				#{remarks,jdbcType=VARCHAR},
			</if>
			<if test="createTime != null">
				#{createTime,jdbcType=TIMESTAMP},
			</if>
			<if test="createUserId != null">
				#{createUserId,jdbcType=BIGINT},
			</if>
			<if test="updateTime != null">
				#{updateTime,jdbcType=TIMESTAMP},
			</if>
			<if test="updateUserId != null">
				#{updateUserId,jdbcType=BIGINT},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedSnConfig">
		update unified_sn_config
		<set>
			<if test="nextSn != null">
				next_sn = #{nextSn,jdbcType=VARCHAR},
			</if>
			<if test="serviceNo != null">
				service_no = #{serviceNo,jdbcType=VARCHAR},
			</if>
			<if test="startStr != null">
				start_str = #{startStr,jdbcType=VARCHAR},
			</if>
			<if test="endInivalue != null">
				end_inivalue = #{endInivalue,jdbcType=INTEGER},
			</if>
			<if test="endLength != null">
				end_length = #{endLength,jdbcType=INTEGER},
			</if>
			<if test="endRodom != null">
				end_rodom = #{endRodom,jdbcType=TINYINT},
			</if>
			<if test="midDateformat != null">
				mid_dateformat = #{midDateformat,jdbcType=VARCHAR},
			</if>
			<if test="remarks != null">
				remarks = #{remarks,jdbcType=VARCHAR},
			</if>
			<if test="createTime != null">
				create_time = #{createTime,jdbcType=TIMESTAMP},
			</if>
			<if test="createUserId != null">
				create_user_id = #{createUserId,jdbcType=BIGINT},
			</if>
			<if test="updateTime != null">
				update_time = #{updateTime,jdbcType=TIMESTAMP},
			</if>
			<if test="updateUserId != null">
				update_user_id = #{updateUserId,jdbcType=BIGINT},
			</if>
		</set>
		where id = #{id,jdbcType=BIGINT}
	</update>
	<update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.setting.UnifiedSnConfig">
    update unified_sn_config
    set next_sn = #{nextSn,jdbcType=VARCHAR},
      service_no = #{serviceNo,jdbcType=VARCHAR},
      start_str = #{startStr,jdbcType=VARCHAR},
      end_inivalue = #{endInivalue,jdbcType=INTEGER},
      end_length = #{endLength,jdbcType=INTEGER},
      end_rodom = #{endRodom,jdbcType=TINYINT},
      mid_dateformat = #{midDateformat,jdbcType=VARCHAR},
      remarks = #{remarks,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>