<?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.xxfc.platform.vehicle.mapper.ConstantMapper">

    <select id="getAllConstantTypes" resultType="java.lang.Integer">
        select distinct `type` from constant
    </select>

    <update id="updateByTypeAndCode" parameterType="com.xxfc.platform.vehicle.entity.Constant" >
        update constant set val = #{val} where type = #{type} and code = #{code}
    </update>

    <delete id="delByTypeAndCode" parameterType="com.xxfc.platform.vehicle.entity.Constant">
        delete from constant where type = #{type} and code = #{code};
    </delete>

    <insert id="insertIgnoreOnDuplicate" parameterType="com.xxfc.platform.vehicle.entity.Constant">
        insert ignore into constant(type,code,val) values (#{type},#{code},#{val})
    </insert>

    <select id="getTypebyname" resultType="java.lang.Integer">
        select distinct `code` from constant where type=#{type} and val like  CONCAT('%',#{name},'%') limit 1
    </select>


</mapper>