Commit c78b8d8a by 邹磊浩

修改代码

parent 633e6dcd
package com.pz.web.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.pz.common.core.controller.BaseController;
import com.pz.common.core.domain.PageQuery;
import com.pz.common.core.domain.R;
import com.pz.common.core.page.TableDataInfo;
import com.pz.system.domain.bo.DbghOrderBo;
import com.pz.system.domain.vo.DbghOrderVo;
import com.pz.system.domain.vo.OrderColumnarVo;
import com.pz.system.mapper.TotalOrderMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotEmpty;
import java.util.List;
/**
* 数据总览
*
......@@ -17,4 +30,14 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/system/data")
public class DataViewController extends BaseController {
private final TotalOrderMapper totalOrderMapper;
/**
* 数据总览柱状图
*/
@GetMapping("/findOrderColumnarVoList/{type}")
public R<List<OrderColumnarVo>> findOrderColumnarVoList(
@PathVariable Integer type) {
return R.ok(totalOrderMapper.findOrderColumnarVoList(type));
}
}
package com.pz.system.domain.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class OrderColumnarVo implements Serializable {
/**
* 业务名称
*/
private String name;
/**
* 数量
*/
private Long num;
}
......@@ -9,6 +9,7 @@ import com.pz.system.domain.OrderMessage;
import com.pz.system.domain.TotalOrder;
import com.pz.system.domain.vo.AccompanyDemandVo;
import com.pz.system.domain.vo.AppOrderVo;
import com.pz.system.domain.vo.OrderColumnarVo;
import com.pz.system.domain.vo.TotalOrderVo;
import com.pz.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
......@@ -60,4 +61,11 @@ public interface TotalOrderMapper extends BaseMapperPlus<TotalOrderMapper, Total
* @return 主订单数据转订单消息
*/
OrderMessage selectDataToMessageById(Long id);
/**
* 数据总览
* @param type
* @return
*/
List<OrderColumnarVo> findOrderColumnarVoList(@Param("type") Integer type);
}
......@@ -5,17 +5,17 @@
<mapper namespace="com.pz.system.mapper.TotalOrderMapper">
<sql id="OrderCommon">
select total_order.id as orderId,
services.name as project,
business.name as businessName,
CONVERT((1 - services.fenmo / 100), decimal(10, 2)) *
CONVERT(services.price, decimal(10, 2)) as commission,
select total_order.id as orderId,
services.name as project,
business.name as businessName,
CONVERT((1 - services.fenmo / 100), decimal (10, 2)) *
CONVERT(services.price, decimal (10, 2)) as commission,
total_order.business_id,
total_order.remark as description,
total_order.remark as description,
total_order.evaluation_content,
total_order.is_satisfaction as evaluation_flag,
total_order.uid as uid,
total_order.status as orderStatus
total_order.is_satisfaction as evaluation_flag,
total_order.uid as uid,
total_order.status as orderStatus
from total_order
left join services on total_order.service_id = services.id
left join business on total_order.business_id = business.id
......@@ -39,36 +39,35 @@
</select>
<select id="selectByOrderId" resultType="com.pz.system.domain.vo.TotalOrderVo">
select
t.id,
t.order_sn,
t.uid,
t.em_id,
t.city_id,
t.business_id,
t.service_id,
t.pay_money,
t.status,
t.lng,
t.lat,
t.is_satisfaction,
t.evaluation_content,
t.refund_reason,
t.refund_amount,
t.pay_cs,
t.del_flag,
t.create_by,
t.create_time,
t.update_by,
t.update_time,
t.remark,
e.name as emName,
b.name as business,
s.name as service
select t.id,
t.order_sn,
t.uid,
t.em_id,
t.city_id,
t.business_id,
t.service_id,
t.pay_money,
t.status,
t.lng,
t.lat,
t.is_satisfaction,
t.evaluation_content,
t.refund_reason,
t.refund_amount,
t.pay_cs,
t.del_flag,
t.create_by,
t.create_time,
t.update_by,
t.update_time,
t.remark,
e.name as emName,
b.name as business,
s.name as service
from total_order t
left join business b on b.id = t.business_id
left join services s on s.id = t.service_id
left join employees e on e.id = t.em_id
left join business b on b.id = t.business_id
left join services s on s.id = t.service_id
left join employees e on e.id = t.em_id
where t.id = #{id}
</select>
......@@ -84,5 +83,20 @@
left join sys_user on sys_user.user_id = total_order.uid
where total_order.id = #{id}
</select>
<select id="findOrderColumnarVoList" resultType="com.pz.system.domain.vo.OrderColumnarVo">
SELECT b.`name` name, COUNT(t.business_id) AS num
FROM business b
LEFT JOIN total_order t ON t.business_id = b.id
AND t.`status` = 2
<if test="type == 1">
AND DATE(t.create_time) = CURDATE()
</if>
<if test="type == 2">
AND DATE(t.create_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 DAY) AND CURDATE()
</if>
<if test="type == 3">
AND DATE(t.create_time) BETWEEN DATE_SUB(CURDATE(), INTERVAL 29 DAY) AND CURDATE()
</if>
GROUP BY b.id;
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment