|
- <?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.iformall.mapper.WxChartDataMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxChartDataEntity">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <result column="type" jdbcType="INTEGER" property="type"/>
- <result column="result" jdbcType="VARCHAR" property="result"/>
- <result column="querytime" jdbcType="TIMESTAMP" property="querytime"/>
- <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`type`,`result`,`querytime`,`createtime`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
- </if>
-
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != type ">
- and `type` = #{type}
- </if>
-
- <if test=" null != querytime ">
- and `querytime` = #{querytime}
- </if>
-
- <if test=" null != startTime ">
- and `querytime` >= #{startTime}
- </if>
- <if test=" null != endTime ">
- and `querytime` <= #{endTime}
- </if>
-
- order by querytime
-
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxChartDataEntity" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_chart_data
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findSumResult" parameterType="com.iformall.domain.po.WxChartDataEntity" resultType="long">
- select IFNULL(sum(result),0)
- from wx_chart_data
- <include refid="dynamicWhereConditions"/>
- </select>
-
- </mapper>
|