123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <?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.bulkpurchase.dao.CmClubDao">
- <resultMap id="resultClub" type="CmClub">
- <result column="clubID" property="id"/>
- <result column="name" property="name"/>
- <result column="address" property="address"/>
- <result column="contractPhone" property="contractPhone"/>
- <result column="contractMobile" property="contractMobile"/>
- <result column="linkMan" property="linkMan"/>
- </resultMap>
- <sql id="cmClubColumns">
- a.clubID AS "id",
- a.userID AS "userID",
- a.name AS "name",
- a.logo AS "logo",
- a.townID as townID,
- a.address as address,
- a.legalPerson AS "legalPerson",
- a.linkMan AS "linkMan",
- a.contractPhone AS "contractPhone",
- a.contractMobile AS "contractMobile",
- a.fax AS "fax",
- a.info AS "info",
- a.addTime AS "addTime",
- a.auditTime AS "auditTime",
- a.auditNote AS "auditNote",
- a.status AS "status",
- a.businessLicenseImage AS "businessLicenseImage",
- a.defaultServiceProviderID AS "defaultServiceProviderID",
- a.defaultServiceProviderUpdTime AS "defaultServiceProviderUpdTime",
- a.sname AS "sname",
- a.flag AS "flag",
- a.scanFlag AS "scanFlag",
- a.mainServiceProviderID AS "mainServiceProviderID",
- a.spID AS "spID",
- a.mainpro AS "mainpro",
- a.provinceID AS "provinceID",
- a.cityID AS "cityID",
- a.inviterName AS "inviterName",
- a.inviterBindID AS "inviterBindID",
- a.scanTime AS "scanTime",
- a.headpic AS "headpic"
- </sql>
- <sql id="cmClubJoins">
- </sql>
- <select id="get" resultType="CmClub">
- SELECT
- <include refid="cmClubColumns"/>
- FROM club a
- <include refid="cmClubJoins"/>
- WHERE a.clubid = #{id}
- </select>
- <select id="findList" resultType="CmClub">
- SELECT
- <include refid="cmClubColumns"/>
- ,d.name province,c.name city,b.name town,f.userMoney userMoney,f.ableUserMoney ableUserMoney,
- if(csu.id is not null,1,0) as svipFlag
- FROM club a
- 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
- LEFT JOIN user f on a.userID = f.userID
- LEFT JOIN cm_svip_user csu on a.userID = csu.userId and now() <![CDATA[ < ]]> csu.endTime and csu.delFlag = '0'
- <where>
- <if test="id != null and id != ''">
- AND a.clubID = #{id}
- </if>
- <if test="userID != null and userID != ''">
- AND a.userID = #{userID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- AND a.status in (90,40,1,92)
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="CmClub">
- SELECT
- <include refid="cmClubColumns"/>
- FROM club a
- <include refid="cmClubJoins"/>
- <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="CmClub" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO club(
- userID,
- name,
- logo,
- legalPerson,
- townID,
- address,
- linkMan,
- contractPhone,
- contractMobile,
- fax,
- info,
- addTime,
- auditTime,
- auditNote,
- status,
- businessLicenseImage,
- defaultServiceProviderID,
- defaultServiceProviderUpdTime,
- sname,
- flag,
- scanFlag,
- mainServiceProviderID,
- spID,
- mainpro,
- provinceID,
- cityID,
- inviterName,
- inviterBindID,
- scanTime,
- headpic
- ) VALUES (
- #{userID},
- #{name},
- #{logo},
- #{legalPerson},
- #{townID},
- #{address},
- #{linkMan},
- #{contractPhone},
- #{contractMobile},
- #{fax},
- #{info},
- #{addTime},
- #{auditTime},
- #{auditNote},
- #{status},
- #{businessLicenseImage},
- #{defaultServiceProviderID},
- #{defaultServiceProviderUpdTime},
- #{sname},
- #{flag},
- #{scanFlag},
- #{mainServiceProviderID},
- #{spID},
- #{mainpro},
- #{provinceID},
- #{cityID},
- #{inviterName},
- #{inviterBindID},
- #{scanTime},
- #{headpic}
- )
- </insert>
- <update id="update">
- UPDATE club SET
- userID = #{userID},
- name = #{name},
- logo = #{logo},
- legalPerson = #{legalPerson},
- townID = #{townID},
- address = #{address},
- linkMan = #{linkMan},
- contractPhone = #{contractPhone},
- contractMobile = #{contractMobile},
- fax = #{fax},
- info = #{info},
- addTime = #{addTime},
- auditTime = #{auditTime},
- auditNote = #{auditNote},
- status = #{status},
- <if test="businessLicenseImage != null and businessLicenseImage != 'null' and businessLicenseImage != ''">
- businessLicenseImage = #{businessLicenseImage},
- </if>
- <if test="headpic != null and headpic != 'null' and headpic != ''">
- headpic = #{headpic},
- </if>
- defaultServiceProviderID = #{defaultServiceProviderID},
- defaultServiceProviderUpdTime = #{defaultServiceProviderUpdTime},
- sname = #{sname},
- flag = #{flag},
- scanFlag =#{scanFlag},
- mainServiceProviderID = #{mainServiceProviderID},
- spID = #{spID},
- mainpro = #{mainpro},
- provinceID = #{provinceID},
- cityID = #{cityID},
- inviterName = #{inviterName},
- inviterBindID = #{inviterBindID},
- scanTime = #{scanTime},
- newDeal=1
- WHERE clubid = #{id}
- </update>
- <delete id="delete">
- DELETE FROM club
- WHERE clubid = #{id}
- </delete>
- <select id="findClubById" resultType="CmClub">
- SELECT
- <include refid="cmClubColumns"/>
- , CONCAT(d.name,c.name ,b.name ,a.`address` ) address FROM town b LEFT JOIN city c
- ON b.cityID=c.cityID JOIN province d ON c.`provinceID` =d.`provinceID`
- JOIN club a ON a.townID =b.townID WHERE a.clubID=#{clubId}
- </select>
- <update id="updateServiceProvider">
- UPDATE `cm_club_report`
- SET serviceProviderId=#{newSpId}
- WHERE clubId = #{clubId}
- AND serviceProviderId = #{oldSpId}
- </update>
- </mapper>
|