1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?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="cn.ezhizao.project.business.keepAccounts.mapper.BizFinancialKeepAccountDetailMapper">
- <!-- 基础的返回map 多表复杂的 自行组合 -->
- <resultMap id="BaseResultMap" type="cn.ezhizao.project.business.keepAccounts.domain.BizFinancialKeepAccountDetail" />
- <!--带条件的List查询-->
- <select id="getList" resultMap="BaseResultMap">
- <include refid="getListSql" />
- </select>
- <!--带条件的List查询 数据总条数-->
- <select id="getTotal" resultType="java.lang.Integer">
- SELECT COUNT(1) FROM (<include refid="getListSql" />) AS t
- </select>
- <sql id="getListSql">
- SELECT
- t1.*, t2.name as company_name
- from
- biz_financial_keep_account_detail t1
- left join biz_company t2 on t2.id = t1.company_id
- WHERE
- t1.deleted = 0
- <if test="id != null">
- AND t1.id = #{id}
- </if>
- <if test="financialKeepAccountId != null">
- AND t1.financial_keep_account_id = ${financialKeepAccountId}
- </if>
- <if test="year != null and year != ''">
- AND t1.year = #{year}
- </if>
- <if test="month != null and month != ''">
- AND t1.month = #{month}
- </if>
- <if test="mainIds != null and mainIds.size > 0">
- AND t1.financial_keep_account_id in
- <foreach collection="mainIds" index="index" item="item" separator="," open="(" close=")">
- #{item,jdbcType=BIGINT}
- </foreach>
- </if>
- </sql>
- </mapper>
|