123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?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.housingFund.mapper.BizHousingFundConfirmDetailMapper">
- <!-- 基础的返回map 多表复杂的 自行组合 -->
- <resultMap id="BaseResultMap" type="cn.ezhizao.project.business.housingFund.domain.BizHousingFundConfirmDetail">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <collection property="details" select="getEmployees" column="id" />
- </resultMap>
- <resultMap id="EmployeeResult" type="cn.ezhizao.project.business.housingFund.domain.BizHousingFundConfirmDetailEmployee">
- <id column="id" jdbcType="INTEGER" property="id"/>
- </resultMap>
- <select id="getEmployees" resultMap="EmployeeResult">
- select *
- from biz_housing_fund_confirm_detail_employee
- where housing_fund_confirm_detail_id = #{id}
- </select>
- <!--带条件的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 C
- </select>
- <sql id="getListSql">
- SELECT t1.*, t2.name as company_name, t2.is_first_housing_fund
- , t2.is_pay_on_window, t2.housing_fund_password
- , t2.housing_fund_unit_account, t2.housing_fund_deduction_password
- FROM biz_housing_fund_confirm_detail t1 left join biz_company t2 on t2.id = t1.company_id
- <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
- t1.deleted = 0 AND
- <if test="id != null ">
- t1.id = #{id} AND
- </if>
- <if test="housingFundConfirmId != null ">
- t1.housing_fund_confirm_id = #{housingFundConfirmId} AND
- </if>
- <if test="companyId != null ">
- t1.company_id = #{companyId} AND
- </if>
- <if test="year != null and year != '' ">
- t1.year = #{year} AND
- </if>
- <if test="month != null and month != '' ">
- t1.month = #{month} AND
- </if>
- <if test="status != null ">
- t1.status = #{status} AND
- </if>
- <if test="content != null and content != '' ">
- t1.content = #{content} AND
- </if>
- <if test="verifyContent != null and verifyContent != '' ">
- t1.verify_content = #{verifyContent} AND
- </if>
- <if test="startMonth != null and endMonth != null">
- STR_TO_DATE(concat(t1.year, '-', t1.month, '-01'), '%Y-%m-%d') between #{startMonth} and #{endMonth} AND
- </if>
- </trim>
- </sql>
- </mapper>
|