| | |
| | | <result property="goodsName" column="goodsName" /> |
| | | |
| | | <result property="cateName" column="cateName" /> |
| | | <result property="achieveRuleName" column="achieveRuleName" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | e.name as pro_name, |
| | | b.ZK_TOTAL as zk_total, |
| | | a.his_consume, |
| | | er.name as achieveRuleName, |
| | | a.free_consume, |
| | | f.su_name meiliao, |
| | | g.su_name guwen, |
| | |
| | | left join sys_vip_info c on a.vip_id=c.id |
| | | left join sys_vip_level d on c.LEVEL_ID=d.id |
| | | left join shopping_goods e on a.shopping_goods_id=e.id |
| | | left join achieve_rule er on e.achieve_rule_id=er.id |
| | | LEFT JOIN sys_users f on a.beault_id=f.su_id |
| | | LEFT JOIN sys_users g on a.sale_id = g.su_id |
| | | LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID |
| | |
| | | left join sys_proj_services l on a.service_order_id=l.id |
| | | left join sys_order_item j on a.order_item_id=j.ID |
| | | <where> |
| | | and a.company_id = #{record.companyId} |
| | | <if test="record!=null"> |
| | | <if |
| | | test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) "> |
| | | and a.shop_id = #{record.shopId} |
| | | </if> |
| | | <if test="record.achieveRuleId != null "> |
| | | and e.achieve_rule_id = #{record.achieveRuleId} |
| | | </if> |
| | | <if test="record.year != null and record.year !='' "> |
| | | and YEAR (a.datatime) = #{record.year} |
| | |
| | | <if test="record.beaultId != null and record.beaultId !='' "> |
| | | and a.beault_id = #{record.beaultId} |
| | | </if> |
| | | <if test="record.companyId != null and record.companyId !='' "> |
| | | and a.company_id = #{record.companyId} |
| | | </if> |
| | | |
| | | <if test="record.beaultId != null and record.beaultId !='' "> |
| | | and a.beault_id = #{record.beaultId} |
| | | </if> |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- |
| | | |
| | | 统计员工业绩 |
| | | |
| | | select |
| | | u.name, |
| | | g.su_name guwen, |
| | | cast(SUM(b.ZK_TOTAL) AS decimal(15,2)) as zk_total, |
| | | cast(SUM(a.his_consume) AS decimal(15,2)), |
| | | cast(SUM(a.free_consume) AS decimal(15,2)), |
| | | cast(SUM(a.proj_percentage) AS decimal(15,2)), |
| | | cast(SUM(a.number_of_people) AS decimal(15,2)), |
| | | cast(SUM(a.proj_num) AS decimal(15,2)), |
| | | cast(SUM(a.proj_time) AS decimal(15,2)), |
| | | h.shop_short_name shop_name, |
| | | a.order_type, |
| | | a.achieveType |
| | | from |
| | | achieve_new a |
| | | left join sys_order b on a.order_id=b.id |
| | | left join sys_vip_info c on a.vip_id=c.id |
| | | left join sys_vip_level d on c.LEVEL_ID=d.id |
| | | left join shopping_goods e on a.shopping_goods_id=e.id |
| | | LEFT JOIN sys_users f on a.beault_id=f.su_id |
| | | LEFT JOIN sys_users g on a.sale_id = g.su_id |
| | | LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID |
| | | LEFT JOIN shopping_goods_category i ON e.cate_id = i.id |
| | | left join sys_proj_services l on a.service_order_id=l.id |
| | | left join sys_order_item j on a.order_item_id=j.ID |
| | | left join achieve_rule u on u.id=e.achieve_rule_id |
| | | where h.shop_short_name='龙华店' |
| | | GROUP BY g.su_name , a.order_type, h.id,a.achieveType |
| | | ORDER BY g.su_name |
| | | |
| | | --> |
| | | |
| | | |
| | | <select id="findSumDailyInfoNew" resultMap="AchieveNewMap"> |
| | |
| | | b.code goodsNo, |
| | | b.name goodsName, |
| | | c.su_name meiliao, |
| | | d.count*d.zk_price zk_total |
| | | TRUNCATE(d.count*d.zk_price,2) zk_total |
| | | from achieve_new a |
| | | left join shopping_goods b on a.shopping_goods_id=b.id |
| | | left join sys_users c on a.beault_id=c.su_id |
| | |
| | | and date_format(datatime, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d') |
| | | </select> |
| | | |
| | | <select id="achieveNewStatistics" resultType="com.matrix.system.hive.vo.AchieveNewStatisticsVo"> |
| | | |
| | | select |
| | | u.name ruleName, |
| | | f.su_name guwen, |
| | | f.su_id gwid, |
| | | g.su_name createBy, |
| | | g.su_id createId, |
| | | cast(SUM(b.ZK_TOTAL) AS decimal(15,2)) as zk_total, |
| | | cast(SUM(a.his_consume) AS decimal(15,2)) his_consume, |
| | | cast(SUM(a.free_consume) AS decimal(15,2)) free_consume, |
| | | cast(SUM(a.proj_percentage) AS decimal(15,2)) proj_percentage, |
| | | cast(SUM(a.number_of_people) AS decimal(15,2)) number_of_people, |
| | | cast(SUM(a.proj_num) AS decimal(15,2)) proj_num, |
| | | cast(SUM(case when a.pay_method = '划扣' then goods_cash end )AS decimal(15,2)) card_cash, |
| | | cast(SUM(a.proj_time) AS decimal(15,2)) proj_time, |
| | | cast(SUM(case when a.pay_method = '现金' then goods_cash end )AS decimal(15,2)) goods_cash, |
| | | h.shop_short_name shop_name, |
| | | a.order_type |
| | | from |
| | | achieve_new a |
| | | left join sys_order b on a.order_id=b.id |
| | | left join sys_vip_info c on a.vip_id=c.id |
| | | left join sys_vip_level d on c.LEVEL_ID=d.id |
| | | left join shopping_goods e on a.shopping_goods_id=e.id |
| | | LEFT JOIN sys_users f on a.beault_id=f.su_id |
| | | LEFT JOIN sys_users g on a.sale_id = g.su_id |
| | | LEFT JOIN sys_shop_info h ON a.SHOP_ID = h.ID |
| | | LEFT JOIN shopping_goods_category i ON e.cate_id = i.id |
| | | left join sys_proj_services l on a.service_order_id=l.id |
| | | left join sys_order_item j on a.order_item_id=j.ID |
| | | left join achieve_rule u on u.id=e.achieve_rule_id |
| | | <where> |
| | | and a.company_id = #{record.companyId} |
| | | <if test="record.shopId != null"> |
| | | and a.shop_id = #{record.shopId} |
| | | </if> |
| | | <if test="record.achieveRuleId != null"> |
| | | and u.id = #{record.achieveRuleId} |
| | | </if> |
| | | |
| | | <if test="record.staffName != null and record.staffName!=''"> |
| | | <!-- 创建人和归属人都有业绩 --> |
| | | and (f.su_name like concat('%',#{record.staffName},'%') or g.su_name like concat('%',#{record.staffName},'%') ) |
| | | </if> |
| | | |
| | | <if test="record.orderType != null and record.orderType != '' "> |
| | | and a.order_type= #{record.orderType} |
| | | </if> |
| | | <if test="record.beginTime != null "> |
| | | and a.datatime >= #{record.beginTime} |
| | | </if> |
| | | <if test="record.endTime != null "> |
| | | <![CDATA[and a.datatime <= #{record.endTime}]]> |
| | | </if> |
| | | |
| | | </where> |
| | | GROUP BY g.su_id , f.su_id, a.order_type, h.id,a.achieveType,u.name |
| | | <if test="record.sort !=null and record.sort!=''"> order by ${record.sort} ${record.order}</if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <update id="updateAchieveNumOfPeople"> |
| | | <foreach collection="list" item="item" index="index" |
| | |
| | | update achieve_new set number_of_people=#{num} where id=#{item.id} |
| | | </foreach> |
| | | </update> |
| | | <update id="setPayMethod"> |
| | | |
| | | |
| | | update achieve_new |
| | | set pay_method=#{paymethod} |
| | | where id in |
| | | <foreach collection="list" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | |
| | | |
| | | </update> |
| | | </mapper> |