123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <?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.caimei.modules.user.dao.ClubTemporaryDao">
- <sql id="clubTemporaryColumns">
- a.id AS "id",
- a.userId AS "userId",
- a.confirmUserId AS "confirmUserId",
- a.name AS "name",
- a.shortName AS "shortName",
- a.bindMobile AS "bindMobile",
- a.contractEmail AS "contractEmail",
- a.linkMan AS "linkMan",
- a.linkManIdentity AS "linkManIdentity",
- a.provinceId AS "provinceId",
- a.cityId AS "cityId",
- a.townId AS "townId",
- a.address AS "address",
- a.shopPhoto AS "shopPhoto",
- a.businessLicense AS "businessLicense",
- a.socialCreditCode AS "socialCreditCode",
- a.firstClubType AS "firstClubType",
- a.secondClubType AS "secondClubType",
- a.department AS "department",
- a.medicalPracticeLicense AS "medicalPracticeLicense",
- a.mainProduct AS "mainProduct",
- a.isAgreed AS "isAgreed",
- a.addTime AS "addTime",
- IFNULL(s.name,s.linkMan) AS "spName",
- if(csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime,1,0) as svipUserFlag
- </sql>
- <sql id="clubTemporaryJoins">
- LEFT JOIN serviceprovider s ON s.userID = a.userId
- LEFT JOIN cm_svip_user csu ON csu.userId = a.userId
- </sql>
- <select id="get" resultType="ClubTemporary">
- SELECT
- <include refid="clubTemporaryColumns"/>,
- d.name AS "province",
- c.name AS "city",
- b.name AS "town"
- FROM club_temporary a
- <include refid="clubTemporaryJoins"/>
- LEFT JOIN town b ON b.townID=a.townID
- LEFT JOIN city c ON c.cityID=b.cityID
- LEFT JOIN province d ON d.provinceID=c.provinceID
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultType="ClubTemporary">
- SELECT
- <include refid="clubTemporaryColumns"/>
- FROM club_temporary a
- <include refid="clubTemporaryJoins"/>
- <where>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="bindMobile != null and bindMobile != ''">
- AND a.bindMobile LIKE
- <if test="dbName == 'oracle'">'%'||#{bindMobile}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{bindMobile}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{bindMobile},'%')</if>
- </if>
- <if test="contractEmail != null and contractEmail != ''">
- AND a.contractEmail LIKE
- <if test="dbName == 'oracle'">'%'||#{contractEmail}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{contractEmail}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{contractEmail},'%')</if>
- </if>
- <if test="linkMan != null and linkMan != ''">
- AND a.linkMan LIKE
- <if test="dbName == 'oracle'">'%'||#{linkMan}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{linkMan}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{linkMan},'%')</if>
- </if>
- <if test="startTime != null and startTime != ''">
- AND a.addTime <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND a.addTime <![CDATA[ < ]]> #{endTime}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.addTime DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="ClubTemporary">
- SELECT
- <include refid="clubTemporaryColumns"/>
- FROM club_temporary a
- <include refid="clubTemporaryJoins"/>
- <where>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" parameterType="ClubTemporary" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO club_temporary(
- id,
- userId,
- name,
- shortName,
- bindMobile,
- contractEmail,
- linkMan,
- linkManIdentity,
- provinceId,
- cityId,
- townId,
- address,
- shopPhoto,
- businessLicense,
- socialCreditCode,
- firstClubType,
- secondClubType,
- department,
- medicalPracticeLicense,
- mainProduct,
- isAgreed,
- addTime
- ) VALUES (
- #{id},
- #{userId},
- #{name},
- #{shortName},
- #{bindMobile},
- #{contractEmail},
- #{linkMan},
- #{linkManIdentity},
- #{provinceId},
- #{cityId},
- #{townId},
- #{address},
- #{shopPhoto},
- #{businessLicense},
- #{socialCreditCode},
- #{firstClubType},
- #{secondClubType},
- #{department},
- #{medicalPracticeLicense},
- #{mainProduct},
- #{isAgreed},
- #{addTime}
- )
- </insert>
- <update id="update">
- UPDATE club_temporary SET
- userId = #{userId},
- confirmUserId = #{confirmUserId},
- name = #{name},
- shortName = #{shortName},
- bindMobile = #{bindMobile},
- contractEmail = #{contractEmail},
- linkMan = #{linkMan},
- linkManIdentity = #{linkManIdentity},
- provinceId = #{provinceId},
- cityId = #{cityId},
- townId = #{townId},
- address = #{address},
- shopPhoto = #{shopPhoto},
- businessLicense = #{businessLicense},
- socialCreditCode = #{socialCreditCode},
- firstClubType = #{firstClubType},
- secondClubType = #{secondClubType},
- department = #{department},
- medicalPracticeLicense = #{medicalPracticeLicense},
- mainProduct = #{mainProduct},
- isAgreed = #{isAgreed},
- addTime = #{addTime}
- WHERE id = #{id}
- </update>
- <delete id="delete">
- DELETE FROM club_temporary
- WHERE id = #{id}
- </delete>
- <insert id="insertClubConfirmRecord">
- INSERT INTO `club_confirm_record` (
- `userId`,
- `systemUserId`,
- `images`,
- `remarks`,
- `confirmTime`
- )
- VALUES
- (
- #{userId},
- #{systemUserId},
- #{images},
- #{remarks},
- #{confirmTime}
- )
- </insert>
- <select id="findConfirmRecord" resultType="com.caimei.modules.user.entity.ClubConfirmRecord">
- SELECT
- `id`,
- `userId`,
- `systemUserId`,
- `images`,
- `remarks`,
- `confirmTime`
- FROM
- `club_confirm_record`
- WHERE
- userId = #{userId}
- ORDER BY
- confirmTime DESC
- </select>
- <select id="findByConfirmUserId" resultType="com.caimei.modules.user.entity.ClubTemporary">
- SELECT
- <include refid="clubTemporaryColumns"/>
- FROM club_temporary a
- <include refid="clubTemporaryJoins"/>
- WHERE a.confirmUserId = #{userId}
- </select>
- </mapper>
|