|
- <?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.WxContractCustomersMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxContractCustomers">
- <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="principal_type" jdbcType="INTEGER" property="principalType"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="phone" jdbcType="VARCHAR" property="phone"/>
- <result column="legal_person" jdbcType="VARCHAR" property="legalPerson"/>
- <result column="id_number" jdbcType="VARCHAR" property="idNumber"/>
- <result column="sex" jdbcType="INTEGER" property="sex"/>
- <result column="link_person" jdbcType="VARCHAR" property="linkPerson"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`principal_type`,`name`,`phone`,`legal_person`,`id_number`,`sex`,
- `link_person`,`create_date`,`update_date`,`status`
- </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 != principalType">
- and `principal_type` = #{principalType}
- </if>
-
- <if test=" null != name and name != '' ">
- and `name` like concat('%', #{name},'%')
- </if>
-
- <if test=" null != nameEqal and nameEqal != '' ">
- and `name` = #{nameEqal}
- </if>
-
- <if test=" null != phone and phone != '' ">
- and `phone` like concat('%', #{phone},'%')
- </if>
-
- <if test=" null != phoneEqal and phoneEqal != '' ">
- and `phone` = #{phoneEqal}
- </if>
-
- <if test=" null != status">
- and `status` = #{status}
- </if>
-
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxContractCustomers" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_contract_customers
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findIdList" parameterType="com.iformall.domain.po.WxContractCustomers" resultType="Long">
- select id
- from wx_contract_customers
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_contract_customers where id = #{id} and `tenant_id` = #{tenantId}
- </select>
- </mapper>
|