| | |
| | | <result property="product" column="product" jdbcType="VARCHAR"/> |
| | | <result property="channel" column="channel" jdbcType="VARCHAR"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="show" column="show" jdbcType="INTEGER"/> |
| | | <result property="showNum" column="show_num" jdbcType="INTEGER"/> |
| | | <result property="click" column="click" jdbcType="INTEGER"/> |
| | | <result property="accountConsumption" column="account_consumption" jdbcType="DECIMAL"/> |
| | | <result property="rebateConsumption" column="rebate_consumption" jdbcType="DECIMAL"/> |
| | |
| | | <result property="updateUser" column="update_user" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | id,department,registrant, |
| | | product,channel,name, |
| | | show,click,account_consumption, |
| | | rebate_consumption,consumption,discounted_consumption, |
| | | fans_add,actual_cost,internal_costs, |
| | | customer_costs,profit,agent_rebate, |
| | | customer_rebate,remark,create_time, |
| | | update_time,create_user,update_user |
| | | </sql> |
| | | |
| | | <select id="selectDataReportingDtoPageList" resultType="com.yuanchu.mom.dto.DataReportingPageDto"> |
| | | select * from ( |
| | | select dr.*,u1.name create_user_name,u2.name update_user_name from data_reporting dr |
| | |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="selectProductCountDtoPageList" resultType="com.yuanchu.mom.dto.ProductCountDto"> |
| | | select * from ( |
| | | select update_time, create_time, product, sum(consumption) consumption, sum(fans_add) fans_add, sum(customer_costs) customer_costs, create_user |
| | | from data_reporting |
| | | group by product,date_format(create_time, '%Y-%m-%d') |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="selectRegistrantCountDtoPageList" resultType="com.yuanchu.mom.dto.RegistrantCountDto"> |
| | | select * from ( |
| | | select id, department, registrant, product, name, sum(show_num) show_num, sum(click) click, sum(account_consumption)account_consumption, sum(rebate_consumption) rebate_consumption,(sum(rebate_consumption)+sum(remark)) rebate_consumption2, sum(discounted_consumption) discounted_consumption, sum(fans_add) fans_add, sum(actual_cost) actual_cost, sum(customer_costs) customer_costs, sum(profit) profit, sum(agent_rebate) agent_rebate, sum(customer_rebate) customer_rebate, sum(remark) remark, create_time, update_time, create_user |
| | | from data_reporting |
| | | group by registrant,date_format(create_time, '%Y-%m-%d') |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="getDataFor1" resultType="java.util.Map"> |
| | | select COALESCE(sum(account_consumption), 0) data1, COALESCE(sum(consumption), 0) data2, COALESCE(sum(customer_costs),0) data3, COALESCE(sum(actual_cost), 0) data4 |
| | | from data_reporting |
| | | where date(create_time) like CURDATE() |
| | | </select> |
| | | <select id="getDataFor2" resultType="java.util.Map"> |
| | | SELECT sum(account_consumption) account_consumptions, DATE_FORMAT(create_time, '%m-%d') `date`, DATE_FORMAT(create_time, '%y-%m-%d') time |
| | | FROM data_reporting |
| | | group by DATE_FORMAT(create_time, '%y-%m-%d') |
| | | having DATE_SUB(CURDATE(), INTERVAL 7 DAY) < time |
| | | and time <= CURDATE() |
| | | </select> |
| | | <select id="getDataFor3" resultType="java.util.Map"> |
| | | SELECT sum(consumption) consumption, DATE_FORMAT(create_time, '%m-%d') `date`, DATE_FORMAT(create_time, '%y-%m-%d') time |
| | | FROM data_reporting |
| | | group by DATE_FORMAT(create_time, '%y-%m-%d') |
| | | having DATE_SUB(CURDATE(), INTERVAL 7 DAY) < time |
| | | and time <= CURDATE() |
| | | </select> |
| | | <select id="getDataFor4" resultType="java.util.Map"> |
| | | select product, sum(customer_costs) customerCosts |
| | | from data_reporting |
| | | group by product |
| | | order by customerCosts desc limit 7 |
| | | </select> |
| | | <select id="getDataFor5" resultType="java.util.Map"> |
| | | select product, sum(actual_cost) actualCost |
| | | from data_reporting |
| | | group by product |
| | | order by actualCost desc limit 7 |
| | | </select> |
| | | <select id="selectUser" resultType="java.util.Map"> |
| | | select user.department, user.name, user.account from user |
| | | where id = #{userId} |
| | | </select> |
| | | </mapper> |