溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

java_mybatis

發(fā)布時(shí)間:2020-06-14 15:36:22 來(lái)源:網(wǎng)絡(luò) 閱讀:267 作者:zjy1002261870 欄目:開(kāi)發(fā)技術(shù)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<properties resource="META-INF/properties/dbms.properties"></properties>
<settings>

    <setting name="cacheEnabled" value="true" />                                        <!-- mybatis cache ???? -->
    <setting name="lazyLoadingEnabled" value="true" />                              <!-- ???? ???? -->
    <setting name="multipleResultSetsEnabled" value="true" />                       <!-- ? ?? ???? ?? ?? ResultSet? ???? ?? -->
    <setting name="useColumnLabel" value="true" />                                  <!-- ??? ?? ?? ??? ?? -->
    <setting name="useGeneratedKeys" value="false" />                               <!-- ???? ?? JDBC ?? ?? ?? -->
    <setting name="autoMappingBehavior" value="PARTIAL" />                          <!-- mybatis? ??? ??/????? ???? ????? ??? ?? ??(PARTIAL? ???? ?? ??? ?? -->
    <setting name="defaultExecutorType" value="SIMPLE" />                           <!-- ??? Executor ??(SIMPLE? ??? ???? ?? ??) -->
    <setting name="defaultStatementTimeout" value="10" />                           <!-- DB ?? ???? ?? -->
    <setting name="safeRowBoundsEnabled" value="false" />                           <!-- ????? RowBound ?? ???? -->
    <setting name="mapUnderscoreToCamelCase" value="false" />                       <!-- ??? DB ???? JAVA? Camel????? ?? ?? ?? -->
    <setting name="localCacheScope" value="SESSION" />                              <!-- ???? ????(SESSION: ??? ???? ????? ??) -->
    <setting name="jdbcTypeForNull" value="NULL" />                                 <!-- mybatis? ???? parameter? null? ??, jdbcType? Setting -->
    <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString" />    <!-- ????? ???? ??? ???? ?? -->
    <setting name="callSettersOnNulls" value="true" />                              <!-- ??? ?? null?? setter? ?? put ???? ????? ?? (false???, null? field? ???? ??? : default? false -->

</settings>

<mappers>
    <!-- <property name="mapperLocations" value="classpath:META-INF/persistence/mybatis/${dbms.kind}/*Mapper.xml"></property>  -->
    <mapper resource="META-INF/persistence/mybatis/${dbms.kind}/GoodsMapper.xml" />
    <mapper resource="META-INF/persistence/mybatis/${dbms.kind}/Paging.xml" />
    <mapper resource="META-INF/persistence/mybatis/${dbms.kind}/SurveyMapper.xml" />
</mappers>

</configuration>
<?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="paging">

<!-- ???? ?? ?? QUERY ???..??? ?? ????? ?? ????.. -->
<sql id="pagingPreSQL">
    SELECT * FROM (
    SELECT ROWNUM AS "ROWNUMBER" , AA.* FROM (
</sql>

<sql id="pagingPostSQL">
    ) AA ) AAA
     <![CDATA[
        WHERE AAA.ROWNUMBER  >= #{firstRowIndex} AND  AAA.ROWNUMBER  <= #{lastRowIndex}
     ]]>
</sql>

<sql id="pagingPreSqlOverCount">
    SELECT FLOOR((AA.totalCount-1)/#{rowPerPage})+1 totalPage , AA.* FROM (
    SELECT COUNT(*) OVER() totalCount, ROWNUM ROWNUMBER,MAINSQL.* FROM
    (
</sql>

<sql id="pagingPostSqlOverCount">

    ) MAINSQL 
     <![CDATA[ ) AA WHERE ROWNUMBER>=((#{pageNo}-1)*#{rowPerPage})+1 AND ROWNUMBER <= (((#{pageNo}-1)*#{rowPerPage})+1) + #{rowPerPage}-1 ]]>
</sql>

</mapper>
<?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="FileUploadDataMapper">

<select id="getFileUploadData" parameterType="java.util.Map"
    resultType="java.util.Map">
    SELECT [Number]
    ,[FileGuid]
    ,[FileId]
    ,[FilePath]
    ,[FileName]
    ,[FileType]
    ,[FileSize]
    ,[CreateTime]
    FROM [dbo].[AA_FileUploadData]
    WHERE 1=1

    <if test="FileGuid !=null and FileGuid !='' ">
        AND FileGuid= #{FileGuid}
    </if>
    <if test="FileId !=null and FileId !='' ">
        AND FileId= #{FileId}
    </if>
</select>

<select id="getFileUploadDataList" parameterType="java.util.Map"
    resultType="java.util.Map">
    <include refid="paging.pagingPreSQL" />
    select ROW_NUMBER() over(order by Number desc )
    rownum,[Number]
    ,[FileGuid]
    ,[FileId]
    ,[FilePath]
    ,[FileName]
    ,[FileType]
    ,[FileSize]
    ,[CreateTime]
    from AA_FileUploadData
    where 1=1
    <if test="FileGuid !=null and FileGuid !='' ">
        AND FileGuid= #{FileGuid}
    </if>
    <if test="FileId !=null and FileId !='' ">
        AND FileId= #{FileId}
    </if>
    <include refid="paging.pagingPostSQL" />
</select>
<select id="getFileUploadDataListCnt" parameterType="java.util.Map"
    resultType="java.lang.Integer">
    select count(1) as "totalCnt"
    from AA_FileUploadData
    where 1=1
    <if test="FileGuid !=null and FileGuid !='' ">
        AND FileGuid= #{FileGuid}
    </if>
    <if test="FileId !=null and FileId !='' ">
        AND FileId= #{FileId}
    </if>
</select>
<!-- useGeneratedKeys="true" keyProperty="GoodsID" -->

<insert id="insertFileUploadData" parameterType="java.util.Map">
    <selectKey resultType="int" keyProperty="Number" order="AFTER">
        select
        @@IDENTITY as id
    </selectKey>
    INSERT INTO [dbo].[AA_FileUploadData]
    ([FileGuid]
    ,[FileId]
    ,[FilePath]
    ,[FileName]
    ,[FileType]
    ,[FileSize]
    ,[CreateTime])
    VALUES
    (
    #{FileGuid},
    #{FileId},
    #{FilePath},
    #{FileName},
    #{FileType},
    #{FileSize},
    GetDate()
    )
</insert>

<delete id="deleteFileUploadData" parameterType="java.util.Map">
    DELETE FROM AA_FileUploadData
    WHERE FileGuid = #{FileGuid}
    <if test="FileId !=null and FileId !='' ">
        AND FileId = #{FileId}
    </if>
</delete>

</mapper>

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI