ptcmapper.xml 4.61 KB
Newer Older
hulei committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
<?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.brilliance.isc.mda.dao.PtcMapper">
    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Ptc">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ptyinr" column="ptyinr" jdbcType="VARCHAR"/>
        <result property="ptainr" column="ptainr" jdbcType="VARCHAR"/>
        <result property="nam" column="nam" jdbcType="VARCHAR"/>
        <result property="eno" column="eno" jdbcType="VARCHAR"/>
        <result property="dep" column="dep" jdbcType="VARCHAR"/>
        <result property="gen" column="gen" jdbcType="VARCHAR"/>
        <result property="biddat" column="biddat" jdbcType="DATE"/>
        <result property="telfac" column="telfac" jdbcType="VARCHAR"/>
        <result property="telfax" column="telfax" jdbcType="VARCHAR"/>
        <result property="telmob" column="telmob" jdbcType="VARCHAR"/>
        <result property="teloff" column="teloff" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="eml" column="eml" jdbcType="VARCHAR"/>
        <result property="etgextkey" column="etgextkey" jdbcType="VARCHAR"/>
        <result property="boptyp" column="boptyp" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ptyinr,ptainr,nam,eno,dep,gen,biddat,telfac,telfax,telmob,teloff,ver,eml,etgextkey,boptyp
    </sql>

    <insert id="insert">
        insert into ptc (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ptyinr,jdbcType=VARCHAR},
            #{ptainr,jdbcType=VARCHAR},
            #{nam,jdbcType=VARCHAR},
            #{eno,jdbcType=VARCHAR},
            #{dep,jdbcType=VARCHAR},
            #{gen,jdbcType=VARCHAR},
            #{biddat,jdbcType=DATE},
            #{telfac,jdbcType=VARCHAR},
            #{telfax,jdbcType=VARCHAR},
            #{telmob,jdbcType=VARCHAR},
            #{teloff,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{eml,jdbcType=VARCHAR},
            #{etgextkey,jdbcType=VARCHAR},
            #{boptyp,jdbcType=VARCHAR},
        </trim>
    </insert>

    <update id="updateByPrimaryKey">
        update ptc
        <set>
            ptyinr = #{ptyinr,jdbcType=VARCHAR},
            ptainr = #{ptainr,jdbcType=VARCHAR},
            nam = #{nam,jdbcType=VARCHAR},
            eno = #{eno,jdbcType=VARCHAR},
            dep = #{dep,jdbcType=VARCHAR},
            gen = #{gen,jdbcType=VARCHAR},
            biddat = #{biddat,jdbcType=DATE},
            telfac = #{telfac,jdbcType=VARCHAR},
            telfax = #{telfax,jdbcType=VARCHAR},
            telmob = #{telmob,jdbcType=VARCHAR},
            teloff = #{teloff,jdbcType=VARCHAR},
            ver = #{ver,jdbcType=VARCHAR},
            eml = #{eml,jdbcType=VARCHAR},
            etgextkey = #{etgextkey,jdbcType=VARCHAR},
            boptyp = #{boptyp,jdbcType=VARCHAR},
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <select id="selectByPtyinrAndTyp" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ptc
        where
        ptyinr = #{ptyinr,jdbcType=VARCHAR}
        and boptyp = #{boptyp,jdbcType=VARCHAR}
        limit 1
    </select>

    <select id="selectByPtyinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ptc
        where
        ptyinr = #{ptyinr,jdbcType=VARCHAR}
        order by inr desc
    </select>

    <delete id="deleteByInr">
        delete from ptc where inr= #{inr,jdbcType=VARCHAR}
    </delete>

    <select id="selectByInr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ptc
        where
        inr = #{inr,jdbcType=VARCHAR}
    </select>

    <select id="selectByJuscod" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ptc
        where
        ptyinr in (
        select inr from pty where ptytyp = 'C' and juscod = #{juscod,jdbcType=VARCHAR}
        )
        and boptyp = #{boptyp,jdbcType=VARCHAR}
        order by inr desc
    </select>

    <select id="selectByIdcode" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ptc
        where
        ptyinr in (
        select inr from pty where ptytyp = 'C' and  idcode =#{idcode,jdbcType=VARCHAR}
        )
        and boptyp = #{boptyp,jdbcType=VARCHAR}
        order by inr desc
    </select>
</mapper>