Commit c78b8d8a by 邹磊浩

修改代码

parent 633e6dcd
package com.pz.web.controller.system; package com.pz.web.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.pz.common.core.controller.BaseController; 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 lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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; ...@@ -17,4 +30,14 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/system/data") @RequestMapping("/system/data")
public class DataViewController extends BaseController { 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; ...@@ -9,6 +9,7 @@ import com.pz.system.domain.OrderMessage;
import com.pz.system.domain.TotalOrder; import com.pz.system.domain.TotalOrder;
import com.pz.system.domain.vo.AccompanyDemandVo; import com.pz.system.domain.vo.AccompanyDemandVo;
import com.pz.system.domain.vo.AppOrderVo; import com.pz.system.domain.vo.AppOrderVo;
import com.pz.system.domain.vo.OrderColumnarVo;
import com.pz.system.domain.vo.TotalOrderVo; import com.pz.system.domain.vo.TotalOrderVo;
import com.pz.common.core.mapper.BaseMapperPlus; import com.pz.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -60,4 +61,11 @@ public interface TotalOrderMapper extends BaseMapperPlus<TotalOrderMapper, Total ...@@ -60,4 +61,11 @@ public interface TotalOrderMapper extends BaseMapperPlus<TotalOrderMapper, Total
* @return 主订单数据转订单消息 * @return 主订单数据转订单消息
*/ */
OrderMessage selectDataToMessageById(Long id); OrderMessage selectDataToMessageById(Long id);
/**
* 数据总览
* @param type
* @return
*/
List<OrderColumnarVo> findOrderColumnarVoList(@Param("type") Integer type);
} }
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
select total_order.id as orderId, select total_order.id as orderId,
services.name as project, services.name as project,
business.name as businessName, business.name as businessName,
CONVERT((1 - services.fenmo / 100), decimal(10, 2)) * CONVERT((1 - services.fenmo / 100), decimal (10, 2)) *
CONVERT(services.price, decimal(10, 2)) as commission, CONVERT(services.price, decimal (10, 2)) as commission,
total_order.business_id, total_order.business_id,
total_order.remark as description, total_order.remark as description,
total_order.evaluation_content, total_order.evaluation_content,
...@@ -39,8 +39,7 @@ ...@@ -39,8 +39,7 @@
</select> </select>
<select id="selectByOrderId" resultType="com.pz.system.domain.vo.TotalOrderVo"> <select id="selectByOrderId" resultType="com.pz.system.domain.vo.TotalOrderVo">
select select t.id,
t.id,
t.order_sn, t.order_sn,
t.uid, t.uid,
t.em_id, t.em_id,
...@@ -84,5 +83,20 @@ ...@@ -84,5 +83,20 @@
left join sys_user on sys_user.user_id = total_order.uid left join sys_user on sys_user.user_id = total_order.uid
where total_order.id = #{id} where total_order.id = #{id}
</select> </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> </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