Blame view

OprAdmDictMapper.xml 2.5 KB
涂亚平 committed
1 2 3 4 5
<?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.subsidy.mapper.OprAdmDictMapper">

    <!-- 通用查询映射结果 -->
涂亚平 committed
6
    <resultMap id="BaseResultMap" type="com.subsidy.model.OprAdmDictDO">
涂亚平 committed
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
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="delete_date" property="deleteDate" />
        <result column="user_id" property="userId" />
        <result column="opr_type" property="oprType" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, user_id, opr_type
    </sql>


    <select id="getHistory" resultType="com.subsidy.vo.opr.GetHistoryVO">
        SELECT
            t.id,
            t2.account_name as userName,
            t3.company_name,
            t.opr_type,
            t.create_date,
            t.result
        FROM
            opr_adm_dict t
            LEFT JOIN administer t2 ON t.user_id = t2.id
            LEFT JOIN company_dict t3 ON t2.company_id = t3.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            <if test="userName != null and userName !=''">
                and t2.account_name like concat('%',#{userName} ,'%')
            </if>
            AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) BETWEEN DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
            AND DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
        ORDER BY
            t.create_date DESC
    </select>

涂亚平 committed
49
    <select id="getLoginInfo" parameterType="long" resultType="com.subsidy.model.OprAdmDictDO">
涂亚平 committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
        SELECT
           *
        FROM
            (
            SELECT
                *
            FROM
                opr_adm_dict t
                where t.delete_date is null
                and t.user_id  = #{userId}
                and DATE_FORMAT(t.create_date,'%Y-%m-%d') =DATE_FORMAT(now(), '%Y-%m-%d')
                and TIMESTAMPDIFF(SECOND,t.create_date,now()) &lt;= 300
            ORDER BY
            t.create_date DESC
            LIMIT 5)t2
    </select>

涂亚平 committed
67
    <select id="getRecordByDate" resultType="com.subsidy.model.OprAdmDictDO">
邓敏 committed
68 69 70 71 72
        SELECT
            *
        FROM
            opr_adm_dict
        WHERE
73
            create_date &lt; (NOW() - INTERVAL 1 DAY)
邓敏 committed
74 75
    </select>

涂亚平 committed
76
</mapper>