| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696 |
- <?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.goafanti.common.dao.UserMidMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserMid">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="uid" jdbcType="VARCHAR" property="uid" />
- <result column="aid" jdbcType="VARCHAR" property="aid" />
- <result column="last_follow_time" jdbcType="TIMESTAMP" property="lastFollowTime" />
- <result column="last_sign_time" jdbcType="TIMESTAMP" property="lastSignTime" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="big_customer" jdbcType="INTEGER" property="bigCustomer" />
- <result column="update_aid" jdbcType="VARCHAR" property="updateAid" />
- <result column="update_name" jdbcType="VARCHAR" property="updateName" />
- <result column="date_update_time" jdbcType="TIMESTAMP" property="dateUpdateTime" />
- <result column="channel_type" jdbcType="INTEGER" property="channelType" />
- <result column="chargeback" jdbcType="INTEGER" property="chargeback" />
- <result column="member" jdbcType="INTEGER" property="member" />
- <result column="last_sales_type" jdbcType="INTEGER" property="lastSalesType" />
- <result column="last_follow_type" jdbcType="INTEGER" property="lastFollowType" />
- <result column="follow_number" jdbcType="INTEGER" property="followNumber" />
- <result column="task_names" jdbcType="VARCHAR" property="taskNames" />
- <result column="sign_number" jdbcType="INTEGER" property="signNumber" />
- <result column="sign_amount" jdbcType="DECIMAL" property="signAmount" />
- <result column="last_signing_time" jdbcType="DATE" property="lastSigningTime" />
- <result column="first_signing_time" jdbcType="DATE" property="firstSigningTime" />
- <result column="follow_dep" jdbcType="VARCHAR" property="followDep" />
- <result column="follow_explain" jdbcType="VARCHAR" property="followExplain" />
- <result column="follow_aname" jdbcType="VARCHAR" property="followAname" />
- <result column="follow_aid" jdbcType="VARCHAR" property="followAid" />
- </resultMap>
- <sql id="Base_Column_List">
- id, `uid`, aid, last_follow_time, last_sign_time, create_time, big_customer, update_aid,
- update_name, date_update_time, channel_type, chargeback, `member`, last_sales_type,
- last_follow_type, follow_number, task_names, sign_number, sign_amount, last_signing_time,
- first_signing_time, follow_dep, follow_explain, follow_aname, follow_aid
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from user_mid
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- delete from user_mid
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.UserMid">
- insert into user_mid (id, `uid`, aid,
- last_follow_time, last_sign_time, create_time,
- big_customer, update_aid, update_name,
- date_update_time, channel_type, chargeback,
- `member`, last_sales_type, last_follow_type,
- follow_number, task_names, sign_number,
- sign_amount, last_signing_time, first_signing_time,
- follow_dep, follow_explain, follow_aname,
- follow_aid)
- values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
- #{lastFollowTime,jdbcType=TIMESTAMP}, #{lastSignTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
- #{bigCustomer,jdbcType=INTEGER}, #{updateAid,jdbcType=VARCHAR}, #{updateName,jdbcType=VARCHAR},
- #{dateUpdateTime,jdbcType=TIMESTAMP}, #{channelType,jdbcType=INTEGER}, #{chargeback,jdbcType=INTEGER},
- #{member,jdbcType=INTEGER}, #{lastSalesType,jdbcType=INTEGER}, #{lastFollowType,jdbcType=INTEGER},
- #{followNumber,jdbcType=INTEGER}, #{taskNames,jdbcType=VARCHAR}, #{signNumber,jdbcType=INTEGER},
- #{signAmount,jdbcType=DECIMAL}, #{lastSigningTime,jdbcType=DATE}, #{firstSigningTime,jdbcType=DATE},
- #{followDep,jdbcType=VARCHAR}, #{followExplain,jdbcType=VARCHAR}, #{followAname,jdbcType=VARCHAR},
- #{followAid,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.UserMid">
- insert into user_mid
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="uid != null">
- `uid`,
- </if>
- <if test="aid != null">
- aid,
- </if>
- <if test="lastFollowTime != null">
- last_follow_time,
- </if>
- <if test="lastSignTime != null">
- last_sign_time,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="bigCustomer != null">
- big_customer,
- </if>
- <if test="updateAid != null">
- update_aid,
- </if>
- <if test="updateName != null">
- update_name,
- </if>
- <if test="dateUpdateTime != null">
- date_update_time,
- </if>
- <if test="channelType != null">
- channel_type,
- </if>
- <if test="chargeback != null">
- chargeback,
- </if>
- <if test="member != null">
- `member`,
- </if>
- <if test="lastSalesType != null">
- last_sales_type,
- </if>
- <if test="lastFollowType != null">
- last_follow_type,
- </if>
- <if test="followNumber != null">
- follow_number,
- </if>
- <if test="taskNames != null">
- task_names,
- </if>
- <if test="signNumber != null">
- sign_number,
- </if>
- <if test="signAmount != null">
- sign_amount,
- </if>
- <if test="lastSigningTime != null">
- last_signing_time,
- </if>
- <if test="firstSigningTime != null">
- first_signing_time,
- </if>
- <if test="followDep != null">
- follow_dep,
- </if>
- <if test="followExplain != null">
- follow_explain,
- </if>
- <if test="followAname != null">
- follow_aname,
- </if>
- <if test="followAid != null">
- follow_aid,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=INTEGER},
- </if>
- <if test="uid != null">
- #{uid,jdbcType=VARCHAR},
- </if>
- <if test="aid != null">
- #{aid,jdbcType=VARCHAR},
- </if>
- <if test="lastFollowTime != null">
- #{lastFollowTime,jdbcType=TIMESTAMP},
- </if>
- <if test="lastSignTime != null">
- #{lastSignTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="bigCustomer != null">
- #{bigCustomer,jdbcType=INTEGER},
- </if>
- <if test="updateAid != null">
- #{updateAid,jdbcType=VARCHAR},
- </if>
- <if test="updateName != null">
- #{updateName,jdbcType=VARCHAR},
- </if>
- <if test="dateUpdateTime != null">
- #{dateUpdateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="channelType != null">
- #{channelType,jdbcType=INTEGER},
- </if>
- <if test="chargeback != null">
- #{chargeback,jdbcType=INTEGER},
- </if>
- <if test="member != null">
- #{member,jdbcType=INTEGER},
- </if>
- <if test="lastSalesType != null">
- #{lastSalesType,jdbcType=INTEGER},
- </if>
- <if test="lastFollowType != null">
- #{lastFollowType,jdbcType=INTEGER},
- </if>
- <if test="followNumber != null">
- #{followNumber,jdbcType=INTEGER},
- </if>
- <if test="taskNames != null">
- #{taskNames,jdbcType=VARCHAR},
- </if>
- <if test="signNumber != null">
- #{signNumber,jdbcType=INTEGER},
- </if>
- <if test="signAmount != null">
- #{signAmount,jdbcType=DECIMAL},
- </if>
- <if test="lastSigningTime != null">
- #{lastSigningTime,jdbcType=DATE},
- </if>
- <if test="firstSigningTime != null">
- #{firstSigningTime,jdbcType=DATE},
- </if>
- <if test="followDep != null">
- #{followDep,jdbcType=VARCHAR},
- </if>
- <if test="followExplain != null">
- #{followExplain,jdbcType=VARCHAR},
- </if>
- <if test="followAname != null">
- #{followAname,jdbcType=VARCHAR},
- </if>
- <if test="followAid != null">
- #{followAid,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserMid">
- update user_mid
- <set>
- <if test="uid != null">
- `uid` = #{uid,jdbcType=VARCHAR},
- </if>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="lastFollowTime != null">
- last_follow_time = #{lastFollowTime,jdbcType=TIMESTAMP},
- </if>
- <if test="lastSignTime != null">
- last_sign_time = #{lastSignTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="bigCustomer != null">
- big_customer = #{bigCustomer,jdbcType=INTEGER},
- </if>
- <if test="updateAid != null">
- update_aid = #{updateAid,jdbcType=VARCHAR},
- </if>
- <if test="updateName != null">
- update_name = #{updateName,jdbcType=VARCHAR},
- </if>
- <if test="dateUpdateTime != null">
- date_update_time = #{dateUpdateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="channelType != null">
- channel_type = #{channelType,jdbcType=INTEGER},
- </if>
- <if test="chargeback != null">
- chargeback = #{chargeback,jdbcType=INTEGER},
- </if>
- <if test="member != null">
- `member` = #{member,jdbcType=INTEGER},
- </if>
- <if test="lastSalesType != null">
- last_sales_type = #{lastSalesType,jdbcType=INTEGER},
- </if>
- <if test="lastFollowType != null">
- last_follow_type = #{lastFollowType,jdbcType=INTEGER},
- </if>
- <if test="followNumber != null">
- follow_number = #{followNumber,jdbcType=INTEGER},
- </if>
- <if test="taskNames != null">
- task_names = #{taskNames,jdbcType=VARCHAR},
- </if>
- <if test="signNumber != null">
- sign_number = #{signNumber,jdbcType=INTEGER},
- </if>
- <if test="signAmount != null">
- sign_amount = #{signAmount,jdbcType=DECIMAL},
- </if>
- <if test="lastSigningTime != null">
- last_signing_time = #{lastSigningTime,jdbcType=DATE},
- </if>
- <if test="firstSigningTime != null">
- first_signing_time = #{firstSigningTime,jdbcType=DATE},
- </if>
- <if test="followDep != null">
- follow_dep = #{followDep,jdbcType=VARCHAR},
- </if>
- <if test="followExplain != null">
- follow_explain = #{followExplain,jdbcType=VARCHAR},
- </if>
- <if test="followAname != null">
- follow_aname = #{followAname,jdbcType=VARCHAR},
- </if>
- <if test="followAid != null">
- follow_aid = #{followAid,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserMid">
- update user_mid
- set `uid` = #{uid,jdbcType=VARCHAR},
- aid = #{aid,jdbcType=VARCHAR},
- last_follow_time = #{lastFollowTime,jdbcType=TIMESTAMP},
- last_sign_time = #{lastSignTime,jdbcType=TIMESTAMP},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- big_customer = #{bigCustomer,jdbcType=INTEGER},
- update_aid = #{updateAid,jdbcType=VARCHAR},
- update_name = #{updateName,jdbcType=VARCHAR},
- date_update_time = #{dateUpdateTime,jdbcType=TIMESTAMP},
- channel_type = #{channelType,jdbcType=INTEGER},
- chargeback = #{chargeback,jdbcType=INTEGER},
- `member` = #{member,jdbcType=INTEGER},
- last_sales_type = #{lastSalesType,jdbcType=INTEGER},
- last_follow_type = #{lastFollowType,jdbcType=INTEGER},
- follow_number = #{followNumber,jdbcType=INTEGER},
- task_names = #{taskNames,jdbcType=VARCHAR},
- sign_number = #{signNumber,jdbcType=INTEGER},
- sign_amount = #{signAmount,jdbcType=DECIMAL},
- last_signing_time = #{lastSigningTime,jdbcType=DATE},
- first_signing_time = #{firstSigningTime,jdbcType=DATE},
- follow_dep = #{followDep,jdbcType=VARCHAR},
- follow_explain = #{followExplain,jdbcType=VARCHAR},
- follow_aname = #{followAname,jdbcType=VARCHAR},
- follow_aid = #{followAid,jdbcType=VARCHAR}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByUid" parameterType="com.goafanti.common.model.UserMid">
- update user_mid
- <set>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="lastFollowTime != null">
- last_follow_time = #{lastFollowTime,jdbcType=TIMESTAMP},
- </if>
- <if test="lastSignTime != null">
- last_sign_time = #{lastSignTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="bigCustomer != null">
- big_customer = #{bigCustomer,jdbcType=INTEGER},
- </if>
- <if test="updateAid != null">
- update_aid = #{updateAid,jdbcType=VARCHAR},
- </if>
- <if test="updateName != null">
- update_name = #{updateName,jdbcType=VARCHAR},
- </if>
- <if test="dateUpdateTime != null">
- date_update_time = #{dateUpdateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="channelType != null">
- channel_type = #{channelType,jdbcType=INTEGER},
- </if>
- <if test="chargeback != null">
- chargeback = #{chargeback,jdbcType=INTEGER},
- </if>
- <if test="member != null">
- `member` = #{member,jdbcType=INTEGER},
- </if>
- <if test="lastSalesType != null">
- last_sales_type = #{lastSalesType,jdbcType=INTEGER},
- </if>
- <if test="lastFollowType != null">
- last_follow_type = #{lastFollowType,jdbcType=INTEGER},
- </if>
- <if test="followNumber != null">
- follow_number = #{followNumber,jdbcType=INTEGER},
- </if>
- <if test="taskNames != null">
- task_names = #{taskNames,jdbcType=VARCHAR},
- </if>
- <if test="signNumber != null">
- sign_number = #{signNumber,jdbcType=INTEGER},
- </if>
- <if test="signAmount != null">
- sign_amount = #{signAmount,jdbcType=DECIMAL},
- </if>
- <if test="lastSigningTime != null">
- last_signing_time = #{lastSigningTime,jdbcType=DATE},
- </if>
- <if test="firstSigningTime != null">
- first_signing_time = #{firstSigningTime,jdbcType=DATE},
- </if>
- <if test="followDep != null">
- follow_dep = #{followDep,jdbcType=VARCHAR},
- </if>
- <if test="followExplain != null">
- follow_explain = #{followExplain,jdbcType=VARCHAR},
- </if>
- <if test="followAname != null">
- follow_aname = #{followAname,jdbcType=VARCHAR},
- </if>
- <if test="followAid != null">
- follow_aid = #{followAid,jdbcType=VARCHAR},
- </if>
- </set>
- where `uid` = #{uid,jdbcType=VARCHAR}
- </update>
- <update id="updateListByUid" parameterType="com.goafanti.common.model.UserMid">
- update user_mid
- <set>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="updateFollow ==1">
- last_follow_time = null,
- </if>
- <if test="lastSignTime != null">
- last_sign_time = #{lastSignTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="bigCustomer != null">
- big_customer = #{bigCustomer,jdbcType=INTEGER},
- </if>
- <if test="updateAid != null">
- update_aid = #{updateAid,jdbcType=VARCHAR},
- </if>
- <if test="updateName != null">
- update_name = #{updateName,jdbcType=VARCHAR},
- </if>
- <if test="dateUpdateTime != null">
- date_update_time = #{dateUpdateTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where `uid` in
- <foreach item="item" collection="list" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </update>
- <select id="getUserTaskNames" resultType="java.lang.String">
- select group_concat(distinct b.commodity_name)task_names from t_order_new a
- left join t_order_task b on a.order_no =b.order_no
- where a.buyer_id = #{uid}
- group by a.buyer_id
- </select>
- <select id="getUserDtails" resultType="com.goafanti.common.model.UserMid">
- select a.buyer_id uid,min(a.sign_time)firstSigningTime,max(a.sign_time)lastSigningTime,
- sum(a.total_amount)signAmount,count(*)signNumber
- from t_order_new a
- where a.delete_sign in (0,2) and a.process_status >4
- and a.buyer_id= #{uid}
- group by a.buyer_id
- </select>
- <select id="selectSignSummaryList" resultType="com.goafanti.order.bo.OutSignSummary">
- select a.id ,a.nickname ,b.sign_number signNumber,b.sign_amount signAmount,
- date_format(b.first_signing_time ,'%Y-%m-%d') firstSigningTime,
- date_format(b.last_signing_time ,'%Y-%m-%d') lastSigningTime ,
- b.last_sales_type lastSalesType,c.name,d.name depName,
- b.last_follow_type lastFollowType,b.follow_explain followExplain ,b.follow_number followNumber ,
- date_format(b.last_follow_time ,'%Y-%m-%d %H:%i:%S') lastFollowTime ,b.task_names taskNames ,
- b.`member` ,b.chargeback ,b.big_customer bigCustomer,b.follow_aname followAname
- from user a left join user_mid b on a.id=b.uid left join admin c on a.aid=c.id
- left join department d on c.department_id =d.id
- where 1=1
- <if test="userName != null">
- and a.nickname like concat('%',#{userName},'%')
- </if>
- <if test="aid != null">
- and c.id =#{aid}
- </if>
- <if test="followAid != null">
- and b.follow_aid =#{followAid}
- </if>
- <if test="member != null">
- and b.`member` = #{member}
- </if>
- <if test="chargeback != null">
- and b.chargeback = #{chargeback}
- </if>
- <if test="bigCustomer != null">
- and b.big_customer = #{bigCustomer}
- </if>
- <if test="lastFollowType != null">
- and b.last_follow_type = #{lastFollowType}
- </if>
- <if test="followDep != null">
- and b.follow_dep = #{followDep}
- </if>
- <if test="lastFollowTimeStart != null and lastFollowTimeEnd !=null">
- and b.last_follow_time BETWEEN #{lastFollowTimeStart} and #{lastFollowTimeEnd}
- </if>
- <if test="firstSigningTimeStart != null and firstSigningTimeEnd !=null">
- and b.first_signing_time BETWEEN #{firstSigningTimeStart} and #{firstSigningTimeEnd}
- </if>
- <if test="lastSigningTimeStart != null and lastSigningTimeStart !=null">
- and b.last_signing_time BETWEEN #{lastSigningTimeStart} and #{lastSigningTimeEnd}
- </if>
- <if test="signNumber != null">
- and b.sign_number = #{signNumber}
- </if>
- <if test="lastSalesType != null">
- and b.last_sales_type = #{lastSalesType}
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectSignSummaryCount" resultType="integer">
- select count(*)
- from user a left join user_mid b on a.id=b.uid left join admin c on a.aid=c.id
- where 1=1
- <if test="userName != null">
- and a.nickname like concat('%',#{userName},'%')
- </if>
- <if test="aid != null">
- and c.id =#{aid}
- </if>
- <if test="followAid != null">
- and b.follow_aid =#{followAid}
- </if>
- <if test="member != null">
- and b.`member` = #{member}
- </if>
- <if test="chargeback != null">
- and b.chargeback = #{chargeback}
- </if>
- <if test="bigCustomer != null">
- and b.big_customer = #{bigCustomer}
- </if>
- <if test="lastFollowType != null">
- and b.last_follow_type = #{lastFollowType}
- </if>
- <if test="followDep != null">
- and b.follow_dep = #{followDep}
- </if>
- <if test="lastFollowTimeStart != null and lastFollowTimeEnd !=null">
- and b.last_follow_time BETWEEN #{lastFollowTimeStart} and #{lastFollowTimeEnd}
- </if>
- <if test="firstSigningTimeStart != null and firstSigningTimeEnd !=null">
- and b.first_signing_time BETWEEN #{firstSigningTimeStart} and #{firstSigningTimeEnd}
- </if>
- <if test="lastSigningTimeStart != null and lastSigningTimeStart !=null">
- and b.last_signing_time BETWEEN #{lastSigningTimeStart} and #{lastSigningTimeEnd}
- </if>
- <if test="signNumber != null">
- and b.sign_number = #{signNumber}
- </if>
- <if test="lastSalesType != null">
- and b.last_sales_type = #{lastSalesType}
- </if>
- </select>
- <select id="selectsignStatisticsList" resultType="com.goafanti.order.bo.OutSignStatistics">
- select a.id, a.name,y.aid, userCount, orderCount, totalAmount, newSignNumber, repeatSignNumber, channelSignNumber,
- (newSignNumber/orderCount)newRatio,(repeatSignNumber/orderCount)repeatRatio,(newSignNumber/orderCount)channelRatio
- from admin a
- left join user_role ur on ur.uid =a.id left join `role` r on r.id=ur.rid
- left join ( select x.aid,count(id) userCount, sum(x.orderCount)orderCount,sum(x.totalAmount)totalAmount,
- sum(x.newSignNumber)newSignNumber,sum(x.repeatSignNumber)repeatSignNumber,
- sum(x.channelSignNumber)channelSignNumber
- from ( select b.aid,b.id,count(*)orderCount ,sum(a.total_amount) totalAmount ,
- sum(if(a.sales_type < 3 || (a.sales_type > 3 && a.sales_type < 6),1,0 ))newSignNumber,
- sum(if(a.sales_type=3,1,0 ))channelSignNumber,sum(if(a.sales_type > 5,1,0 ))repeatSignNumber
- from t_order_new a left join user b on b.id=a.buyer_id
- where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
- <if test="signTimeStart != null and signTimeEnd!=null">
- and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
- </if>
- group by b.aid,b.id)x group by x.aid)y on y.aid=a.id
- where r.role_type in (96,996)
- <if test="aid != null">
- and a.id= #{aid}
- </if>
- <if test="depId != null">
- and a.department_id = #{depId}
- </if>
- <if test="amountType != null">
- <if test="amountType == 1">
- and totalAmount < 10
- </if>
- <if test="amountType == 2">
- and totalAmount BETWEEN 10 and 20
- </if>
- <if test="amountType == 3">
- and totalAmount BETWEEN 20 and 30
- </if>
- <if test="amountType == 4">
- and totalAmount > 30
- </if>
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectsignStatisticsCount" resultType="integer">
- select count(*)from (select a.id,a.name
- from admin a left join user_role ur on ur.uid =a.id left join `role` r on r.id=ur.rid
- where r.role_type in (96,996)
- <if test="aid != null">
- and a.id= #{aid}
- </if>
- <if test="depId != null">
- and a.department_id = #{depId}
- </if>
- group by a.id,a.name)x
- </select>
- <select id="selectsignStatisticsOrderList" resultType="com.goafanti.order.bo.TOrderNewBo">
- select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
- a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
- a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
- dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
- a.sales_type salesType, a.channel_id channelId ,a.other
- from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
- left join department dep on a.order_dep=dep.id
- where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
- <if test="amountType != null">
- <if test="amountType == 1">
- and a.total_amount < 10
- </if>
- <if test="amountType == 2">
- and a.total_amount BETWEEN 10 and 20
- </if>
- <if test="amountType == 3">
- and a.total_amount BETWEEN 20 and 30
- </if>
- <if test="amountType == 4">
- and a.total_amount > 30
- </if>
- </if>
- <if test="signTimeStart != null and signTimeEnd!=null">
- and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
- </if>
- <if test="aid !=null">
- and b.aid= #{aid}
- </if>
- <if test="orderType !=null">
- <if test="orderType ==1">
- and(a.sales_type < 3 or (a.sales_type > 3 and a.sales_type < 6))
- </if>
- <if test="orderType ==2">
- and a.sales_type > 5
- </if>
- <if test="orderType ==3">
- and a.sales_type=3
- </if>
- </if>
- order by a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectsignStatisticsOrderCount" resultType="integer">
- select count(*)
- from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
- left join department dep on a.order_dep=dep.id
- where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
- <if test="amountType != null">
- <if test="amountType == 1">
- and a.total_amount < 10
- </if>
- <if test="amountType == 2">
- and a.total_amount BETWEEN 10 and 20
- </if>
- <if test="amountType == 3">
- and a.total_amount BETWEEN 20 and 30
- </if>
- <if test="amountType == 4">
- and a.total_amount > 30
- </if>
- </if>
- <if test="signTimeStart != null and signTimeEnd!=null">
- and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
- </if>
- <if test="aid !=null">
- and b.aid= #{aid}
- </if>
- <if test="orderType !=null">
- <if test="orderType ==1">
- and(a.sales_type < 3 or (a.sales_type > 3 and a.sales_type < 6))
- </if>
- <if test="orderType ==2">
- and a.sales_type > 5
- </if>
- <if test="orderType ==3">
- and a.sales_type=3
- </if>
- </if>
- </select>
- </mapper>
|