forked from sd_delivery/delivery
51 changed files with 2940 additions and 288 deletions
@ -1,15 +1,90 @@ |
|||||
package com.ccsens.delivery.bean.vo; |
package com.ccsens.delivery.bean.vo; |
||||
|
|
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.ccsens.delivery.util.DeliveryConstant; |
||||
|
import com.ccsens.util.SymmetricCryptoUtil; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import io.swagger.annotations.ApiModel; |
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.util.Date; |
||||
|
|
||||
/** |
/** |
||||
* @author 逗 |
* @author 逗 |
||||
*/ |
*/ |
||||
@Data |
@Data |
||||
public class HealthVo { |
public class HealthVo { |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("返回-健康相关的信息") |
||||
|
public static class HealthList{ |
||||
|
@ApiModelProperty("提交记录id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("类型 0健康码、1行程码、2核酸检测、3抗原检测") |
||||
|
private byte type; |
||||
|
@ApiModelProperty("图片路径") |
||||
|
private String path; |
||||
|
@ApiModelProperty("是否已经标注过 0否 1是") |
||||
|
private byte ocr; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("返回-健康相关信息列表") |
||||
|
public static class BackQueryHealthVo{ |
||||
|
@ApiModelProperty("记录id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("学号") |
||||
|
private String number; |
||||
|
@ApiModelProperty("联系电话") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("所在学院Id") |
||||
|
private Long collegeId; |
||||
|
@ApiModelProperty("所在学院名称") |
||||
|
private String collegeName; |
||||
|
@ApiModelProperty("所在年级") |
||||
|
private String grade; |
||||
|
@ApiModelProperty("所在班级Id") |
||||
|
private Long stuClassId; |
||||
|
@ApiModelProperty("所在班级名称") |
||||
|
private String stuClassName; |
||||
|
@ApiModelProperty("提交时间") |
||||
|
private Long submitTime; |
||||
|
@ApiModelProperty("图片路径") |
||||
|
private String imgPath; |
||||
|
@ApiModelProperty("提交状态 0未上报 1已上报 ") |
||||
|
private Byte status; |
||||
|
@ApiModelProperty("颜色 0绿色 1黄色 2红色") |
||||
|
private Byte colour; |
||||
|
@ApiModelProperty("是否带星 0否 1是") |
||||
|
private Byte star; |
||||
|
@ApiModelProperty("是否阳性 0阴性 1阳性") |
||||
|
private Byte positive; |
||||
|
|
||||
|
public String getNumber() { |
||||
|
String s = number; |
||||
|
if(StrUtil.isNotBlank(number)){ |
||||
|
String decode = SymmetricCryptoUtil.decode(DeliveryConstant.ENCRYPT_KEY, number); |
||||
|
if(StrUtil.isNotBlank(decode)){ |
||||
|
s = decode; |
||||
|
} |
||||
|
} |
||||
|
return s; |
||||
|
} |
||||
|
|
||||
|
public String getPhone() { |
||||
|
String s = phone; |
||||
|
if(StrUtil.isNotBlank(phone)){ |
||||
|
String decode = SymmetricCryptoUtil.decode(DeliveryConstant.ENCRYPT_KEY, phone); |
||||
|
if(StrUtil.isNotBlank(decode)){ |
||||
|
s = decode; |
||||
|
} |
||||
|
} |
||||
|
return s; |
||||
|
} |
||||
|
|
||||
|
} |
||||
} |
} |
||||
|
@ -0,0 +1,101 @@ |
|||||
|
package com.ccsens.delivery.bean.vo; |
||||
|
|
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.ccsens.delivery.util.DeliveryConstant; |
||||
|
import com.ccsens.util.SymmetricCryptoUtil; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.Max; |
||||
|
import javax.validation.constraints.Min; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class TrailsVo { |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("返回-后台分页查找轨迹信息") |
||||
|
public static class BackQueryTrailsVo{ |
||||
|
@ApiModelProperty("订单id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("学号") |
||||
|
private String number; |
||||
|
@ApiModelProperty("联系电话") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("所在学院Id") |
||||
|
private Long collegeId; |
||||
|
@ApiModelProperty("所在学院名称") |
||||
|
private String collegeName; |
||||
|
@ApiModelProperty("所在楼栋Id") |
||||
|
private Long dormitoryId; |
||||
|
@ApiModelProperty("所在楼栋名称") |
||||
|
private String dormitoryName; |
||||
|
@ApiModelProperty("所在年级") |
||||
|
private String grade; |
||||
|
@ApiModelProperty("所在班级Id") |
||||
|
private Long stuClassId; |
||||
|
@ApiModelProperty("所在班级名称") |
||||
|
private String stuClassName; |
||||
|
@ApiModelProperty("详细地址") |
||||
|
private String address; |
||||
|
|
||||
|
@ApiModelProperty("轨迹日期") |
||||
|
private Date trailsDate; |
||||
|
@ApiModelProperty("备注") |
||||
|
private String remark; |
||||
|
@ApiModelProperty("是否提交 0未上报 1已上报") |
||||
|
private byte status; |
||||
|
@ApiModelProperty("轨迹详情") |
||||
|
private List<TrailsDetailVo> trailsDetailVoList; |
||||
|
|
||||
|
public String getNumber() { |
||||
|
String s = number; |
||||
|
if(StrUtil.isNotBlank(number)){ |
||||
|
String decode = SymmetricCryptoUtil.decode(DeliveryConstant.ENCRYPT_KEY, number); |
||||
|
if(StrUtil.isNotBlank(decode)){ |
||||
|
s = decode; |
||||
|
} |
||||
|
} |
||||
|
return s; |
||||
|
} |
||||
|
|
||||
|
public String getPhone() { |
||||
|
String s = phone; |
||||
|
if(StrUtil.isNotBlank(phone)){ |
||||
|
String decode = SymmetricCryptoUtil.decode(DeliveryConstant.ENCRYPT_KEY, phone); |
||||
|
if(StrUtil.isNotBlank(decode)){ |
||||
|
s = decode; |
||||
|
} |
||||
|
} |
||||
|
return s; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("返回-时间段轨迹详情") |
||||
|
public static class TrailsDetailVo{ |
||||
|
@ApiModelProperty("详情id") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("时间段") |
||||
|
private String time; |
||||
|
@ApiModelProperty("轨迹详情") |
||||
|
private String trailsDetail; |
||||
|
@ApiModelProperty("交通工具") |
||||
|
private String vehicle; |
||||
|
@ApiModelProperty("交通工具备注") |
||||
|
private String vehicleRemark; |
||||
|
@ApiModelProperty("防护手段") |
||||
|
private String mask; |
||||
|
@ApiModelProperty("防护手段备注") |
||||
|
private String otherMask; |
||||
|
} |
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
package com.ccsens.delivery.persist.dao; |
||||
|
|
||||
|
import com.ccsens.delivery.bean.dto.HealthDto; |
||||
|
import com.ccsens.delivery.bean.dto.MaterialDto; |
||||
|
import com.ccsens.delivery.bean.vo.CommonVo; |
||||
|
import com.ccsens.delivery.bean.vo.HealthVo; |
||||
|
import com.ccsens.delivery.bean.vo.MaterialVo; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public interface FormRecordDao { |
||||
|
|
||||
|
/** |
||||
|
* 查找自己提交的健康信息 |
||||
|
* @param type 类型 |
||||
|
* @param userId userId |
||||
|
* @return 返回提交的信息列表 |
||||
|
*/ |
||||
|
List<CommonVo.QuerySelf> querySelfHealth(@Param("type") byte type, @Param("userId") Long userId); |
||||
|
|
||||
|
/** |
||||
|
* 查找自己提交的轨迹信息 |
||||
|
* @param userId userId |
||||
|
* @return 返回轨迹信息提交记录 |
||||
|
*/ |
||||
|
List<CommonVo.QuerySelf> querySelfTrack(@Param("userId") Long userId); |
||||
|
|
||||
|
/** |
||||
|
* 查看自己提交的物资需求 |
||||
|
* @param userId userId |
||||
|
* @return 返回物资需求提交记录 |
||||
|
*/ |
||||
|
List<CommonVo.QuerySelf> querySelfMaterial(@Param("userId") Long userId); |
||||
|
|
||||
|
/** |
||||
|
* 查看自己提交的药品需求 |
||||
|
* @param userId userId |
||||
|
* @return 返回药品需求提交记录 |
||||
|
*/ |
||||
|
List<CommonVo.QuerySelf> querySelfDrug(@Param("userId") Long userId); |
||||
|
|
||||
|
/** |
||||
|
* 修改订单完成状态 |
||||
|
* @param orderIdList 订单id |
||||
|
* @param status 状态 |
||||
|
*/ |
||||
|
void updateMaterialStatusById(@Param("orderIdList")List<Long> orderIdList, @Param("status") Byte status); |
||||
|
|
||||
|
/** |
||||
|
* 查找所有录入信息的学生或教职工 |
||||
|
* @param type 职业类型 |
||||
|
* @param collegeId 学院/部门id |
||||
|
* @param grade 年纪 |
||||
|
* @param stuClassId 班级 |
||||
|
* @return 返回成员id |
||||
|
*/ |
||||
|
List<Long> selectTotalUser(@Param("type")byte type, @Param("collegeId")Long collegeId, @Param("grade")String grade, @Param("stuClassId")Long stuClassId); |
||||
|
|
||||
|
/** |
||||
|
* 根据类型和时间统计健康信息相关的上传数据 |
||||
|
* @param types 类型 |
||||
|
* @param userIds userIds |
||||
|
* @param startTime 开始时间 |
||||
|
* @param endTime 结束时间 |
||||
|
* @return 返回统计数据 |
||||
|
*/ |
||||
|
CommonVo.HealthNum statisticsHealthByType(@Param("types")byte types, @Param("userIds")List<Long> userIds, @Param("startTime")Long startTime, @Param("endTime")Long endTime); |
||||
|
|
||||
|
CommonVo.OrderNum statisticsTrack(@Param("userIds")List<Long> userIds, @Param("startTime")Long startTime, @Param("endTime")Long endTime); |
||||
|
|
||||
|
CommonVo.OrderNum statisticsMaterial(@Param("userIds")List<Long> userIds, @Param("startTime")Long startTime, @Param("endTime")Long endTime); |
||||
|
|
||||
|
CommonVo.OrderNum statisticsDrug(@Param("userIds")List<Long> userIds, @Param("startTime")Long startTime, @Param("endTime")Long endTime); |
||||
|
|
||||
|
/** |
||||
|
* 查找规定时间内上传的健康码信息 |
||||
|
* @param params 类型和时间 |
||||
|
* @return 返回图片数组 |
||||
|
*/ |
||||
|
List<HealthVo.HealthList> queryHealthImg(@Param("params")HealthDto.HealthByDay params); |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.ccsens.delivery.persist.dao; |
||||
|
|
||||
|
import com.ccsens.delivery.bean.dto.HealthDto; |
||||
|
import com.ccsens.delivery.bean.vo.HealthVo; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public interface RecordHealthDao { |
||||
|
|
||||
|
/** |
||||
|
* 后台查看提交的健康相关信息 |
||||
|
* @param param 筛选条件 |
||||
|
* @return 返回列表 |
||||
|
*/ |
||||
|
List<HealthVo.BackQueryHealthVo> backQueryMaterialOrder(@Param("param") HealthDto.BackQueryHealth param); |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.ccsens.delivery.persist.dao; |
||||
|
|
||||
|
import com.ccsens.delivery.bean.dto.TrailsDto; |
||||
|
import com.ccsens.delivery.bean.vo.TrailsVo; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public interface RecordTrailsDao { |
||||
|
|
||||
|
/** |
||||
|
* 查找轨迹 |
||||
|
* @param param 筛选条件 |
||||
|
* @return 返回轨迹信息 |
||||
|
*/ |
||||
|
List<TrailsVo.BackQueryTrailsVo> backQueryTrails(@Param("param") TrailsDto.BackQueryTrails param); |
||||
|
|
||||
|
/** |
||||
|
* 通过记录id查找每天的行程详情 |
||||
|
* @param recordId 轨迹记录id |
||||
|
* @param param 筛选条件 |
||||
|
* @return 返回详情列表 |
||||
|
*/ |
||||
|
List<TrailsVo.TrailsDetailVo> queryDetailByRecordId(@Param("recordId") Long recordId,@Param("param") TrailsDto.BackQueryTrails param); |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.ccsens.delivery.persist.dao; |
||||
|
|
||||
|
import com.ccsens.delivery.bean.dto.MaterialDto; |
||||
|
import com.ccsens.delivery.bean.vo.MaterialVo; |
||||
|
import com.ccsens.delivery.persist.mapper.SysMaterialMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
public interface SysMaterialDao extends SysMaterialMapper { |
||||
|
|
||||
|
/** |
||||
|
* 查找所有商品 |
||||
|
* @return 返回商品列表 |
||||
|
*/ |
||||
|
List<MaterialVo.MaterialList> queryAllMaterial(); |
||||
|
|
||||
|
/** |
||||
|
* 后台分页查找物资订单 |
||||
|
* @param param 筛选条件 |
||||
|
* @return 返回物资需求列表 |
||||
|
*/ |
||||
|
List<MaterialVo.MaterialOrder> backQueryMaterialOrder(@Param("param")MaterialDto.BackQueryMaterialOrder param); |
||||
|
|
||||
|
/** |
||||
|
* 根据订单查找需求的物品内容 |
||||
|
* @param recordId 订单id |
||||
|
* @return 返回物品列表 |
||||
|
*/ |
||||
|
List<MaterialVo.MaterialOrderDetail> queryItemByOrderId(@Param("recordId")Long recordId); |
||||
|
} |
@ -0,0 +1,240 @@ |
|||||
|
<?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.ccsens.delivery.persist.dao.FormRecordDao"> |
||||
|
<update id="updateMaterialStatusById"> |
||||
|
UPDATE |
||||
|
t_record_material |
||||
|
set |
||||
|
`status` = #{status} |
||||
|
WHERE |
||||
|
rec_status = 0 |
||||
|
and `status` != 1 |
||||
|
and `status` != 3 |
||||
|
and id in |
||||
|
<foreach collection="orderIdList" item="item" open="(" separator="," close=")"> |
||||
|
#{item} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<select id="querySelfHealth" resultType="com.ccsens.delivery.bean.vo.CommonVo$QuerySelf"> |
||||
|
SELECT |
||||
|
id, |
||||
|
submit_time as submitTime |
||||
|
FROM |
||||
|
t_record_health |
||||
|
WHERE |
||||
|
`type` = #{type} |
||||
|
and user_id = #{userId} |
||||
|
and rec_status = 0 |
||||
|
</select> |
||||
|
<select id="querySelfTrack" resultType="com.ccsens.delivery.bean.vo.CommonVo$QuerySelf"> |
||||
|
SELECT |
||||
|
id, |
||||
|
submit_time as submitTime |
||||
|
FROM |
||||
|
t_record_trails |
||||
|
WHERE |
||||
|
user_id = #{userId} |
||||
|
and rec_status = 0 |
||||
|
</select> |
||||
|
<select id="querySelfMaterial" resultType="com.ccsens.delivery.bean.vo.CommonVo$QuerySelf"> |
||||
|
SELECT |
||||
|
id, |
||||
|
submit_time as submitTime, |
||||
|
`status` |
||||
|
FROM |
||||
|
t_record_material |
||||
|
WHERE |
||||
|
user_id = #{userId} |
||||
|
and rec_status = 0 |
||||
|
</select> |
||||
|
<select id="querySelfDrug" resultType="com.ccsens.delivery.bean.vo.CommonVo$QuerySelf"> |
||||
|
SELECT |
||||
|
id, |
||||
|
UNIX_TIMESTAMP(created_at) * 1000 as submitTime, |
||||
|
`status` |
||||
|
FROM |
||||
|
t_stu_order |
||||
|
WHERE |
||||
|
user_id = #{userId} |
||||
|
and rec_status = 0 |
||||
|
</select> |
||||
|
<select id="selectTotalUser" resultType="java.lang.Long"> |
||||
|
SELECT |
||||
|
user_id |
||||
|
FROM |
||||
|
t_sys_user_info |
||||
|
WHERE |
||||
|
rec_status = 0 |
||||
|
and post = #{type} |
||||
|
<if test="collegeId != null"> |
||||
|
and college_id = #{collegeId} |
||||
|
</if> |
||||
|
<if test="grade != null and grade != ''"> |
||||
|
and grade = #{grade} |
||||
|
</if> |
||||
|
<if test="stuClassId != null"> |
||||
|
and stu_class_id = #{stuClassId} |
||||
|
</if> |
||||
|
</select> |
||||
|
<select id="statisticsHealthByType" resultType="com.ccsens.delivery.bean.vo.CommonVo$HealthNum"> |
||||
|
|
||||
|
|
||||
|
|
||||
|
SELECT |
||||
|
count(*) as reportNum |
||||
|
<if test="type = 0 or type = 1"> |
||||
|
,count(if(h.colour = 0,1,null)) as greenNum, |
||||
|
count(if(h.colour = 1,1,null)) as yellowNum, |
||||
|
count(if(h.colour = 2,1,null)) as redNum |
||||
|
</if> |
||||
|
<if test="type = 1"> |
||||
|
,count(if(h.star = 0,1,null)) as notStarNum, |
||||
|
count(if(h.star = 1,1,null)) as starNum |
||||
|
</if> |
||||
|
<if test="type = 2 or type = 3"> |
||||
|
,count(if(h.positive = 0,1,null)) as feminineNum, |
||||
|
count(if(h.positive = 1,1,null)) as positiveNum |
||||
|
</if> |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
DISTINCT |
||||
|
* |
||||
|
FROM |
||||
|
t_record_health |
||||
|
WHERE |
||||
|
user_id IN |
||||
|
( |
||||
|
<foreach collection="userIds" item="id" separator=","> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
) |
||||
|
AND ocr = 0 |
||||
|
and `type` = #{types} |
||||
|
and submit_time >= #{startTime} |
||||
|
and submit_time < #{endTime} |
||||
|
AND rec_status = 0 |
||||
|
ORDER BY submit_time desc |
||||
|
)a |
||||
|
GROUP BY user_id |
||||
|
)h |
||||
|
|
||||
|
|
||||
|
</select> |
||||
|
|
||||
|
<select id="statisticsTrack" resultType="com.ccsens.delivery.bean.vo.CommonVo$OrderNum"> |
||||
|
SELECT |
||||
|
count(DISTINCT user_id) as completeNum |
||||
|
FROM |
||||
|
t_record_trails |
||||
|
WHERE |
||||
|
user_id in ( |
||||
|
<foreach collection="userIds" item="id" separator=","> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
) |
||||
|
and UNIX_TIMESTAMP(trails_date) * 1000 >= #{startTime} |
||||
|
and UNIX_TIMESTAMP(trails_date) * 1000 < #{endTime} |
||||
|
and rec_status = 0 |
||||
|
</select> |
||||
|
<select id="statisticsMaterial" resultType="com.ccsens.delivery.bean.vo.CommonVo$OrderNum"> |
||||
|
|
||||
|
SELECT |
||||
|
MAX( CASE m.type WHEN 'N' THEN num ELSE 0 END ) as `notCompleteNum`, |
||||
|
MAX( CASE m.type WHEN 'Y' THEN num ELSE 0 END ) as `completeNum` |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
count(DISTINCT id) as num, |
||||
|
'Y' as type |
||||
|
FROM |
||||
|
t_record_material |
||||
|
WHERE |
||||
|
user_id in ( |
||||
|
<foreach collection="userIds" item="id" separator=","> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
) |
||||
|
and `status` = 1 |
||||
|
and submit_time >= #{startTime} |
||||
|
and submit_time < #{endTime} |
||||
|
and rec_status = 0 |
||||
|
UNION |
||||
|
SELECT |
||||
|
count(DISTINCT id) as num, |
||||
|
'N' as type |
||||
|
FROM |
||||
|
t_record_material |
||||
|
WHERE |
||||
|
user_id in ( |
||||
|
<foreach collection="userIds" item="id" separator=","> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
) |
||||
|
and `status` = 0 |
||||
|
and submit_time >= #{startTime} |
||||
|
and submit_time < #{endTime} |
||||
|
and rec_status = 0 |
||||
|
)m |
||||
|
|
||||
|
</select> |
||||
|
<select id="statisticsDrug" resultType="com.ccsens.delivery.bean.vo.CommonVo$OrderNum"> |
||||
|
SELECT |
||||
|
MAX( CASE m.type WHEN 'N' THEN num ELSE 0 END ) as `notCompleteNum`, |
||||
|
MAX( CASE m.type WHEN 'Y' THEN num ELSE 0 END ) as `completeNum` |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
count(DISTINCT id) as num, |
||||
|
'Y' as type |
||||
|
FROM |
||||
|
t_stu_order |
||||
|
WHERE |
||||
|
user_id in ( |
||||
|
<foreach collection="userIds" item="id" separator=","> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
) |
||||
|
and `status` = 1 |
||||
|
and UNIX_TIMESTAMP(created_at) * 1000 >= #{startTime} |
||||
|
and UNIX_TIMESTAMP(created_at) * 1000 < #{endTime} |
||||
|
and rec_status = 0 |
||||
|
UNION |
||||
|
SELECT |
||||
|
count(DISTINCT id) as num, |
||||
|
'N' as type |
||||
|
FROM |
||||
|
t_stu_order |
||||
|
WHERE |
||||
|
user_id in ( |
||||
|
<foreach collection="userIds" item="id" separator=","> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
) |
||||
|
and `status` = 0 |
||||
|
and UNIX_TIMESTAMP(created_at) * 1000 >= #{startTime} |
||||
|
and UNIX_TIMESTAMP(created_at) * 1000 < #{endTime} |
||||
|
and rec_status = 0 |
||||
|
)m |
||||
|
</select> |
||||
|
<select id="queryHealthImg" resultType="com.ccsens.delivery.bean.vo.HealthVo$HealthList"> |
||||
|
SELECT |
||||
|
h.id, |
||||
|
h.type, |
||||
|
f.visit_path, |
||||
|
h.ocr |
||||
|
FROM |
||||
|
t_record_health h, |
||||
|
t_file_commit f |
||||
|
WHERE |
||||
|
h.file_id = f.id |
||||
|
and h.type = #{params.type} |
||||
|
and submit_time >= #{params.startTime} |
||||
|
and submit_time < #{params.endTime} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,103 @@ |
|||||
|
<?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.ccsens.delivery.persist.dao.RecordHealthDao"> |
||||
|
|
||||
|
|
||||
|
<select id="backQueryMaterialOrder" resultType="com.ccsens.delivery.bean.vo.HealthVo$BackQueryHealthVo"> |
||||
|
SELECT |
||||
|
h.*, |
||||
|
if(a1.`name` is null, h.college_name,a1.`name`) as collegeName, |
||||
|
if(a3.`name` is null, h.stu_class_name,a3.`name`) as stuClassName |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
h.id, |
||||
|
u.`name`, |
||||
|
u.number, |
||||
|
u.phone, |
||||
|
u.grade, |
||||
|
h.submit_time as submitTime, |
||||
|
if(h.id is null, 0, 1) as `status`, |
||||
|
u.college_id as collegeId, |
||||
|
u.college_name, |
||||
|
u.stu_class_id as stuClassId, |
||||
|
u.stu_class_name, |
||||
|
h.visit_path as imgPath, |
||||
|
h.colour, |
||||
|
h.star, |
||||
|
h.positive |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
t_sys_user_info u |
||||
|
WHERE |
||||
|
u.rec_status = 0 |
||||
|
and u.post = #{param.post} |
||||
|
<if test="param.name != null and param.name != ''"> |
||||
|
and u.name like CONCAT('%',#{param.name},'%') |
||||
|
</if> |
||||
|
<if test="param.number != null and param.number != ''"> |
||||
|
and u.number = #{param.number} |
||||
|
</if> |
||||
|
<if test="param.phone != null and param.phone != ''"> |
||||
|
and u.phone = #{param.phone} |
||||
|
</if> |
||||
|
<if test="param.collegeId != null"> |
||||
|
and u.college_id = #{param.collegeId} |
||||
|
</if> |
||||
|
<if test="param.stuClassId != null"> |
||||
|
and u.stu_class_id = #{param.stuClassId} |
||||
|
</if> |
||||
|
<if test="param.grade != null and param.grade != ''"> |
||||
|
and u.grade = #{param.grade} |
||||
|
</if> |
||||
|
)u |
||||
|
LEFT JOIN ( |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
DISTINCT |
||||
|
h.*, |
||||
|
f.visit_path |
||||
|
FROM |
||||
|
t_record_health h |
||||
|
LEFT JOIN t_file_commit f on h.file_id = f.id and f.rec_status = 0 |
||||
|
WHERE |
||||
|
h.`type` = #{param.type} |
||||
|
<if test="param.submitTime != null"> |
||||
|
and FROM_UNIXTIME(h.submit_time / 1000,'%Y-%m-%d') = FROM_UNIXTIME(#{params.submitTime} / 1000,'%Y-%m-%d') |
||||
|
</if> |
||||
|
AND h.rec_status = 0 |
||||
|
ORDER BY h.submit_time desc |
||||
|
)a |
||||
|
GROUP BY user_id |
||||
|
) h on h.user_id = u.user_id |
||||
|
<where> |
||||
|
<if test="param.status != null and param.status == 0"> |
||||
|
and h.id is null |
||||
|
</if> |
||||
|
<if test="param.status == null or param.status == 1"> |
||||
|
<if test="param.status != null and param.status == 1"> |
||||
|
and h.id is not null |
||||
|
</if> |
||||
|
<if test="param.colour != null"> |
||||
|
and h.colour = #{param.colour} |
||||
|
</if> |
||||
|
<if test="param.star != null"> |
||||
|
and h.star = #{param.star} |
||||
|
</if> |
||||
|
<if test="param.positive != null"> |
||||
|
and h.positive = #{param.positive} |
||||
|
</if> |
||||
|
</if> |
||||
|
</where> |
||||
|
)h |
||||
|
LEFT JOIN t_sys_area a1 on h.collegeId = a1.id and a1.rec_status = 0 |
||||
|
LEFT JOIN t_sys_area a3 on h.stuClassId = a3.id and a3.rec_status = 0 |
||||
|
order by h.submitTime desc |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,122 @@ |
|||||
|
<?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.ccsens.delivery.persist.dao.RecordTrailsDao"> |
||||
|
|
||||
|
<select id="backQueryTrails" resultType="com.ccsens.delivery.bean.vo.TrailsVo$BackQueryTrailsVo"> |
||||
|
|
||||
|
SELECT |
||||
|
t.*, |
||||
|
if(a1.`name` is null, t.college_name,a1.`name`) as collegeName, |
||||
|
if(a2.`name` is null, t.dormitory_name,a2.`name`) as dormitoryName, |
||||
|
if(a3.`name` is null, t.stu_class_name,a3.`name`) as stuClassName |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
t.id, |
||||
|
u.`name`, |
||||
|
u.number, |
||||
|
u.phone, |
||||
|
u.college_id as collegeId, |
||||
|
u.college_name, |
||||
|
u.dormitory_id as dormitoryId, |
||||
|
u.dormitory_name, |
||||
|
u.grade, |
||||
|
u.stu_class_id as stuClassId, |
||||
|
u.stu_class_name, |
||||
|
u.address, |
||||
|
t.trails_date as trailsDate, |
||||
|
t.submit_time, |
||||
|
t.remark, |
||||
|
if(t.id is null, 0, 1) as `status` |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
t_sys_user_info u |
||||
|
WHERE |
||||
|
u.rec_status = 0 |
||||
|
and u.post = #{param.post} |
||||
|
<if test="param.name != null and param.name != ''"> |
||||
|
and u.name like CONCAT('%',#{param.name},'%') |
||||
|
</if> |
||||
|
<if test="param.number != null and param.number != ''"> |
||||
|
and u.number = #{param.number} |
||||
|
</if> |
||||
|
<if test="param.phone != null and param.phone != ''"> |
||||
|
and u.phone = #{param.phone} |
||||
|
</if> |
||||
|
<if test="param.collegeId != null"> |
||||
|
and u.college_id = #{param.collegeId} |
||||
|
</if> |
||||
|
<if test="param.stuClassId != null"> |
||||
|
and u.stu_class_id = #{param.stuClassId} |
||||
|
</if> |
||||
|
<if test="param.grade != null and param.grade != ''"> |
||||
|
and u.grade = #{param.grade} |
||||
|
</if> |
||||
|
<if test="param.dormitoryId != null and param.dormitoryId.size != 0"> |
||||
|
and u.dormitory_id in |
||||
|
<foreach collection="param.dormitoryId" item="item" open="(" separator="," close=")"> |
||||
|
#{item} |
||||
|
</foreach> |
||||
|
</if> |
||||
|
<if test="param.address != null and param.address != ''"> |
||||
|
and u.address like CONCAT('%',#{param.address},'%') |
||||
|
</if> |
||||
|
)u |
||||
|
LEFT JOIN |
||||
|
( |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
DISTINCT |
||||
|
* |
||||
|
FROM |
||||
|
t_record_trails t |
||||
|
WHERE |
||||
|
t.rec_status = 0 |
||||
|
<if test="param.startDate != null and param.endDate != null"> |
||||
|
and t.trails_date >= #{param.startDate} |
||||
|
and t.trails_date <= #{param.endDate} |
||||
|
</if> |
||||
|
ORDER BY t.submit_time desc |
||||
|
)a |
||||
|
GROUP BY a.user_id,a.trails_date |
||||
|
)t on u.user_id = t.user_id |
||||
|
)t |
||||
|
LEFT JOIN t_sys_area a1 on t.collegeId = a1.id and a1.rec_status = 0 |
||||
|
LEFT JOIN t_sys_area a2 on t.dormitoryId = a2.id and a2.rec_status = 0 |
||||
|
LEFT JOIN t_sys_area a3 on t.stuClassId = a3.id and a3.rec_status = 0 |
||||
|
order by t.trailsDate desc, t.submit_time desc |
||||
|
</select> |
||||
|
|
||||
|
<select id="queryDetailByRecordId" resultType="com.ccsens.delivery.bean.vo.TrailsVo$TrailsDetailVo"> |
||||
|
SELECT |
||||
|
id, |
||||
|
CONCAT(FROM_UNIXTIME(start_time / 1000,'%h:%i'),'至',FROM_UNIXTIME(end_time / 1000,'%h:%i')) as time, |
||||
|
trails_detail as trailsDetail, |
||||
|
vehicle, |
||||
|
vehicle_remark as vehicleRemark, |
||||
|
mask, |
||||
|
other_mask as otherMask |
||||
|
FROM |
||||
|
t_record_trails_detail |
||||
|
WHERE |
||||
|
record_trails_id = #{recordId} |
||||
|
and rec_status = 0 |
||||
|
<if test="param.vehicle != null and param.vehicle != ''"> |
||||
|
and vehicle like CONCAT('%',#{param.vehicle},'%') |
||||
|
</if> |
||||
|
<if test="param.trailsDetail != null and param.trailsDetail != ''"> |
||||
|
and trails_detail like CONCAT('%',#{param.trailsDetail},'%') |
||||
|
</if> |
||||
|
<if test="param.startTime != null and param.endTime != null"> |
||||
|
and FROM_UNIXTIME(start_time / 1000,'%h:%i') <= #{param.endTime} |
||||
|
and FROM_UNIXTIME(end_time / 1000,'%h:%i') >= #{param.startTime} |
||||
|
</if> |
||||
|
|
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,119 @@ |
|||||
|
<?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.ccsens.delivery.persist.dao.SysMaterialDao"> |
||||
|
|
||||
|
<select id="queryAllMaterial" resultType="com.ccsens.delivery.bean.vo.MaterialVo$MaterialList"> |
||||
|
SELECT |
||||
|
id, |
||||
|
`name`, |
||||
|
pay_max as max |
||||
|
FROM |
||||
|
t_sys_material |
||||
|
WHERE |
||||
|
rec_status = 0 |
||||
|
</select> |
||||
|
<select id="backQueryMaterialOrder" resultType="com.ccsens.delivery.bean.vo.MaterialVo$MaterialOrder"> |
||||
|
SELECT |
||||
|
m.*, |
||||
|
if(a1.`name` is null, m.college_name,a1.`name`) as collegeName, |
||||
|
if(a2.`name` is null, m.dormitory_name,a2.`name`) as dormitoryName, |
||||
|
if(a3.`name` is null, m.stu_class_name,a3.`name`) as stuClassName |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
rm.id, |
||||
|
u.`name`, |
||||
|
rm.remark as remark, |
||||
|
rm.plan_time as planTime, |
||||
|
u.number, |
||||
|
u.grade, |
||||
|
rm.submit_time as submitTime, |
||||
|
u.address, |
||||
|
u.phone, |
||||
|
rm.`status`, |
||||
|
u.college_id as collegeId, |
||||
|
u.college_name, |
||||
|
u.dormitory_id as dormitoryId, |
||||
|
u.dormitory_name, |
||||
|
u.stu_class_id as stuClassId, |
||||
|
u.stu_class_name |
||||
|
FROM |
||||
|
t_record_material rm, |
||||
|
t_sys_user_info u, |
||||
|
t_record_material_detail md, |
||||
|
t_sys_material m |
||||
|
WHERE |
||||
|
rm.user_id = u.user_id |
||||
|
and rm.id = md.record_material_id |
||||
|
and md.material_id = m.id |
||||
|
and m.rec_status = 0 |
||||
|
and md.rec_status = 0 |
||||
|
and rm.rec_status = 0 |
||||
|
and u.rec_status = 0 |
||||
|
and rm.status != 3 |
||||
|
and u.post = #{param.post} |
||||
|
<if test="param.name != null and param.name != ''"> |
||||
|
and u.name like CONCAT('%',#{param.name},'%') |
||||
|
</if> |
||||
|
<if test="param.number != null and param.number != ''"> |
||||
|
and u.number = #{param.number} |
||||
|
</if> |
||||
|
<if test="param.phone != null and param.phone != ''"> |
||||
|
and u.phone = #{param.phone} |
||||
|
</if> |
||||
|
<if test="param.collegeId != null"> |
||||
|
and u.college_id = #{param.collegeId} |
||||
|
</if> |
||||
|
<if test="param.dormitoryId != null and param.dormitoryId.size != 0"> |
||||
|
and u.dormitory_id in |
||||
|
<foreach collection="param.dormitoryId" item="item" open="(" separator="," close=")"> |
||||
|
#{item} |
||||
|
</foreach> |
||||
|
</if> |
||||
|
<if test="param.stuClassId != null"> |
||||
|
and u.stu_class_id = #{param.stuClassId} |
||||
|
</if> |
||||
|
<if test="param.grade != null and param.grade != ''"> |
||||
|
and u.grade = #{param.grade} |
||||
|
</if> |
||||
|
<if test="param.address != null and param.address != ''"> |
||||
|
and u.address like CONCAT('%',#{param.address},'%') |
||||
|
</if> |
||||
|
<if test="param.materialName != null and param.materialName != ''"> |
||||
|
and m.name like CONCAT('%',#{param.drugName},'%') |
||||
|
</if> |
||||
|
<if test="param.status != null"> |
||||
|
and rm.status = #{param.status} |
||||
|
</if> |
||||
|
<if test="param.submitTime != null"> |
||||
|
and FROM_UNIXTIME(rm.submit_time / 1000,'%Y-%m-%d') = FROM_UNIXTIME(#{params.submitTime} / 1000,'%Y-%m-%d') |
||||
|
</if> |
||||
|
<if test="param.startTime != null and param.endTime != null"> |
||||
|
and rm.plan_time >= #{param.startTime} |
||||
|
and rm.plan_time <= #{param.endTime} |
||||
|
</if> |
||||
|
group by rm.id |
||||
|
)m |
||||
|
LEFT JOIN t_sys_area a1 on m.collegeId = a1.id and a1.rec_status = 0 |
||||
|
LEFT JOIN t_sys_area a2 on m.dormitoryId = a2.id and a2.rec_status = 0 |
||||
|
LEFT JOIN t_sys_area a3 on m.stuClassId = a3.id and a3.rec_status = 0 |
||||
|
order by m.submitTime desc |
||||
|
</select> |
||||
|
<select id="queryItemByOrderId" resultType="com.ccsens.delivery.bean.vo.MaterialVo$MaterialOrderDetail"> |
||||
|
SELECT |
||||
|
m.id, |
||||
|
m.`name`, |
||||
|
d.num |
||||
|
FROM |
||||
|
t_sys_material m, |
||||
|
t_record_material rm, |
||||
|
t_record_material_detail d |
||||
|
WHERE |
||||
|
m.id = d.material_id |
||||
|
and rm.id = d.record_material_id |
||||
|
and rm.id = #{recordId} |
||||
|
and m.rec_status = 0 |
||||
|
and rm.rec_status = 0 |
||||
|
and d.rec_status = 0 |
||||
|
</select> |
||||
|
</mapper> |
Loading…
Reference in new issue