gimememapper.xml 2.85 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
<?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.GimEmeMapper">

    <resultMap type="com.brilliance.isc.bo.Gimeme" id="BaseResultMap">
        <result property="inr" column="INR" jdbcType="VARCHAR"/>
        <result property="ctlcod" column="CTLCOD" jdbcType="VARCHAR"/>
        <result property="begdat" column="BEGDAT" jdbcType="TIMESTAMP"/>
        <result property="enddat" column="ENDDAT" jdbcType="TIMESTAMP"/>
        <result property="usr" column="USR" jdbcType="VARCHAR"/>
        <result property="updtyp" column="UPDTYP" jdbcType="VARCHAR"/>
        <result property="ctlflg" column="CTLFLG" jdbcType="VARCHAR"/>
    </resultMap>
    
    <select id="selectGCount" resultType="int">
        SELECT count(1)
        FROM GIMEME
        WHERE date_format(ENDDAT, '%Y-%m-%d') = '2299-12-31'
          AND CTLFLG = 'G'
          AND CTLCOD = 'S'
    </select>

    <select id="selectCtlCod" resultType="string">
        SELECT CTLCOD
        FROM GIMEME
        WHERE date_format(ENDDAT, '%Y-%m-%d') = '2299-12-31'
        AND CTLFLG = 'U'
        limit 1
    </select>

    <select id="queryByIdU" resultMap="BaseResultMap">
        select inr,ctlcod,begdat,enddat,usr,updtyp,ctlflg from gimeme where ctlflg='U' and date_format(ENDDAT, '%Y-%m-%d')='2299-12-31' ORDER BY length(INR) desc, inr DESC
    </select>

    <select id="queryByIdG" resultMap="BaseResultMap">
        select inr,ctlcod,begdat,enddat,usr,updtyp,ctlflg from gimeme where ctlflg='G' and date_format(ENDDAT, '%Y-%m-%d')='2299-12-31' ORDER BY length(INR) DESC, inr DESC
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultMap="BaseResultMap">
        select inr,ctlcod,begdat,enddat,usr,updtyp,ctlflg from gimeme
        where ctlflg='U' ORDER BY length(inr) DESC, inr DESC
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLmt" resultMap="BaseResultMap">
        select inr,ctlcod,begdat,enddat,usr,updtyp,ctlflg from gimeme
        where ctlflg='G' ORDER BY length(inr) DESC, inr DESC
    </select>

    <insert id="insert">
        insert into GIMEME(INR, CTLCOD, BEGDAT, ENDDAT, USR, UPDTYP, CTLFLG)
        values (#{inr}, #{ctlcod}, now(), str_to_date('2299-12-31 23:59:00','%Y-%m-%d %H:%i:%s'), #{usr}, #{updtyp}, #{ctlflg})
    </insert>

    <update id="update">
        update GIMEME
        <set>
            ENDDAT = now(),
        </set>
        where INR= #{inr}
    </update>

    <select id="queryByCount" resultType="int">
        select count(1) from GIMEME where date_format(ENDDAT,'%Y%m%d')='22991231' and CTLFLG = 'U'
    </select>

    <select id="seleme" resultType="int">
        select count(1) from GIMEME where date_format(ENDDAT,'%Y%m%d')='22991231' and CTLFLG = 'U' and CTLCOD = #{ctlcod}
    </select>
</mapper>