123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?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">
- <!-- 命名,每一个映射对象不一样
- namespace:必须与对应的接口全类名一致
- -->
- <mapper namespace="com.iamberry.wechat.service.mapper.PlaceLogsMapper">
-
- <sql id="logsAllField">
- t.LOGS_ID id ,
- t.LOGS_PLACE_ID placeId,
- t.LOGS_NUM nums,
- t.LOGS_TYPE type,
- t.LOGS_INTRODUCTION introduction,
- t.LOGS_RES_TYPE resType,
- t.LOGS_CREATE_DATE createDate
- </sql>
-
- <select id="getOnePlaceLogs" parameterType="string" resultType="PlaceLogs">
- SELECT
- <include refid="logsAllField"/>
- FROM tb_iamberry_place_logs t WHERE t.LOGS_ID = #{appid}
- </select>
-
- <select id="selectAll" resultType="PlaceLogs" parameterType="PlaceLogs">
- SELECT
- <include refid="logsAllField"/>,
- P.PLACE_NAME DRPNAME,
- P.PLACE_ROLE_ID drpType
- FROM TB_IAMBERRY_PLACE_LOGS T
- LEFT JOIN TB_IAMBERRY_PLACE_INFO P
- ON P.PLACE_ID=T.LOGS_PLACE_ID
- <where>
- <if test="placeId!=null and placeId!=''" >
- t.LOGS_PLACE_ID=#{placeId}
- </if>
- <if test="drpName!=null and drpName!=''" >
- and p.place_name like CONCAT('%',#{drpName},'%')
- </if>
- <if test="type!=null and type!=''" >
- and t.LOGS_TYPE =#{type}
- </if>
- <if test="introduction!=null and introduction!=''" >
- and t.LOGS_INTRODUCTION =#{introduction}
- </if>
- <if test="resType!=null and resType!=''" >
- and t.LOGS_RES_TYPE =#{resType}
- </if>
- <if test="beginDate!=null and beginDate!=''">
- and p.PLACE_CREATE_DATE > #{beginDate}
- </if>
- <if test="endDate!=null and endDate!=''">
- and p.PLACE_CREATE_DATE < #{endDate}
- </if>
- </where>
- ORDER BY t.LOGS_ID DESC
- <if test="page!=null and page.recordBegin>0 and page.pageSize>0 ">
- limit ${page.recordBegin},${page.pageSize}
- </if>
- <if test="page!=null and page.recordBegin==0 and page.pageSize>0 ">
- limit ${page.pageSize}
- </if>
- </select>
-
- <select id="getAllCount" resultType="integer">
- select count(t.LOGS_ID) from tb_iamberry_place_logs t
- left join tb_iamberry_place_info p
- on p.place_id=t.LOGS_PLACE_ID
- <where>
- <if test="placeId!=null and placeId!=''" >
- t.LOGS_PLACE_ID=#{placeId}
- </if>
- <if test="drpName!=null and drpName!=''" >
- and p.place_name like CONCAT('%',#{drpName},'%')
- </if>
- <if test="type!=null and type!=''" >
- and t.LOGS_TYPE =#{type}
- </if>
- <if test="introduction!=null and introduction!=''" >
- and t.LOGS_INTRODUCTION =#{introduction}
- </if>
- <if test="resType!=null and resType!=''" >
- and t.LOGS_RES_TYPE =#{resType}
- </if>
- <if test="beginDate!=null and beginDate!=''">
- and p.PLACE_CREATE_DATE > #{beginDate}
- </if>
- <if test="endDate!=null and endDate!=''">
- and p.PLACE_CREATE_DATE < #{endDate}
- </if>
- </where>
- </select>
-
-
- <insert id="insert">
- insert into
- tb_iamberry_place_logs(
- LOGS_PLACE_ID ,
- LOGS_NUM ,
- LOGS_TYPE ,
- LOGS_INTRODUCTION ,
- LOGS_RES_TYPE ,
- LOGS_CREATE_DATE )
- values(
- #{placeId},
- #{nums},
- #{type},
- #{introduction},
- #{resType},
- #{createDate})
- </insert>
-
- <!-- 根据返利人id和单号模糊查询返利日志信息 -->
- <select id="selectPlaceLogInfo" parameterType="PlaceLogs" resultType="PlaceLogs">
- SELECT
- <include refid="logsAllField"/>
- FROM
- TB_IAMBERRY_PLACE_LOGS t
- WHERE
- t.LOGS_PLACE_ID = #{placeId}
- AND
- t.LOGS_INTRODUCTION LIKE CONCAT('%',#{introduction},'%')
- </select>
-
- <!-- 修改了商户层返利日志表 -->
- <update id="updatePlaceLogs" parameterType="PlaceLogs">
- update tb_iamberry_place_logs
- <set>
- <if test="placeId!=null and placeId!=''">
- LOGS_PLACE_ID =#{placeId},
- </if>
- <if test="nums!=null and nums!=''">
- LOGS_NUM =(LOGS_NUM + #{nums}),
- </if>
- <if test="type!=null and type!=''">
- LOGS_TYPE =#{type},
- </if>
- <if test="introduction!=null and introduction!=''">
- LOGS_INTRODUCTION =#{introduction},
- </if>
- <if test="resType!=null and resType!=''">
- LOGS_RES_TYPE =#{resType},
- </if>
- </set>
- where LOGS_ID = #{id}
- </update>
-
- <update id="update" >
- update tb_iamberry_place_logs
- <set>
- <if test="placeId!=null and placeId!=''">
- LOGS_PLACE_ID =#{placeId},
- </if>
- <if test="nums!=null and nums!=''">
- LOGS_NUM =#{nums},
- </if>
- <if test="type!=null and type!=''">
- LOGS_TYPE =#{type},
- </if>
- <if test="introduction!=null and introduction!=''">
- LOGS_INTRODUCTION =#{introduction},
- </if>
- <if test="resType!=null and resType!=''">
- LOGS_RES_TYPE =#{resType},
- </if>
- </set>
- where LOGS_ID = #{id}
- </update>
-
-
- <delete id="delete" parameterType="integer">
- delete from tb_iamberry_place_logs
- where WHERE LOGS_ID = #{appid}
- </delete>
-
- <!-- 获取分销商下的所有用户 -->
- <select id="getUnInComeOrderUserTop" parameterType="integer" resultType="java.lang.String" >
- select user_openid userOpenid
- from TB_IAMBERRY_USER_USERINFO
- where USER_DEALER=#{id}
- ORDER BY USER_ID DESC
- </select>
- </mapper>
|