<?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="net.mingsoft.basic.dao.IAppDao"> <cache /> <!-- 字段绑定 开始 --> <resultMap type="net.mingsoft.basic.entity.AppEntity" id="resultMap"> <id column="id" property="id" /><!-- 与website表绑定id --> <result column="APP_PAY_DATE" property="appPayDate" /> <result column="APP_PAY" property="appPay" /> <result column="APP_KEYWORD" property="appKeyword" /><!-- 与website表绑定keyword --> <result column="APP_COPYRIGHT" property="appCopyright" /><!-- 与website表绑定copyright --> <result column="APP_STYLE" property="appStyle" /><!-- 与website表绑定style --> <result column="APP_URL" property="appUrl" /><!-- 与website表绑定url --> <result column="APP_NAME" property="appName" /> <result column="APP_DESCRIPTION" property="appDescription" /> <result column="APP_LOGO" property="appLogo" /> <result column="APP_DATETIME" property="appDatetime" /> <result column="APP_MOBILE_STYLE" property="appMobileStyle" /> <result column="APP_LOGIN_PAGE" property="appLoginPage" /><!-- 应用自定义登录界面 --> </resultMap> <!-- 字段绑定结束 --> <!-- 更新website开始 --> <update id="updateEntity" parameterType="net.mingsoft.base.entity.BaseEntity" flushCache="true"> update app <set> <if test="appName != null">APP_NAME =#{appName},</if> <if test="appDescription != null">APP_DESCRIPTION =#{appDescription},</if> <if test="appLogo != null">APP_LOGO =#{appLogo},</if> <if test="appDatetime != null">APP_DATETIME =#{appDatetime},</if> <if test="appKeyword != null">APP_keyword =#{appKeyword},</if> <if test="appCopyright != null">APP_copyright =#{appCopyright},</if> <if test="appStyle != null">APP_style =#{appStyle},</if> <if test="appUrl!= null">APP_URL=#{appUrl},</if> <if test="appMobileStyle != null">APP_MOBILE_STYLE=#{appMobileStyle},</if> <if test="appPayDate != null">APP_PAY_DATE=#{appPayDate},</if> <if test="appPay != null">APP_PAY=#{appPay},</if> <if test="appLoginPage != null">APP_LOGIN_PAGE=#{appLoginPage},</if> </set> where id = #{id} </update> <!-- 更新website结束 --> <!-- 根据ID查询开始 --> <select id="getEntity" resultMap="resultMap" parameterType="int"> select * from app where id = #{id} </select> <!-- 根据域名查找站点实体 --> <select id="getByUrl" resultMap="resultMap" parameterType="String" databaseId="mysql"> select * from app limit 0,1 </select> <select id="getByUrl" resultMap="resultMap" parameterType="String" databaseId="oracle"> select * from app rownum=1 </select> <select id="getByUrl" resultMap="resultMap" parameterType="String" databaseId="sqlServer"> select top(1) * from app </select> <!-- 根据ID查询结束 --> <!-- 根据域名查询 --> <select id="countByUrl" resultType="int" parameterType="String"> select count(id) from app where REPLACE(APP_URL,"/","") = REPLACE(#{appUrl},"/","") </select> <!-- 根据域名查询结束 --> </mapper>