|
- <?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.WxMerchantBUserMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxMerchantBUser">
- <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="phone" jdbcType="VARCHAR" property="phone"/>
- <result column="user_pwd" jdbcType="VARCHAR" property="userPwd"/>
- <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/>
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
- <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
- <result column="app_id" jdbcType="VARCHAR" property="appId"/>
- <result column="token" jdbcType="VARCHAR" property="token"/>
- <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`phone`,`user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name`,`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 != phone ">
- and `phone` = #{phone}
- </if>
-
- <if test=" null != userPwd ">
- and `user_pwd` like concat('%', #{userPwd},'%')
- </if>
-
- <if test=" null != merchantId ">
- and `merchant_id` = #{merchantId}
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
- </if>
-
- <if test=" null != updateDate ">
- and `update_date` = #{updateDate}
- </if>
-
- <if test=" null != appId ">
- and `app_id` like concat('%', #{appId},'%')
- </if>
-
- <if test=" null != token ">
- and `token` like concat('%', #{token},'%')
- </if>
-
- <if test=" null != expireTime ">
- and `expire_time` = #{expireTime}
- </if>
- <if test=" null != name ">
- and `name` = #{name}
- </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.WxMerchantBUser" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_merchant_b_user
- <include refid="dynamicWhereConditions"/>
- </select>
-
- <select id="findSelMerchantList" parameterType="com.iformall.domain.po.WxMerchantBUser" resultType="com.iformall.domain.vo.WxMerchantBuInfoVo">
- select
- mbu.tenant_id, mbu.parent_tenant_id, m.name tenant_name,
- mc.name merchant_name, mbu.id bu_user_id, mbu.merchant_id, mc.img_url
- from wx_merchant_b_user mbu, wx_merchant mc, wx_mall m
- <where> m.tenant_id = mbu.parent_tenant_id
- and mbu.merchant_id = mc.id and mc.status = 1
- <if test=" null != appId ">
- and mbu.`app_id` = #{appId}
- </if>
- <if test=" null != phone ">
- and mbu.`phone` = #{phone}
- </if>
- <if test=" null != status ">
- and mbu.`status` = #{status}
- </if>
- </where>
- </select>
-
- <select id="findByToken" resultMap="BaseResultMap">
- select * from wx_merchant_b_user
- where `token` = #{token}
- </select>
-
-
- </mapper>
|