15 Commits
Author SHA1 Message Date
wanghao 5f790c0c7e fix(信创): 修复 Java 代码中 QueryWrapper.last() 拼接 LIMIT 语法与达梦不兼容问题
- LoginController: last("limit 1") → FETCH FIRST 1 ROWS ONLY
- WeighingDeviceServiceImpl: last("limit 1") → FETCH FIRST 1 ROWS ONLY
- SmsSendMsgHandle: last("limit "+n) → FETCH FIRST n ROWS ONLY
- HealthUserEmployeeExServiceImpl: 共 14 处 last("LIMIT 1") → FETCH FIRST 1 ROWS ONLY
- SysAnonServiceImpl: last("LIMIT 1 OFFSET 0") → FETCH FIRST 1 ROWS ONLY
2026-03-06 11:36:43 +08:00
wanghao 890cdfe40d fix(信创): 修复 Mapper XML 中 MySQL 特有语法与达梦数据库不兼容问题
- UserDataRecordBmiMapper.xml: DATE() → TRUNC(),LIMIT 1 → FETCH FIRST 1 ROWS ONLY
- SysVersionInfoMapper.xml: limit 1 → FETCH FIRST 1 ROWS ONLY
- SysUserMapper.xml: limit 1 → FETCH FIRST 1 ROWS ONLY,IFNULL() → NVL(),INSERT IGNORE → INSERT INTO
2026-03-06 11:36:19 +08:00
wanghao 909ccacaeb sql(信创): 新增达梦数据库无效表清理脚本,删除100张冗余表 2026-03-06 10:22:59 +08:00
wanghao 9b3021e847 Merge branch 'xc' of https://gitea.rk-health.com/renkang/xj-platform into xc 2026-03-06 09:54:28 +08:00
wanghao 264ca97055 refactor(缓存管理): 注释掉新疆项目中青海相关的用户和部门缓存逻辑 2026-03-06 09:51:38 +08:00
lianlonggang 9251e202f3 feat(db): 添加达梦数据库关键字转义拦截器
- 新增 DmKeywordInterceptor 拦截器,自动为达梦数据库关键字添加双引号转义
- 更新 AedEquipmentManger 实体类格式化和导入语句规范
- 支持自动识别和处理达梦数据库保留关键字,避免 SQL 语法错误
- 提升数据库兼容性,确保实体字段与达梦数据库关键字冲突时正常执行
2026-03-05 18:30:21 +08:00
wanghao 5885cd2ea0 xml修改 2026-03-05 14:47:55 +08:00
hejiayang d2a2f8291c 实体类数据库关键字注释 2026-03-05 11:15:20 +08:00
hejiayang a38f8adfc8 Merge remote-tracking branch 'origin/xc' into xc 2026-03-04 18:01:49 +08:00
hejiayang 4c98dd2d30 fix: 应急就医数据库迁移相关调整
1.启动类排除QuartzAutoConfiguration.class
2.数据库字段与达梦保留关键字段冲突调整
3.sql键名重复修改
2026-03-04 18:01:20 +08:00
wanghao b751f40bb4 systemxml改造 2026-03-04 14:59:45 +08:00
lianlonggang 61045e4389 chore(config): 更新 Nacos 配置连接信息
- 更新 Nacos 服务器地址从 localhost:8848 到 192.168.1.80:8848
- 更新认证信息(用户名: xjuser, 密码: Aa135790!123)
- 更新命名空间为 xjxc-space-common
- 新增服务发现命名空间配置 NACOS_NAMESPACE_DISCOVERY

涉及模块:
- health-consultation-start
- health-emergency-start
- health-watch-start
- jeecg-system-start
2026-03-04 09:30:06 +08:00
lianlonggang a3cb8a45ad chore(config): 标准化所有微服务的 application.yml 格式
- 统一 health-consultation、health-emergency、health-watch、health-system 四个模块的配置文件格式
- 规范 YAML 缩进和空行,提升配置文件可读性
- 保持配置内容不变,仅调整格式排版
2026-03-04 09:27:40 +08:00
lianlonggang fb5f142127 chore(deps): 移除达梦数据库 JDBC 驱动依赖并优化配置
- 删除 DmJdbcDriver8.jar 驱动文件
- 排除 QuartzAutoConfiguration 自动配置
- 统一规范 POM 文件格式和依赖管理
- 优化项目构建配置
2026-03-03 17:57:32 +08:00
wanghao 2c0d684079 信创改造 2026-03-02 15:13:07 +08:00
88 changed files with 712 additions and 473 deletions
@@ -0,0 +1,100 @@
DROP TABLE "20250917_CARE";
DROP TABLE "ARC_ASSESS_VALUE";
DROP TABLE "ARC_FOOD_ATLAS";
DROP TABLE "ARC_QUESTIONNAIRE";
DROP TABLE "ARC_QUESTIONNAIRE_CHILD";
DROP TABLE "CESHI_NOTE";
DROP TABLE "COMMON_EXPORTS_INFO_QH";
DROP TABLE "COMMON_EXPORTS_ITEM_QH";
DROP TABLE "COMMON_IMPORTS_DETAIL_QH";
DROP TABLE "COMMON_IMPORTS_QH";
DROP TABLE "CON_COST_STATISTICS";
DROP TABLE "CON_DEPARTMENT";
DROP TABLE "CON_DOCTOR_FOLLOW";
DROP TABLE "CON_DOCTOR_SCHEDULING";
DROP TABLE "CON_DOCTOR_SCHEDULING_DATE";
DROP TABLE "CON_EVALUATE";
DROP TABLE "CON_FAMILY_MEMBERS";
DROP TABLE "CON_HEALTH_INFO";
DROP TABLE "CON_HEALTH_INFO_ANSWER";
DROP TABLE "CON_HOSPITAL_FOLLOW";
DROP TABLE "CON_KNOWLEDGE";
DROP TABLE "CON_KNOWLEDGE_CATEGORY";
DROP TABLE "CON_MEDICAL_RECORDS";
DROP TABLE "CON_SESSION_RESERVATION_DATE";
DROP TABLE "DEMO";
DROP TABLE "DEMO_FIELD_DEF_VAL_MAIN";
DROP TABLE "DEMO_FIELD_DEF_VAL_SUB";
DROP TABLE "EMERGENCY_SERIOUS_DISEASE";
DROP TABLE "HEALTH_CLASSIFICATION";
DROP TABLE "HEALTH_USER_EMPLOYEE_EX_QH";
DROP TABLE "JEECG_MONTHLY_GROWTH_ANALYSIS";
DROP TABLE "JEECG_ORDER_CUSTOMER";
DROP TABLE "JEECG_ORDER_MAIN";
DROP TABLE "JEECG_ORDER_TICKET";
DROP TABLE "JEECG_PROJECT_NATURE_INCOME";
DROP TABLE "JIMU_DICT";
DROP TABLE "JIMU_DICT_ITEM";
DROP TABLE "JIMU_REPORT";
DROP TABLE "JIMU_REPORT_DATA_SOURCE";
DROP TABLE "JIMU_REPORT_DB";
DROP TABLE "JIMU_REPORT_DB_FIELD";
DROP TABLE "JIMU_REPORT_DB_PARAM";
DROP TABLE "JIMU_REPORT_LINK";
DROP TABLE "JIMU_REPORT_MAP";
DROP TABLE "JIMU_REPORT_SHARE";
DROP TABLE "JOA_DEMO";
DROP TABLE "LORE_CHECK_SUBJECT";
DROP TABLE "ONL_AUTH_DATA";
DROP TABLE "ONL_AUTH_PAGE";
DROP TABLE "ONL_AUTH_RELATION";
DROP TABLE "ONL_CGFORM_BUTTON";
DROP TABLE "ONL_CGFORM_ENHANCE_JAVA";
DROP TABLE "ONL_CGFORM_ENHANCE_JS";
DROP TABLE "ONL_CGFORM_ENHANCE_SQL";
DROP TABLE "ONL_CGFORM_FIELD";
DROP TABLE "ONL_CGFORM_HEAD";
DROP TABLE "ONL_CGFORM_INDEX";
DROP TABLE "ONL_CGREPORT_HEAD";
DROP TABLE "ONL_CGREPORT_ITEM";
DROP TABLE "ONL_CGREPORT_PARAM";
DROP TABLE "OSS_FILE";
DROP TABLE "QRTZ_BLOB_TRIGGERS";
DROP TABLE "QRTZ_CALENDARS";
DROP TABLE "QRTZ_CRON_TRIGGERS";
DROP TABLE "QRTZ_FIRED_TRIGGERS";
DROP TABLE "QRTZ_JOB_DETAILS" CASCADE;
DROP TABLE "QRTZ_LOCKS";
DROP TABLE "QRTZ_PAUSED_TRIGGER_GRPS";
DROP TABLE "QRTZ_SCHEDULER_STATE";
DROP TABLE "QRTZ_SIMPLE_TRIGGERS";
DROP TABLE "QRTZ_SIMPROP_TRIGGERS";
DROP TABLE "QRTZ_TRIGGERS";
DROP TABLE "REP_DEMO_DXTJ";
DROP TABLE "REP_DEMO_EMPLOYEE";
DROP TABLE "REP_DEMO_GONGSI";
DROP TABLE "REP_DEMO_JIANPIAO";
DROP TABLE "SYS_APP_VERSION_QH";
DROP TABLE "SYS_DEPART_GPS_QH";
DROP TABLE "SYS_DEPART_QH";
DROP TABLE "SYS_LOG_QH";
DROP TABLE "SYS_PERMISSION_20241224";
DROP TABLE "SYS_PERMISSION_DATA_RULE_QH";
DROP TABLE "SYS_PERMISSION_QH";
DROP TABLE "SYS_ROLE_INDEX_QH";
DROP TABLE "SYS_ROLE_PERMISSION_QH";
DROP TABLE "SYS_ROLE_QH";
DROP TABLE "SYS_USER_DEPART_CHANGE_APPLY_QH";
DROP TABLE "SYS_USER_DEPART_QH";
DROP TABLE "SYS_USER_QH";
DROP TABLE "SYS_USER_ROLE_QH";
DROP TABLE "TEST_DEMO";
DROP TABLE "TEST_ENHANCE_SELECT";
DROP TABLE "TEST_NOTE";
DROP TABLE "TEST_ORDER_CUSTOMER";
DROP TABLE "TEST_ORDER_MAIN";
DROP TABLE "TEST_ORDER_PRODUCT";
DROP TABLE "TEST_SHOPTYPE_TREE";
DROP TABLE "TEST_V3_HELLO";
DROP TABLE "TMP_REPORT_DATA_1";
DROP TABLE "TMP_REPORT_DATA_INCOME";
@@ -30,10 +30,6 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId> <artifactId>spring-boot-starter-validation</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId> <artifactId>spring-boot-configuration-processor</artifactId>
@@ -25,6 +25,7 @@ import org.springframework.core.task.TaskExecutor;
import org.springframework.jdbc.support.JdbcTransactionManager; import org.springframework.jdbc.support.JdbcTransactionManager;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.util.StringUtils;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.util.List; import java.util.List;
@@ -125,8 +126,21 @@ public class BatchAutoConfiguration {
@BatchDataSource ObjectProvider<DataSource> batchDataSource, @BatchDataSource ObjectProvider<DataSource> batchDataSource,
BatchProperties properties BatchProperties properties
) { ) {
return new BatchDataSourceScriptDatabaseInitializer(batchDataSource.getIfAvailable(() -> dataSource), DataSource dataSourceToUse = batchDataSource.getIfAvailable(() -> dataSource);
properties.getJdbc()); BatchProperties.Jdbc jdbc = properties.getJdbc();
// 达梦数据库兼容处理:设置platform绕过构造器中的自动类型检测
if (!StringUtils.hasText(jdbc.getPlatform())) {
jdbc.setPlatform("dm");
}
// 重写afterPropertiesSet()跳过SQL脚本初始化:
// 父类会先断言SQL文件存在再检查initializeSchema mode,导致找不到schema-dm.sql时报错
// Batch元数据表已通过数据迁移创建,无需自动建表
return new BatchDataSourceScriptDatabaseInitializer(dataSourceToUse, jdbc) {
@Override
public void afterPropertiesSet() {
// 跳过Batch元数据表的自动建表,防止找不到schema-dm.sql文件报错
}
};
} }
} }
@@ -34,6 +34,13 @@ public class CustomBatchConfigurer extends BasicBatchConfigurer {
this.taskExecutor = taskExecutor; this.taskExecutor = taskExecutor;
} }
@Override
public void initialize() {
// 达梦数据库兼容处理:跳过Spring Batch数据库类型自动检测
// BasicBatchConfigurer.initialize()中DatabaseType.fromProductName()无法识别"DM DBMS"产品名
// 保持父类默认隔离级别ISOLATION_SERIALIZABLEDM8与此兼容
}
@Override @Override
protected JobLauncher createJobLauncher() throws Exception { protected JobLauncher createJobLauncher() throws Exception {
SimpleJobLauncher jobLauncher = new SimpleJobLauncher(); SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
@@ -11,19 +11,18 @@
a.icon, a.icon,
a.points, a.points,
CASE CASE
WHEN a.frequency = 1 THEN -- 单次 WHEN a.frequency = 1 THEN
IF(COUNT(b.id) > 0, 1, 0) CASE WHEN COUNT(b.id) > 0 THEN 1 ELSE 0 END
WHEN a.frequency = 2 THEN -- 日/次 WHEN a.frequency = 2 THEN
IF(COUNT(CASE WHEN DATE(b.create_time) = CURDATE() THEN 1 END) > 0, 1, 0) CASE WHEN COUNT(CASE WHEN TRUNC(b.create_time) = TRUNC(SYSDATE) THEN 1 END) > 0 THEN 1 ELSE 0 END
WHEN a.frequency = 3 THEN -- 周/次 WHEN a.frequency = 3 THEN
IF(COUNT(CASE WHEN YEARWEEK(b.create_time, 1) = YEARWEEK(CURDATE(), 1) THEN 1 END) > 0, 1, 0) CASE WHEN COUNT(CASE WHEN TO_CHAR(b.create_time, 'IYYY-IW') = TO_CHAR(SYSDATE, 'IYYY-IW') THEN 1 END) > 0 THEN 1 ELSE 0 END
WHEN a.frequency = 4 THEN -- 月/次 WHEN a.frequency = 4 THEN
IF(COUNT(CASE WHEN DATE_FORMAT(b.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') THEN 1 END) > 0, 1, 0) CASE WHEN COUNT(CASE WHEN TO_CHAR(b.create_time, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM') THEN 1 END) > 0 THEN 1 ELSE 0 END
WHEN a.frequency = 5 THEN -- 季度/次 WHEN a.frequency = 5 THEN
IF(COUNT(CASE WHEN QUARTER(b.create_time) = QUARTER(CURDATE()) AND YEAR(b.create_time) = YEAR(CURDATE()) THEN 1 CASE WHEN COUNT(CASE WHEN TO_CHAR(b.create_time, 'Q') = TO_CHAR(SYSDATE, 'Q') AND EXTRACT(YEAR FROM b.create_time) = EXTRACT(YEAR FROM SYSDATE) THEN 1 END) > 0 THEN 1 ELSE 0 END
END) > 0, 1, 0) WHEN a.frequency = 6 THEN
WHEN a.frequency = 6 THEN -- 年/次 CASE WHEN COUNT(CASE WHEN EXTRACT(YEAR FROM b.create_time) = EXTRACT(YEAR FROM SYSDATE) THEN 1 END) > 0 THEN 1 ELSE 0 END
IF(COUNT(CASE WHEN YEAR(b.create_time) = YEAR(CURDATE()) THEN 1 END) > 0, 1, 0)
ELSE 0 ELSE 0
END AS clockInStatus END AS clockInStatus
FROM FROM
@@ -459,7 +459,7 @@ public class UserPointsServiceImpl extends ServiceImpl<UserPointsMapper, UserPoi
List<UserPointsDetails> details = userPointsDetailsMapper.selectList(new LambdaQueryWrapper<UserPointsDetails>() List<UserPointsDetails> details = userPointsDetailsMapper.selectList(new LambdaQueryWrapper<UserPointsDetails>()
.eq(UserPointsDetails::getUserId, userId) .eq(UserPointsDetails::getUserId, userId)
.eq(UserPointsDetails::getChangeType, HealthBankConstants.CHANGE_TYPE_ADD) .eq(UserPointsDetails::getChangeType, HealthBankConstants.CHANGE_TYPE_ADD)
.apply("DATE_FORMAT(create_time, '%Y-%m-%d') = {0}", DateUtil.today()) .apply("TO_CHAR(create_time, 'YYYY-MM-DD') = {0}", DateUtil.today())
); );
double sum = details.stream().map(UserPointsDetails::getPoints).mapToDouble(BigDecimal::doubleValue).sum(); double sum = details.stream().map(UserPointsDetails::getPoints).mapToDouble(BigDecimal::doubleValue).sum();
userPoints.setLatestAddDaySum(BigDecimal.valueOf(sum).add(pointsRule.getPoints())); userPoints.setLatestAddDaySum(BigDecimal.valueOf(sum).add(pointsRule.getPoints()));
@@ -77,7 +77,7 @@ public class ConSessionView implements Serializable {
@TableField(value = "medical_records_id") @TableField(value = "medical_records_id")
@Schema(description = "") @Schema(description = "")
private String medicalRecordsId; private String medicalRecordsId;
@TableField(value = "`status`") @TableField(value = "status")
@Schema(description = "") @Schema(description = "")
private Integer status; private Integer status;
@TableField(value = "del_flag") @TableField(value = "del_flag")
@@ -27,7 +27,7 @@ public interface ConDepartmentMapper extends BaseMapper<ConDepartment> , MPJBase
@Select("SELECT * FROM con_department WHERE status = '1' and del_flag = '0' and id = #{departmentId} order by tf_top desc,sort") @Select("SELECT * FROM con_department WHERE status = '1' and del_flag = '0' and id = #{departmentId} order by tf_top desc,sort")
public ConDepartment selectDepartmentNameById(String departmentId); public ConDepartment selectDepartmentNameById(String departmentId);
@Select("SELECT GROUP_CONCAT(id) FROM con_department WHERE status = '1' and del_flag = '0' and officeparid = #{departmentId}") @Select("SELECT LISTAGG(id, ',') WITHIN GROUP (ORDER BY id) FROM con_department WHERE status = '1' and del_flag = '0' and officeparid = #{departmentId}")
public String selectDepartmentIdByLevelOneId(String departmentId); public String selectDepartmentIdByLevelOneId(String departmentId);
@Select("SELECT count(1) FROM con_department WHERE status = '1' and del_flag = '0' and office_level = 1") @Select("SELECT count(1) FROM con_department WHERE status = '1' and del_flag = '0' and office_level = 1")
@@ -117,7 +117,7 @@ public interface ConDoctorMapper extends BaseMapper<ConDoctor> , MPJBaseMapper<C
*/ */
List<ConDoctor> getFreeDoctor(CondepartmentId departmentId); List<ConDoctor> getFreeDoctor(CondepartmentId departmentId);
@Select("select id,sicks_name as sicksName from con_sicks where status = 1 and del_flag = 0 and FIND_IN_SET(id,#{sickIds})") @Select("select id,sicks_name as sicksName from con_sicks where status = 1 and del_flag = 0 and INSTR(',' || #{sickIds} || ',', ',' || id || ',') > 0")
List<Map<String, String>> selectSickName(String sickIds); List<Map<String, String>> selectSickName(String sickIds);
@Select("SELECT * FROM con_doctor WHERE status = '1' AND del_flag = '0'") @Select("SELECT * FROM con_doctor WHERE status = '1' AND del_flag = '0'")
@@ -136,11 +136,11 @@ public interface ConDoctorMapper extends BaseMapper<ConDoctor> , MPJBaseMapper<C
@Update("update con_doctor set audio_status = #{audioStatus},tf_jump_holiday= #{tfJumpHoliday} WHERE status = '1' and del_flag = '0' and id = #{id}") @Update("update con_doctor set audio_status = #{audioStatus},tf_jump_holiday= #{tfJumpHoliday} WHERE status = '1' and del_flag = '0' and id = #{id}")
int updateAudioStatus(String id, String audioStatus, String tfJumpHoliday); int updateAudioStatus(String id, String audioStatus, String tfJumpHoliday);
@Select("select count(1) from con_doctor where del_flag = '0' AND status = 1 and doctor_status != 3 AND FIND_IN_SET(#{sickId},good_at_sickness)") @Select("select count(1) from con_doctor where del_flag = '0' AND status = 1 and doctor_status != 3 AND INSTR(',' || #{sickId} || ',', ',' || good_at_sickness || ',') > 0")
int selectDoctorNumBySickId(String sickId); int selectDoctorNumBySickId(String sickId);
@Select("select count(1) from con_doctor where del_flag = '0' AND status = 1 AND doctor_status != 3 AND FIND_IN_SET(department_id,#{departmentId})") @Select("select count(1) from con_doctor where del_flag = '0' AND status = 1 AND doctor_status != 3 AND INSTR(',' || #{departmentId} || ',', ',' || department_id || ',') > 0")
int selectDoctorNumByDepartmentId(String departmentId); int selectDoctorNumByDepartmentId(String departmentId);
List<ConDoctor> selectListByQuery(@Param("conDoctor") ConDoctor conDoctor); List<ConDoctor> selectListByQuery(@Param("conDoctor") ConDoctor conDoctor);
@@ -170,7 +170,7 @@ public interface ConDoctorMapper extends BaseMapper<ConDoctor> , MPJBaseMapper<C
@Select("select count(1) from con_doctor where del_flag = '0' AND status = 1 AND FIND_IN_SET(department_id,#{departmentId}) and resource_id = #{resourceId} and doctor_status != 3") @Select("select count(1) from con_doctor where del_flag = '0' AND status = 1 AND INSTR(',' || #{departmentId} || ',', ',' || department_id || ',') > 0 and resource_id = #{resourceId} and doctor_status != 3")
int selectDoctorNumByDepartmentIdAndResourceId(String departmentId,String resourceId); int selectDoctorNumByDepartmentIdAndResourceId(String departmentId,String resourceId);
@@ -20,7 +20,7 @@ public interface ConDoctorSchedulingDateMapper extends BaseMapper<ConDoctorSched
IPage<ConDoctorSchedulingDate> queryPageList(IPage<ConDoctorSchedulingDate> page, @Param("conDoctorSchedulingDate") ConDoctorSchedulingDate conDoctorSchedulingDate); IPage<ConDoctorSchedulingDate> queryPageList(IPage<ConDoctorSchedulingDate> page, @Param("conDoctorSchedulingDate") ConDoctorSchedulingDate conDoctorSchedulingDate);
@Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{doctorId} and scheduling_date >= DATE_FORMAT(SYSDATE(),'%Y-%m-%d') order by scheduling_date") @Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{doctorId} and scheduling_date >= TO_CHAR(SYSDATE,'YYYY-MM-DD') order by scheduling_date")
public List<ConDoctorSchedulingDateListDO> selectDoctorById(String doctorId); public List<ConDoctorSchedulingDateListDO> selectDoctorById(String doctorId);
@Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and id = #{id}") @Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and id = #{id}")
@@ -34,11 +34,11 @@ public interface ConDoctorSchedulingDateMapper extends BaseMapper<ConDoctorSched
public int updateScheduleAddMinus(String id); public int updateScheduleAddMinus(String id);
@Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{doctorId} and scheduling_date >= DATE_FORMAT(#{schedulingDate},'%Y-%m-%d')") @Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{doctorId} and scheduling_date >= TO_CHAR(#{schedulingDate},'YYYY-MM-DD')")
public List<ConDoctorSchedulingDateListDO> selectDoctorScheduleDateById(String doctorId, Date schedulingDate); public List<ConDoctorSchedulingDateListDO> selectDoctorScheduleDateById(String doctorId, Date schedulingDate);
@Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{userId} and scheduling_date >= DATE(NOW()) and week = #{week}") @Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{userId} and scheduling_date >= TRUNC(SYSDATE) and week = #{week}")
public List<ConDoctorSchedulingDateListDO> selectDoctorSchedulingByWeekAndUserId(String userId, String week); public List<ConDoctorSchedulingDateListDO> selectDoctorSchedulingByWeekAndUserId(String userId, String week);
@@ -46,7 +46,7 @@ public interface ConDoctorSchedulingDateMapper extends BaseMapper<ConDoctorSched
public int updateScheduleNum(String schedulingNum, String id); public int updateScheduleNum(String schedulingNum, String id);
@Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{doctorId} and scheduling_date = DATE_FORMAT(#{schedulingDate},'%Y-%m-%d') and type = #{type}") @Select("SELECT * FROM con_doctor_scheduling_date WHERE status = '1' and del_flag = '0' and user_id = #{doctorId} and scheduling_date = TO_CHAR(#{schedulingDate},'YYYY-MM-DD') and type = #{type}")
public List<ConDoctorSchedulingDateListDO> selectDoctorScheduleDate(String doctorId, Date schedulingDate, String type); public List<ConDoctorSchedulingDateListDO> selectDoctorScheduleDate(String doctorId, Date schedulingDate, String type);
Boolean insertBatchSomeColumn(@Param("list") List<ConDoctorSchedulingDate> list); Boolean insertBatchSomeColumn(@Param("list") List<ConDoctorSchedulingDate> list);
@@ -56,8 +56,8 @@ public interface ConResourceMapper extends BaseMapper<ConResource> {
List<HospitalDepartment> selectResourceInfoByDepartId(@Param("idList") List<String> idList); List<HospitalDepartment> selectResourceInfoByDepartId(@Param("idList") List<String> idList);
@Select("SELECT c.id,c.resource_name as resourceName FROM con_resource c WHERE EXISTS (SELECT 1 FROM con_doctor d WHERE c.id = d.resource_id and d.del_flag = 0 and d.`status` = 1)" + @Select("SELECT c.id,c.resource_name as resourceName FROM con_resource c WHERE EXISTS (SELECT 1 FROM con_doctor d WHERE c.id = d.resource_id and d.del_flag = 0 and d.status = 1)" +
"and c.del_flag = 0 and c.`status` = 1 ORDER BY c.tf_top DESC,c.sort") "and c.del_flag = 0 and c.status = 1 ORDER BY c.tf_top DESC,c.sort")
public List<ConResourceDO> selectHospitalListVersionTwo(); public List<ConResourceDO> selectHospitalListVersionTwo();
@@ -20,7 +20,7 @@ public interface ConServiceMapper extends BaseMapper<ConService> {
ConService selectConServiceByDoctrId(String doctorId); ConService selectConServiceByDoctrId(String doctorId);
@Select("select count(1) from con_service where service_status = 0 and doctor_id = #{doctorId} and del_flag = 0 and status = 1 and DATE_FORMAT(#{scheduleDate}, '%Y-%m-%d') >= DATE_FORMAT(start_day, '%Y-%m-%d') and DATE_FORMAT(#{scheduleDate}, '%Y-%m-%d') <= DATE_FORMAT(end_day, '%Y-%m-%d')") @Select("select count(1) from con_service where service_status = 0 and doctor_id = #{doctorId} and del_flag = 0 and status = 1 and TO_CHAR(#{scheduleDate}, 'YYYY-MM-DD') >= TO_CHAR(start_day, 'YYYY-MM-DD') and TO_CHAR(#{scheduleDate}, 'YYYY-MM-DD') <= TO_CHAR(end_day, 'YYYY-MM-DD')")
int selectConServiceByDoctrIdExist(String doctorId, Date scheduleDate); int selectConServiceByDoctrIdExist(String doctorId, Date scheduleDate);
} }
@@ -114,24 +114,24 @@ public interface ConSessionMapper extends BaseMapper<ConSession> , MPJBaseMapper
@Select("select * from con_session where im_id = #{imId} and to_account = #{toAccount} and del_flag = 0 and status = 1") @Select("select * from con_session where im_id = #{imId} and to_account = #{toAccount} and del_flag = 0 and status = 1")
ConSession selectConSessionByImId(String imId, String toAccount); ConSession selectConSessionByImId(String imId, String toAccount);
@Update("update con_session set reply_time = NOW() where im_id = #{imId}") @Update("update con_session set reply_time = SYSDATE where im_id = #{imId}")
int updateSessionReplyTime(String imId); int updateSessionReplyTime(String imId);
@Select("select * from con_session where im_id = #{imId} and del_flag = 0 and status = 1") @Select("select * from con_session where im_id = #{imId} and del_flag = 0 and status = 1")
ConSession selectConSessionByImIdOnly(String imId); ConSession selectConSessionByImIdOnly(String imId);
@Update("update con_session set content_status = 4 where TIMESTAMPDIFF(HOUR,reply_time,now()) >= 4 and content_status = 3 and content_type = 1") @Update("update con_session set content_status = 4 where (SYSDATE - CAST(reply_time AS DATE)) * 24 >= 4 and content_status = 3 and content_type = 1")
int sessionSendMessageExpire(); int sessionSendMessageExpire();
@Update("update con_session set content_status = 8 where TIMESTAMPDIFF(HOUR,create_time,now()) >= 24 and content_type = 1 and (content_status = 1 or content_status = 2)") @Update("update con_session set content_status = 8 where (SYSDATE - CAST(create_time AS DATE)) * 24 >= 24 and content_type = 1 and (content_status = 1 or content_status = 2)")
int sessionSendMessageExpireAnother(); int sessionSendMessageExpireAnother();
@Update("update con_session set content_status = 8 where DATE(NOW()) > session_date and content_type = 2 and (content_status = 1 or content_status = 2)") @Update("update con_session set content_status = 8 where TRUNC(SYSDATE) > session_date and content_type = 2 and (content_status = 1 or content_status = 2)")
int sessionSendMessageExpireVideo(); int sessionSendMessageExpireVideo();
@Update("update con_session set content_status = 4 where DATE(NOW()) > session_date and content_type = 2 and content_status = 3 ") @Update("update con_session set content_status = 4 where TRUNC(SYSDATE) > session_date and content_type = 2 and content_status = 3 ")
int sessionSendMessageExpireVideoAnother(); int sessionSendMessageExpireVideoAnother();
@Select("select * from con_session where del_flag = 0 and status = 1 and from_account = #{fromAccount} and session_type = #{sessionType} and content_status = 3 limit 1") @Select("select * from con_session where del_flag = 0 and status = 1 and from_account = #{fromAccount} and session_type = #{sessionType} and content_status = 3 limit 1")
@@ -178,7 +178,7 @@ public interface ConSessionMapper extends BaseMapper<ConSession> , MPJBaseMapper
* *
* @return * @return
*/ */
@Update("update con_session set content_status = 5 where session_type != 1 and content_status = 3 and timestampdiff(HOUR,reply_time,NOW()) >= #{expireHour} and tf_reply = 1") @Update("update con_session set content_status = 5 where session_type != 1 and content_status = 3 and (SYSDATE - CAST(reply_time AS DATE)) * 24 >= #{expireHour} and tf_reply = 1")
int changeEndUserAndProfessiorHelper(String expireHour); int changeEndUserAndProfessiorHelper(String expireHour);
/** /**
@@ -186,7 +186,7 @@ public interface ConSessionMapper extends BaseMapper<ConSession> , MPJBaseMapper
* *
* @return * @return
*/ */
@Update("update con_session set content_status = 4 where session_type = 1 and content_type = 1 and content_status = 3 and timestampdiff(HOUR,reply_time,NOW()) >= #{expireHour} and tf_reply = 1") @Update("update con_session set content_status = 4 where session_type = 1 and content_type = 1 and content_status = 3 and (SYSDATE - CAST(reply_time AS DATE)) * 24 >= #{expireHour} and tf_reply = 1")
int endSession(String expireHour); int endSession(String expireHour);
/** /**
@@ -194,7 +194,7 @@ public interface ConSessionMapper extends BaseMapper<ConSession> , MPJBaseMapper
* *
* @return * @return
*/ */
@Update("update con_session set content_status = 8 where content_type != 2 and timestampdiff(HOUR,create_time,NOW()) >= #{expireHour} and tf_reply = 0") @Update("update con_session set content_status = 8 where content_type != 2 and (SYSDATE - CAST(create_time AS DATE)) * 24 >= #{expireHour} and tf_reply = 0")
int expireMeaaage(String expireHour); int expireMeaaage(String expireHour);
@@ -244,7 +244,7 @@ public interface ConSessionMapper extends BaseMapper<ConSession> , MPJBaseMapper
ConSession selectConSessionByImIdOnlyBackUp(String imId); ConSession selectConSessionByImIdOnlyBackUp(String imId);
@Update("update con_session_qh set reply_time = NOW() where im_id = #{imId}") @Update("update con_session_qh set reply_time = SYSDATE where im_id = #{imId}")
int updateSessionReplyTimeBackUp(String imId); int updateSessionReplyTimeBackUp(String imId);
@Update("update con_session_qh set tf_reply = 1 where id = #{id}") @Update("update con_session_qh set tf_reply = 1 where id = #{id}")
@@ -282,7 +282,7 @@ public interface ConSessionMapper extends BaseMapper<ConSession> , MPJBaseMapper
List<ConSessionDO> selectSessionListByUserIdHelperAnother(IPage<ConSessionDO> page, @Param("contentType") String contentType, @Param("state") String state, @Param("userId") String userId); List<ConSessionDO> selectSessionListByUserIdHelperAnother(IPage<ConSessionDO> page, @Param("contentType") String contentType, @Param("state") String state, @Param("userId") String userId);
@Select("select * from con_session where session_type = 1 and content_type = 1 and content_status = 3 and timestampdiff(HOUR,reply_time,NOW()) >= #{expireHour} and tf_reply = 1") @Select("select * from con_session where session_type = 1 and content_type = 1 and content_status = 3 and (SYSDATE - CAST(reply_time AS DATE)) * 24 >= #{expireHour} and tf_reply = 1")
List<ConSession> selectEndSession(String expireHour); List<ConSession> selectEndSession(String expireHour);
@@ -55,11 +55,11 @@ public interface ConSicksMapper extends BaseMapper<ConSicks> {
List<ConSicks> selectListByIdList(@Param("idList") List<String> idList); List<ConSicks> selectListByIdList(@Param("idList") List<String> idList);
@Select("select count(1) from con_sicks where del_flag = 0 and status = 1 and FIND_IN_SET(department_id,#{departmentId})") @Select("select count(1) from con_sicks where del_flag = 0 and status = 1 and INSTR(',' || #{departmentId} || ',', ',' || department_id || ',') > 0")
int selectSickNumByDepartment(String departmentId); int selectSickNumByDepartment(String departmentId);
@Select("select id from con_sicks where del_flag = 0 and status = 1 and FIND_IN_SET(department_id,#{departmentId})") @Select("select id from con_sicks where del_flag = 0 and status = 1 and INSTR(',' || #{departmentId} || ',', ',' || department_id || ',') > 0")
List<String> selectSickNumByDepartmentByDepartment(String departmentId); List<String> selectSickNumByDepartmentByDepartment(String departmentId);
@@ -71,11 +71,11 @@ public interface ConSicksMapper extends BaseMapper<ConSicks> {
List<ConSicks> selectSickByTopAndHaveDoctor(); List<ConSicks> selectSickByTopAndHaveDoctor();
@Select("select id,department_id as departmentId,sicks_name as sicksName,descript from con_sicks where del_flag = 0 and status = 1 and FIND_IN_SET(department_id,#{departmentId}) order by tf_top desc,sort") @Select("select id,department_id as departmentId,sicks_name as sicksName,descript from con_sicks where del_flag = 0 and status = 1 and INSTR(',' || #{departmentId} || ',', ',' || department_id || ',') > 0 order by tf_top desc,sort")
List<ConSicksDO> selectSickListByDepartment(String departmentId); List<ConSicksDO> selectSickListByDepartment(String departmentId);
@Select("select GROUP_CONCAT(id) from con_sicks where department_id = #{departmentId}") @Select("select LISTAGG(id, ',') WITHIN GROUP (ORDER BY id) from con_sicks where department_id = #{departmentId}")
String selectSickListByDepartmentIdAnother(String departmentId); String selectSickListByDepartmentIdAnother(String departmentId);
@Update("update con_sicks set department_id = #{departmentOne} where department_id = #{departmentTwo}") @Update("update con_sicks set department_id = #{departmentOne} where department_id = #{departmentTwo}")
@@ -73,7 +73,7 @@
and cct.operate_type = '5' and cct.operate_type = '5'
</if> </if>
<if test='date != "1"'> <if test='date != "1"'>
and DATE_FORMAT(cct.income_time, '%Y-%m')=#{date} and TO_CHAR(cct.income_time, 'YYYY-MM')=#{date}
</if> </if>
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and cct.user_id = #{userId} and cct.user_id = #{userId}
@@ -87,8 +87,8 @@
FROM con_session cs FROM con_session cs
where cs.content_type is not null where cs.content_type is not null
and cs.content_type &lt;&gt; '4' and cs.content_type &lt;&gt; '4'
and DATE_FORMAT(cs.create_time, '%Y-%m') = #{date} and TO_CHAR(cs.create_time, 'YYYY-MM') = #{date}
group by cs.content_type, DATE_FORMAT(cs.create_time, '%Y-%m') group by cs.content_type, TO_CHAR(cs.create_time, 'YYYY-MM')
</select> </select>
@@ -99,7 +99,7 @@
and cs.content_type &lt;&gt; '4' and cs.content_type &lt;&gt; '4'
and cs.to_account = #{userId} and session_type = 1 and cs.to_account = #{userId} and session_type = 1
<if test="date != null and date != ''"> <if test="date != null and date != ''">
and DATE_FORMAT(cs.create_time, '%Y-%m') = #{date} and TO_CHAR(cs.create_time, 'YYYY-MM') = #{date}
</if> </if>
group by cs.content_type, session_status group by cs.content_type, session_status
</select> </select>
@@ -108,7 +108,7 @@
from con_cost_statistics ccs from con_cost_statistics ccs
<where> <where>
<if test='conCostStatistics.startDate != null and conCostStatistics.endDate != null'> <if test='conCostStatistics.startDate != null and conCostStatistics.endDate != null'>
and ccs.income_time between DATE_FORMAT(#{conCostStatistics.startDate}, '%Y-%m-%d 00:00:00') and DATE_FORMAT(#{conCostStatistics.endDate}, '%Y-%m-%d 23:59:59') and ccs.income_time between TRUNC(#{conCostStatistics.startDate}) and TRUNC(#{conCostStatistics.endDate}) + 1 - 1/86400
</if> </if>
<if test='conCostStatistics.operateType != null and conCostStatistics.operateType != "" and conCostStatistics.operateType == "0"'> <if test='conCostStatistics.operateType != null and conCostStatistics.operateType != "" and conCostStatistics.operateType == "0"'>
and ccs.operate_type != '5' and ccs.operate_type != '5'
@@ -172,7 +172,7 @@
and content_status &gt; 3 and content_status &gt; 3
</if> </if>
<if test="date != null and date != ''"> <if test="date != null and date != ''">
and DATE_FORMAT(create_time, '%Y-%m') = #{date} and TO_CHAR(create_time, 'YYYY-MM') = #{date}
</if> </if>
</select> </select>
<select id="selectByDoctorIds" resultType="com.renkang.consultation.entity.ConCostStatistics"> <select id="selectByDoctorIds" resultType="com.renkang.consultation.entity.ConCostStatistics">
@@ -74,7 +74,7 @@
where status = 1 where status = 1
and del_flag = 0 and del_flag = 0
<if test="officeparid == null"> <if test="officeparid == null">
and ifnull(officeparid,'') = '' and NVL(officeparid,'') = ''
</if> </if>
<if test="officeparid != null"> <if test="officeparid != null">
and officeparid = #{officeparid} and officeparid = #{officeparid}
@@ -97,25 +97,16 @@
order by tf_top desc, sort order by tf_top desc, sort
</select> </select>
<select id="selectChildAll" resultType="com.renkang.consultation.entity.ConDepartment"> <select id="selectChildAll" resultType="com.renkang.consultation.entity.ConDepartment">
SELECT * SELECT * FROM con_department
FROM ( WHERE id != #{departmentId}
SELECT d1.*, START WITH id = #{departmentId}
@pv := CONCAT(@pv, ',', d1.id) AS path CONNECT BY PRIOR id = officeparid
FROM ORDER BY LEVEL, id
con_department AS d1
JOIN
(SELECT @pv := #{departmentId}) AS initial
WHERE
FIND_IN_SET(d1.officeparid
, @pv)
> 0
) AS subquery
ORDER BY LENGTH(path)
</select> </select>
<select id="getOneDepartList" resultType="com.renkang.consultation.entity.ConDepartment"> <select id="getOneDepartList" resultType="com.renkang.consultation.entity.ConDepartment">
SELECT * SELECT *
FROM `con_department` FROM con_department
WHERE office_level = 1 WHERE office_level = 1
and del_flag = 0 and del_flag = 0
and status = 1 and status = 1
@@ -123,7 +114,7 @@
<select id="getTwoDepartList" resultType="com.renkang.consultation.entity.ConDepartment"> <select id="getTwoDepartList" resultType="com.renkang.consultation.entity.ConDepartment">
SELECT * SELECT *
FROM `con_department` FROM con_department
WHERE office_level = 2 WHERE office_level = 2
and del_flag = 0 and del_flag = 0
and status = 1 and status = 1
@@ -133,10 +124,10 @@
SELECT * SELECT *
from con_doctor from con_doctor
where department_id in where department_id in
(SELECT id FROM `con_department` WHERE office_level in (1, 2) and del_flag = 0 and status = 1) (SELECT id FROM con_department WHERE office_level in (1, 2) and del_flag = 0 and status = 1)
and del_flag = 0 and del_flag = 0
and status = 1 and status = 1
ORDER BY doctor_status DESC; ORDER BY doctor_status DESC
</select> </select>
<select id="selectChildById" resultType="com.renkang.consultation.entity.ConDepartment"> <select id="selectChildById" resultType="com.renkang.consultation.entity.ConDepartment">
@@ -174,7 +165,7 @@
(case when (select count(1) from con_department cd2 where cd2.officeparid = cdd.id)>0 then 0 else 1 end) as isLeaf, (case when (select count(1) from con_department cd2 where cd2.officeparid = cdd.id)>0 then 0 else 1 end) as isLeaf,
officeparid as parentId officeparid as parentId
from con_department cdd from con_department cdd
where if(officeparid is null or officeparid = '','0',officeparid) = #{pid} where CASE WHEN (officeparid IS NULL OR officeparid = '') THEN '0' ELSE officeparid END = #{pid}
</select> </select>
@@ -2,31 +2,31 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.renkang.consultation.mapper.ConHelperSchedulingHistoryMapper"> <mapper namespace="com.renkang.consultation.mapper.ConHelperSchedulingHistoryMapper">
<select id="queryPageList" resultType="com.renkang.consultation.entity.ConHelperSchedulingHistory"> <select id="queryPageList" resultType="com.renkang.consultation.entity.ConHelperSchedulingHistory">
select `time` from con_helper_scheduling_history select "time" from con_helper_scheduling_history
<where> <where>
<if test="dto.startTime != null and dto.startTime!='' and dto.endTime != null and dto.endTime != ''"> <if test="dto.startTime != null and dto.startTime!='' and dto.endTime != null and dto.endTime != ''">
and `time` &gt;= #{dto.startTime} and `time` &lt;= #{dto.endTime} and "time" &gt;= #{dto.startTime} and "time" &lt;= #{dto.endTime}
</if> </if>
<if test="dto.week != null and dto.week!=''"> <if test="dto.week != null and dto.week!=''">
and week = #{dto.week} and week = #{dto.week}
</if> </if>
and status = 1 and del_flag = 0 GROUP BY `time` order by `time` desc and status = 1 and del_flag = 0 GROUP BY "time" order by "time" desc
</where> </where>
</select> </select>
<select id="pageByScheduleTime" resultType="java.lang.String"> <select id="pageByScheduleTime" resultType="java.lang.String">
SELECT DATE_FORMAT(time, '%Y-%m-%d') AS `time` FROM con_helper_scheduling_history SELECT TO_CHAR("time", 'YYYY-MM-DD') AS scheduleTime FROM con_helper_scheduling_history
<where> <where>
<!-- 日期范围条件 --> <!-- 日期范围条件 -->
<if test="dto.startTime != null and dto.startTime != ''"> <if test="dto.startTime != null and dto.startTime != ''">
AND `time` &gt;= DATE_FORMAT(#{dto.startTime}, '%Y-%m-%d 00:00:00') AND "time" &gt;= TO_DATE(#{dto.startTime}, 'YYYY-MM-DD HH24:MI:SS')
</if> </if>
<if test="dto.endTime != null and dto.endTime != ''"> <if test="dto.endTime != null and dto.endTime != ''">
AND `time` &lt;= DATE_FORMAT(#{dto.endTime}, '%Y-%m-%d 23:59:59') AND "time" &lt;= TO_DATE(#{dto.endTime}, 'YYYY-MM-DD HH24:MI:SS')
</if> </if>
<if test="dto.week != null and dto.week != ''"> <if test="dto.week != null and dto.week != ''">
and week = #{dto.week} and week = #{dto.week}
</if> </if>
and status = 1 and del_flag = 0 GROUP BY `time` order by `time` desc and status = 1 and del_flag = 0 GROUP BY "time" order by "time" desc
</where> </where>
</select> </select>
</mapper> </mapper>
@@ -21,7 +21,7 @@
AND cr.address LIKE CONCAT('%', #{conResource.province}, '%') AND cr.address LIKE CONCAT('%', #{conResource.province}, '%')
</if> </if>
<if test="conResource.level != null and conResource.level != ''"> <if test="conResource.level != null and conResource.level != ''">
AND cr.`level` = #{conResource.level} AND cr."level" = #{conResource.level}
</if> </if>
<if test="conResource.status != null and conResource.status != ''"> <if test="conResource.status != null and conResource.status != ''">
AND cr.status = #{conResource.status} AND cr.status = #{conResource.status}
@@ -42,7 +42,7 @@
</select> </select>
<select id="selectHostitalList" resultType="com.renkang.consultation.vo.ConsultResourceVO"> <select id="selectHostitalList" resultType="com.renkang.consultation.vo.ConsultResourceVO">
select id, select id,
`resource_name` as `name` resource_name as name
from con_resource from con_resource
where del_flag = 0 where del_flag = 0
order by sort order by sort
@@ -542,8 +542,8 @@
<foreach item="id" collection="doctorIds" open="(" separator="," close=")"> <foreach item="id" collection="doctorIds" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
AND YEAR(session_date) = YEAR(CURRENT_DATE()) AND EXTRACT(YEAR FROM session_date) = EXTRACT(YEAR FROM SYSDATE)
AND MONTH(session_date) = MONTH(CURRENT_DATE()) AND EXTRACT(MONTH FROM session_date) = EXTRACT(MONTH FROM SYSDATE)
</select> </select>
@@ -667,10 +667,10 @@
<!-- 日期范围条件 --> <!-- 日期范围条件 -->
<if test="conSession.startDate != null and conSession.startDate != ''"> <if test="conSession.startDate != null and conSession.startDate != ''">
AND c.create_time &gt;= DATE_FORMAT(#{conSession.startDate}, '%Y-%m-%d 00:00:00') AND c.create_time &gt;= TRUNC(#{conSession.startDate})
</if> </if>
<if test="conSession.endDate != null and conSession.endDate != ''"> <if test="conSession.endDate != null and conSession.endDate != ''">
AND c.create_time &lt;= DATE_FORMAT(#{conSession.endDate}, '%Y-%m-%d 23:59:59') AND c.create_time &lt;= TRUNC(#{conSession.endDate}) + 1 - 1/86400
</if> </if>
<!-- ID 和账户条件 --> <!-- ID 和账户条件 -->
@@ -1,8 +1,9 @@
PROFILE_NAME=dev PROFILE_NAME=dev
SERVER_PORT=7010 SERVER_PORT=7010
NACOS_SERVER_ADDR=localhost:8848 NACOS_SERVER_ADDR=192.168.1.80:8848
NACOS_USERNAME=nacos NACOS_USERNAME=xjuser
NACOS_PASSWORD=nacos NACOS_PASSWORD=Aa135790!123
NACOS_NAMESPACE=f3f65fb2-303b-4bf7-bccb-4755886503c1 NACOS_NAMESPACE=xjxc-space-common
NACOS_NAMESPACE_DISCOVERY=xjxc-space-common
NACOS_GROUP=dev NACOS_GROUP=dev
FILE_SERVER_URL=http://fileserver.yg.dt.io FILE_SERVER_URL=http://fileserver.yg.dt.io
@@ -21,7 +21,7 @@ spring:
password: ${spring.cloud.nacos.password} password: ${spring.cloud.nacos.password}
discovery: discovery:
enabled: true enabled: true
namespace: ${NACOS_NAMESPACE:} namespace: ${NACOS_NAMESPACE_DISCOVERY:}
group: ${NACOS_GROUP:DEFAULT_GROUP} group: ${NACOS_GROUP:DEFAULT_GROUP}
server-addr: ${spring.cloud.nacos.server-addr} server-addr: ${spring.cloud.nacos.server-addr}
username: ${spring.cloud.nacos.username} username: ${spring.cloud.nacos.username}
@@ -345,6 +345,7 @@ public class AedEquipmentManger implements Serializable {
*/ */
@Excel(name = "型号", width = 15) @Excel(name = "型号", width = 15)
@Schema(title = "型号") @Schema(title = "型号")
@TableField("MODEL_NUMBER")
private String model; private String model;
/** /**
* 来源字典 设备类型 1:立式 ,2:挂式,3:车载 * 来源字典 设备类型 1:立式 ,2:挂式,3:车载
@@ -1,5 +1,6 @@
package com.renkang.emergency.entity; package com.renkang.emergency.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@@ -81,12 +82,14 @@ public class TblQimoNotice implements Serializable {
*/ */
@Schema(title = "通话接通时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @Schema(title = "通话接通时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@Excel(name = "通话接通时间", width = 15, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "通话接通时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@TableField("beginTime")
private java.util.Date begin; private java.util.Date begin;
/** /**
* 通话结束时间 * 通话结束时间
*/ */
@Schema(title = "通话结束时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED) @Schema(title = "通话结束时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@Excel(name = "通话结束时间", width = 15, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "通话结束时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
@TableField("endTime")
private java.util.Date end; private java.util.Date end;
/** /**
* 来电进入技能组时间 * 来电进入技能组时间
@@ -59,7 +59,7 @@ public interface AedEquipmentMangerMapper extends BaseMapper<AedEquipmentManger>
* 按单位统计aed设备数量 * 按单位统计aed设备数量
* @return 统计数据 * @return 统计数据
*/ */
@Select(value = "SELECT LEFT(depart_code,6) as orgCode, count(1) as aedCount FROM `aed_equipment_manger` where del_flag = 0 GROUP BY LEFT(depart_code,6)") @Select(value = "SELECT LEFT(depart_code,6) as orgCode, count(1) as aedCount FROM aed_equipment_manger where del_flag = 0 GROUP BY LEFT(depart_code,6)")
List<JSONObject> statisticAedByOrgCode(); List<JSONObject> statisticAedByOrgCode();
List<AedLocationEquipment> getLocation(@Param("idList") List<Long> idList); List<AedLocationEquipment> getLocation(@Param("idList") List<Long> idList);
@@ -25,7 +25,6 @@
operate_instruction as operateInstruction, operate_instruction as operateInstruction,
operate_video as operateVideo, operate_video as operateVideo,
disclaimer as disclaimer, disclaimer as disclaimer,
control_org_name as controlOrgName,
manage_user_name as manageUserName, manage_user_name as manageUserName,
manage_user_mobile as manageUserMobile, manage_user_mobile as manageUserMobile,
mfrs_Mobile as mfrsMobile, mfrs_Mobile as mfrsMobile,
@@ -6,11 +6,11 @@
SELECT t1.user_id as userId, SELECT t1.user_id as userId,
t3.realname as userName, t3.realname as userName,
t3.type as userType t3.type as userType
FROM `emergency_schedules_new_item` t1 FROM emergency_schedules_new_item t1
LEFT JOIN emergency_new_schedules t2 ON t1.schedules_id = t2.id LEFT JOIN emergency_new_schedules t2 ON t1.schedules_id = t2.id
left join emergency_profession_user t3 on t1.user_id = t3.user_id left join emergency_profession_user t3 on t1.user_id = t3.user_id
WHERE t2.center_id = #{centerId} WHERE t2.center_id = #{centerId}
AND date_format(t2.schedules_time, '%Y-%m-%d') = #{time} AND TO_CHAR(t2.schedules_time, 'YYYY-MM-DD') = #{time}
ORDER BY ORDER BY
t3.type, t3.type,
t1.sort t1.sort
@@ -11,7 +11,7 @@
WHERE operation_user_id is not null WHERE operation_user_id is not null
and operation_user_id != '' and operation_user_id != ''
and session_now = 1 and session_now = 1
and DATE_FORMAT(create_time, '%Y-%m-%d') = #{targetDateStr} and TO_CHAR(create_time, 'YYYY-MM-DD') = #{targetDateStr}
GROUP BY GROUP BY
operation_user_id operation_user_id
</select> </select>
@@ -26,7 +26,7 @@
WHERE major_user_id is not null WHERE major_user_id is not null
and major_user_id != '' and major_user_id != ''
and session_now = 1 and session_now = 1
and DATE_FORMAT(create_time, '%Y-%m-%d') = #{targetDateStr} and TO_CHAR(create_time, 'YYYY-MM-DD') = #{targetDateStr}
GROUP BY GROUP BY
major_user_id major_user_id
</select> </select>
@@ -58,7 +58,7 @@
</foreach> </foreach>
</if> </if>
<if test="type != null and type != '' and '0'.toString().equals(type)"> <if test="type != null and type != '' and '0'.toString().equals(type)">
AND year(create_time) = year(now()) AND EXTRACT(YEAR FROM create_time) = EXTRACT(YEAR FROM SYSDATE)
</if> </if>
</where> </where>
GROUP BY center_id GROUP BY center_id
@@ -11,7 +11,7 @@
and type = #{amOrPm} and type = #{amOrPm}
</if> </if>
<if test="date != null and date != ''"> <if test="date != null and date != ''">
and DATE_FORMAT(schedule_time, '%Y-%m-%d') = #{date} and TO_CHAR(schedule_time, 'YYYY-MM-DD') = #{date}
</if> </if>
and status = 1 and status = 1
and del_flag = 0 and del_flag = 0
@@ -30,7 +30,7 @@
user_sex user_sex
FROM emergency_schedule_custom FROM emergency_schedule_custom
WHERE user_id = #{userId} WHERE user_id = #{userId}
AND YEAR (schedule_time) = #{year} AND EXTRACT(YEAR FROM schedule_time) = #{year}
AND MONTH (schedule_time) = #{month} AND EXTRACT(MONTH FROM schedule_time) = #{month}
</select> </select>
</mapper> </mapper>
@@ -11,7 +11,7 @@
and type = #{amOrPm} and type = #{amOrPm}
</if> </if>
<if test="date != null and date != ''"> <if test="date != null and date != ''">
and DATE_FORMAT(schedule_time, '%Y-%m-%d') = #{date} and TO_CHAR(schedule_time, 'YYYY-MM-DD') = #{date}
</if> </if>
</where> </where>
GROUP BY GROUP BY
@@ -22,16 +22,16 @@
<select id="scheduleRecord" resultType="com.renkang.emergency.entity.ScheduleRecord"> <select id="scheduleRecord" resultType="com.renkang.emergency.entity.ScheduleRecord">
SELECT SELECT
id,schedule_time,type,user_type,user_name,user_id,user_sex, id,schedule_time,type,user_type,user_name,user_id,user_sex,
MONTH(schedule_time) AS month, EXTRACT(MONTH FROM schedule_time) AS month,
DAY(schedule_time) AS day EXTRACT(DAY FROM schedule_time) AS day
FROM FROM
emergency_schedule_record emergency_schedule_record
<where> <where>
<if test="year != null and year != ''"> <if test="year != null and year != ''">
and YEAR (schedule_time) = #{year} and EXTRACT(YEAR FROM schedule_time) = #{year}
</if> </if>
<if test="month != null and month != ''"> <if test="month != null and month != ''">
and MONTH(schedule_time) = #{month} and EXTRACT(MONTH FROM schedule_time) = #{month}
</if> </if>
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and user_id = #{userId} and user_id = #{userId}
@@ -3,27 +3,27 @@
<mapper namespace="com.renkang.emergency.mapper.TblBaseHospitalMapper"> <mapper namespace="com.renkang.emergency.mapper.TblBaseHospitalMapper">
<select id="getHospitalList" resultType="com.renkang.emergency.entity.TblBaseHospitalVo"> <select id="getHospitalList" resultType="com.renkang.emergency.entity.TblBaseHospitalVo">
SELECT id,`name`,latitude lat ,longitude lon,`type` SELECT id,name,latitude lat ,longitude lon,type
FROM emergency_resource FROM emergency_resource
WHERE 1 = 1 and del_flag = 0 WHERE 1 = 1 and del_flag = 0
<if test="type != null and type.length() > 0"> <if test="type != null and type.length() > 0">
AND `type` = #{type} AND type = #{type}
</if> </if>
<if test="hospitalName != null and hospitalName.length() > 0"> <if test="hospitalName != null and hospitalName.length() > 0">
AND `name` LIKE CONCAT('%', #{hospitalName}, '%') AND name LIKE CONCAT('%', #{hospitalName}, '%')
</if> </if>
ORDER BY id ORDER BY id
</select> </select>
<select id="getHospitalListNew" resultType="com.renkang.emergency.entity.TblBaseHospitalVo"> <select id="getHospitalListNew" resultType="com.renkang.emergency.entity.TblBaseHospitalVo">
SELECT id,`name`,latitude lat ,longitude lon,`type` SELECT id,name,latitude lat ,longitude lon,type
FROM emergency_resource FROM emergency_resource
WHERE 1 = 1 and del_flag = 0 and type != 3 WHERE 1 = 1 and del_flag = 0 and type != 3
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND `type` = #{type} AND type = #{type}
</if> </if>
<if test="hospitalName != null and hospitalName.length() > 0"> <if test="hospitalName != null and hospitalName.length() > 0">
AND `name` LIKE CONCAT('%', #{hospitalName}, '%') AND name LIKE CONCAT('%', #{hospitalName}, '%')
</if> </if>
ORDER BY id ORDER BY id
</select> </select>
@@ -15,13 +15,13 @@
) AS sub_query ) AS sub_query
<where> <where>
<if test="condition != null and condition != '' and condition == 2"> <if test="condition != null and condition != '' and condition == 2">
YEAR(help_time) = YEAR(NOW()) EXTRACT(YEAR FROM help_time) = EXTRACT(YEAR FROM SYSDATE)
</if> </if>
<if test="condition != null and condition != '' and condition == 3"> <if test="condition != null and condition != '' and condition == 3">
DATE_FORMAT(help_time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') TO_CHAR(help_time, 'YYYYMM') = TO_CHAR(SYSDATE, 'YYYYMM')
</if> </if>
<if test="condition != null and condition != '' and condition == 4"> <if test="condition != null and condition != '' and condition == 4">
YEARWEEK(date_format(help_time, '%Y-%m-%d')) = YEARWEEK(now()) TO_CHAR(help_time, 'IYYY-IW') = TO_CHAR(SYSDATE, 'IYYY-IW')
</if> </if>
</where> </where>
GROUP BY type GROUP BY type
@@ -9,16 +9,16 @@
<where> <where>
del_flag = 0 del_flag = 0
<if test="type != null and type == 0"> <if test="type != null and type == 0">
-- 周 -- 周(使用 ISO 年-周 比较)
AND YEARWEEK(start_time, 1) = YEARWEEK(NOW(), 1) AND TO_CHAR(start_time, 'IYYY-IW') = TO_CHAR(SYSDATE, 'IYYY-IW')
</if> </if>
<if test="type != null and type == 1"> <if test="type != null and type == 1">
-- 月 -- 月
AND DATE_FORMAT(start_time,'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m') AND TO_CHAR(start_time,'YYYYMM') = TO_CHAR(SYSDATE,'YYYYMM')
</if> </if>
<if test="type != null and type == 2"> <if test="type != null and type == 2">
-- 年 -- 年
AND YEAR(start_time) =YEAR(NOW()) AND EXTRACT(YEAR FROM start_time) = EXTRACT(YEAR FROM SYSDATE)
</if> </if>
</where> </where>
GROUP BY injury_level GROUP BY injury_level
@@ -110,13 +110,13 @@ public class TblUserHelpServiceImpl extends ServiceImpl<TblUserHelpMapper, TblUs
// 1:全部,2:年,3:月,4:周 // 1:全部,2:年,3:月,4:周
switch (dto.getCondition()) { switch (dto.getCondition()) {
case "2": case "2":
queryWrapper.apply("DATE_FORMAT(help_time,'%Y') = DATE_FORMAT(NOW(),'%Y')"); queryWrapper.apply("EXTRACT(YEAR FROM help_time) = EXTRACT(YEAR FROM SYSDATE)");
break; break;
case "3": case "3":
queryWrapper.apply("DATE_FORMAT(help_time,'%Y-%m') = DATE_FORMAT(NOW(),'%Y-%m')"); queryWrapper.apply("TO_CHAR(help_time,'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')");
break; break;
case "4": case "4":
queryWrapper.apply("YEARWEEK(date_format(help_time,'%Y-%m-%d'), 1) = YEARWEEK(now(), 1)"); queryWrapper.apply("TO_CHAR(help_time,'IYYY-IW') = TO_CHAR(SYSDATE,'IYYY-IW')");
break; break;
} }
} }
@@ -224,13 +224,13 @@ public class TblUserHelpServiceImpl extends ServiceImpl<TblUserHelpMapper, TblUs
// 1:全部,2:年,3:月,4:周 // 1:全部,2:年,3:月,4:周
switch (condition) { switch (condition) {
case "2": case "2":
queryWrapper.apply("DATE_FORMAT(help_time,'%Y') = DATE_FORMAT(NOW(),'%Y')"); queryWrapper.apply("EXTRACT(YEAR FROM help_time) = EXTRACT(YEAR FROM SYSDATE)");
break; break;
case "3": case "3":
queryWrapper.apply("DATE_FORMAT(help_time,'%Y-%m') = DATE_FORMAT(NOW(),'%Y-%m')"); queryWrapper.apply("TO_CHAR(help_time,'YYYY-MM') = TO_CHAR(SYSDATE,'YYYY-MM')");
break; break;
case "4": case "4":
queryWrapper.apply("YEARWEEK(date_format(help_time,'%Y-%m-%d')) = YEARWEEK(now())"); queryWrapper.apply("TO_CHAR(help_time,'IYYY-IW') = TO_CHAR(SYSDATE,'IYYY-IW')");
break; break;
} }
} }
@@ -2,9 +2,10 @@ package com.renkang;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication(scanBasePackages = {"com.renkang", "org.jeecg"}) @SpringBootApplication(scanBasePackages = {"com.renkang", "org.jeecg"},exclude = QuartzAutoConfiguration.class)
@EnableFeignClients(basePackages = {"org.jeecg", "com.renkang"}) @EnableFeignClients(basePackages = {"org.jeecg", "com.renkang"})
public class HealthEmergencyCloudApplication { public class HealthEmergencyCloudApplication {
@@ -1,8 +1,9 @@
PROFILE_NAME=dev PROFILE_NAME=dev
SERVER_PORT=7011 SERVER_PORT=7011
NACOS_SERVER_ADDR=localhost:8848 NACOS_SERVER_ADDR=192.168.1.80:8848
NACOS_USERNAME=nacos NACOS_USERNAME=xjuser
NACOS_PASSWORD=nacos NACOS_PASSWORD=Aa135790!123
NACOS_NAMESPACE=f3f65fb2-303b-4bf7-bccb-4755886503c1 NACOS_NAMESPACE=xjxc-space-common
NACOS_NAMESPACE_DISCOVERY=xjxc-space-common
NACOS_GROUP=dev NACOS_GROUP=dev
FILE_SERVER_URL=http://fileserver.yg.dt.io FILE_SERVER_URL=http://fileserver.yg.dt.io
@@ -21,7 +21,7 @@ spring:
password: ${spring.cloud.nacos.password} password: ${spring.cloud.nacos.password}
discovery: discovery:
enabled: true enabled: true
namespace: ${NACOS_NAMESPACE:} namespace: ${NACOS_NAMESPACE_DISCOVERY:}
group: ${NACOS_GROUP:DEFAULT_GROUP} group: ${NACOS_GROUP:DEFAULT_GROUP}
server-addr: ${spring.cloud.nacos.server-addr} server-addr: ${spring.cloud.nacos.server-addr}
username: ${spring.cloud.nacos.username} username: ${spring.cloud.nacos.username}
@@ -71,7 +71,7 @@ public class WatchDataWorkoutTrace implements Serializable {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(title = "时间戳") @Schema(title = "时间戳")
@TableField("`utc_time`") @TableField("utc_time")
private java.util.Date utcTime; private java.util.Date utcTime;
/** /**
* 数据是否合法 * 数据是否合法
@@ -66,7 +66,7 @@ public interface WatchDeviceMapper extends MPJBaseMapper<WatchDevice> {
List<String> selectDeviceUserId(@Param("deptId") String deptId); List<String> selectDeviceUserId(@Param("deptId") String deptId);
@Select(value = "SELECT LEFT(org_code,6) as orgCode, count(1) as medicalCount FROM `watch_device` GROUP BY LEFT(org_code,6)") @Select(value = "SELECT LEFT(org_code,6) as orgCode, count(1) as medicalCount FROM watch_device GROUP BY LEFT(org_code,6)")
List<JSONObject> getWatchSum(); List<JSONObject> getWatchSum();
List<WearCount> selectWearCount(@Param("orgCodeList") List<String> orgCodeList); List<WearCount> selectWearCount(@Param("orgCodeList") List<String> orgCodeList);
@@ -16,10 +16,10 @@ import java.util.Map;
@Mapper @Mapper
public interface WatchMapper { public interface WatchMapper {
@Select("SELECT DATEDIFF(NOW(), (SELECT bind_date FROM watch_bind_his WHERE bind_user_id = #{id} ORDER BY bind_date DESC limit 1)) AS days") @Select("SELECT ROUND(SYSDATE - (SELECT CAST(bind_date AS DATE) FROM watch_bind_his WHERE bind_user_id = #{id} ORDER BY bind_date DESC limit 1)) AS days")
Integer getUseDays(@Param("id") String id); Integer getUseDays(@Param("id") String id);
@Select("select length(nm.status) minutes,DATE_FORMAT(n.data_date,'%Y-%m-%d') dataDate from watch_data_sleep_new_minute nm left join watch_data_sleep_new n on nm.sleep_id = n.id where n.id = ( select id from watch_data_sleep_new WHERE bind_user_id = #{id} order by data_date desc limit 1) and nm.STATUS not like '%55%' limit 1") @Select("select length(nm.status) minutes,TO_CHAR(n.data_date,'YYYY-MM-DD') dataDate from watch_data_sleep_new_minute nm left join watch_data_sleep_new n on nm.sleep_id = n.id where n.id = ( select id from watch_data_sleep_new WHERE bind_user_id = #{id} order by data_date desc limit 1) and nm.STATUS not like '%55%' limit 1")
WatchDataDTO getDataSleep(@Param("id") String id); WatchDataDTO getDataSleep(@Param("id") String id);
/** /**
@@ -30,22 +30,22 @@ public interface WatchMapper {
@Select("SELECT long_duration_total minutes, data_date dataDate FROM watch_stat_user_info_day_sleep WHERE user_id = #{id} and long_duration_total > 0 ORDER BY data_date DESC LIMIT 1;") @Select("SELECT long_duration_total minutes, data_date dataDate FROM watch_stat_user_info_day_sleep WHERE user_id = #{id} and long_duration_total > 0 ORDER BY data_date DESC LIMIT 1;")
WatchDataDTO getDataSleepNew(@Param("id") String id); WatchDataDTO getDataSleepNew(@Param("id") String id);
@Select("SELECT AVG(TIMESTAMPDIFF(MINUTE, d.fall_asleep_time, d.wake_up_time)) AS aveMinute FROM watch_data_sleep_new_day d LEFT JOIN watch_data_sleep_new n ON d.sleep_id = n.id WHERE n.id IN (SELECT id FROM watch_data_sleep_new WHERE bind_user_id = #{id})") @Select("SELECT AVG(ROUND((CAST(d.wake_up_time AS DATE) - CAST(d.fall_asleep_time AS DATE)) * 24 * 60)) AS aveMinute FROM watch_data_sleep_new_day d LEFT JOIN watch_data_sleep_new n ON d.sleep_id = n.id WHERE n.id IN (SELECT id FROM watch_data_sleep_new WHERE bind_user_id = #{id})")
Double getAverageSleep(@Param("id") String id); Double getAverageSleep(@Param("id") String id);
@Select("select MAX(data_value) dataValue,data_date dataDate from watch_data_steps force index(bind_user_id) where bind_user_id = #{id} group by data_date order by data_date desc limit 1") @Select("select MAX(data_value) dataValue,data_date dataDate from watch_data_steps where bind_user_id = #{id} group by data_date order by data_date desc limit 1")
WatchDataDTO getDataSteps(@Param("id") String id); WatchDataDTO getDataSteps(@Param("id") String id);
@Select("SELECT SUM(data_value) FROM watch_data_distance WHERE bind_user_id = #{id}") @Select("SELECT SUM(data_value) FROM watch_data_distance WHERE bind_user_id = #{id}")
Integer getDataDistance(@Param("id") String id); Integer getDataDistance(@Param("id") String id);
@Select("SELECT CAST(data_value as SIGNED) dataValue,data_date dataDate from watch_data_heart_rate where bind_user_id = #{id} order by time_stamp desc limit 1") @Select("SELECT CAST(data_value as INTEGER) dataValue,data_date dataDate from watch_data_heart_rate where bind_user_id = #{id} order by time_stamp desc limit 1")
WatchDataDTO getHeartRate(@Param("id") String id); WatchDataDTO getHeartRate(@Param("id") String id);
@Select("SELECT CAST(data_value as SIGNED ) dataValue,data_date dataDate from watch_data_spo2 where bind_user_id = #{id} order by time_stamp desc limit 1") @Select("SELECT CAST(data_value as INTEGER) dataValue,data_date dataDate from watch_data_spo2 where bind_user_id = #{id} order by time_stamp desc limit 1")
WatchDataDTO getDataSpo2(@Param("id") String id); WatchDataDTO getDataSpo2(@Param("id") String id);
@Select("select cast(data_value as SIGNED ) dataValue,data_date dataDate from watch_data_stress where bind_user_id = #{id} order by end_time_stamp desc limit 1") @Select("select cast(data_value as INTEGER) dataValue,data_date dataDate from watch_data_stress where bind_user_id = #{id} order by end_time_stamp desc limit 1")
WatchDataDTO getStress(@Param("id") String id); WatchDataDTO getStress(@Param("id") String id);
@Select("select data_value dataValue,data_date dataDate from watch_data_temperature where bind_user_id = #{id} order by time_stamp desc limit 1") @Select("select data_value dataValue,data_date dataDate from watch_data_temperature where bind_user_id = #{id} order by time_stamp desc limit 1")
@@ -54,17 +54,17 @@ public interface WatchMapper {
@Select("SELECT * FROM watch_data_sleep_new_minute WHERE sleep_id IN (SELECT id FROM watch_data_sleep_new WHERE sleep_flag= '1' AND bind_user_id = #{id} AND data_date = #{date})") @Select("SELECT * FROM watch_data_sleep_new_minute WHERE sleep_id IN (SELECT id FROM watch_data_sleep_new WHERE sleep_flag= '1' AND bind_user_id = #{id} AND data_date = #{date})")
List<WatchDataSleepNewMinute> getNewMinuteList(@Param("id") String id, @Param("date") Date date); List<WatchDataSleepNewMinute> getNewMinuteList(@Param("id") String id, @Param("date") Date date);
@Select("SELECT DISTINCT data_date dateDate FROM watch_data_sleep_new WHERE DATE_FORMAT( data_date, '%Y-%m' ) = DATE_FORMAT(#{date}, '%Y-%m' ) AND bind_user_id = #{id} AND sleep_flag = '1'") @Select("SELECT DISTINCT data_date dateDate FROM watch_data_sleep_new WHERE TO_CHAR( data_date, 'YYYY-MM' ) = TO_CHAR(#{date}, 'YYYY-MM' ) AND bind_user_id = #{id} AND sleep_flag = '1'")
List<Date> getSleepNewDateList(@Param("id") String id, @Param("date") Date date); List<Date> getSleepNewDateList(@Param("id") String id, @Param("date") Date date);
List<Map<String, Object>> selectData(@Param("id") String id, @Param("format") String format, @Param("date") String date); List<Map<String, Object>> selectData(@Param("id") String id, @Param("format") String format, @Param("date") String date);
@Select("select max(data_value) `maxValue`,min(data_value) `minValue`,max(skin_tempera) maxSkinValue,min(skin_tempera) minSkinValue from watch_data_temperature where bind_user_id = #{id} and data_date = #{date}") @Select("select max(data_value) maxValue,min(data_value) minValue,max(skin_tempera) maxSkinValue,min(skin_tempera) minSkinValue from watch_data_temperature where bind_user_id = #{id} and data_date = #{date}")
Map<String, Object> getMapValue(@Param("id") String id, @Param("date") Date date); Map<String, Object> getMapValue(@Param("id") String id, @Param("date") Date date);
List<Map<String, Object>> getData(@Param("id") String id, @Param("format") String format, @Param("date") String date); List<Map<String, Object>> getData(@Param("id") String id, @Param("format") String format, @Param("date") String date);
@Select("select max(data_value) `maxValue`,min(data_value) `minValue` from watch_data_heart_rate where bind_user_id = #{id} and data_date = #{date}") @Select("select max(data_value) maxValue,min(data_value) minValue from watch_data_heart_rate where bind_user_id = #{id} and data_date = #{date}")
Map<String, Object> getMapRate(@Param("id") String id, @Param("date") Date date); Map<String, Object> getMapRate(@Param("id") String id, @Param("date") Date date);
Map<String, Object> getMapRateValue(@Param("id") String id, @Param("date") Date date); Map<String, Object> getMapRateValue(@Param("id") String id, @Param("date") Date date);
@@ -73,12 +73,12 @@ public interface WatchMapper {
List<Map<String, Object>> getMapDataValueFormat(@Param("id") String id, @Param("date") String date, @Param("format") String format); List<Map<String, Object>> getMapDataValueFormat(@Param("id") String id, @Param("date") String date, @Param("format") String format);
@Select("select max(data_value) `maxValue`,min(data_value) `minValue` ,round(avg(data_value)) `avgValue` from watch_data_stress where bind_user_id = #{id} and data_date = #{date}") @Select("select max(data_value) maxValue,min(data_value) minValue ,round(avg(data_value)) avgValue from watch_data_stress where bind_user_id = #{id} and data_date = #{date}")
Map<String, Object> getMapStress(@Param("id") String id, @Param("date") Date date); Map<String, Object> getMapStress(@Param("id") String id, @Param("date") Date date);
List<Map<String, Object>> getMapStressValueFormat(@Param("id") String id, @Param("date") String date, @Param("format") String format); List<Map<String, Object>> getMapStressValueFormat(@Param("id") String id, @Param("date") String date, @Param("format") String format);
@Select("select max(data_value) `maxValue`,min(data_value) `minValue` from watch_data_spo2 where bind_user_id = #{id} and data_date = #{date}") @Select("select max(data_value) maxValue,min(data_value) minValue from watch_data_spo2 where bind_user_id = #{id} and data_date = #{date}")
Map<String, Object> getMapSpo2(@Param("id") String id, @Param("date") Date date); Map<String, Object> getMapSpo2(@Param("id") String id, @Param("date") Date date);
@Select("select data_value lastValue from watch_data_spo2 where bind_user_id = #{id} and data_date = #{date} order by time_stamp desc limit 1") @Select("select data_value lastValue from watch_data_spo2 where bind_user_id = #{id} and data_date = #{date} order by time_stamp desc limit 1")
@@ -64,6 +64,6 @@ public interface WatchUserDataMapper extends BaseMapper<WatchUserData> {
* @param watchNo * @param watchNo
* @return * @return
*/ */
@Select("SELECT MAX(data_date) FROM `watch_user_data` where bind_user_id = #{userId} and watch_no = #{watchNo}") @Select("SELECT MAX(data_date) FROM watch_user_data where bind_user_id = #{userId} and watch_no = #{watchNo}")
Date lastDataDate(@Param("userId") String userId,@Param("watchNo") String watchNo); Date lastDataDate(@Param("userId") String userId,@Param("watchNo") String watchNo);
} }
@@ -51,7 +51,7 @@ public class WatchStatisticsProvider {
sb.append(orgCodeStr) sb.append(orgCodeStr)
.append(" as org_code, event_type, count(distinct bind_user_id) as warning_count ") .append(" as org_code, event_type, count(distinct bind_user_id) as warning_count ")
.append("from watch_monitor_data ") .append("from watch_monitor_data ")
.append("where warn_time between date_format(#{start}, '%Y-%m-%d 00:00:00') and date_format(#{end}, '%Y-%m-%d 23:59:59') ") .append("where warn_time between TRUNC(#{start}) and TRUNC(#{end}) + 1 - 1/86400 ")
.append("and event_type in ('heart_rate','spo2','stress','temperature_anomalies') "); .append("and event_type in ('heart_rate','spo2','stress','temperature_anomalies') ");
if (StrUtil.isNotEmpty(filter.getOrgCodeLeaf())) { if (StrUtil.isNotEmpty(filter.getOrgCodeLeaf())) {
sb.append("and org_code like CONCAT(#{orgCodeLeaf},'%')"); sb.append("and org_code like CONCAT(#{orgCodeLeaf},'%')");
@@ -65,11 +65,11 @@ public class WatchStatisticsProvider {
public String wearingDetail() { public String wearingDetail() {
return "SELECT " + return "SELECT " +
" max(wd.bind_user_id) as bind_user_id," + " max(wd.bind_user_id) as bind_user_id," +
" max(distinct wbh.bind_date) as bind_date," + " max(wbh.bind_date) as bind_date," +
" count(distinct wud.data_date) as date_count," + " count(distinct wud.data_date) as date_count," +
" wd.watch_no," + " wd.watch_no," +
" max(wd.org_code) as watch_org_code," + " max(wd.org_code) as watch_org_code," +
" GROUP_CONCAT(distinct wud.data_date order by wud.data_date) as date_list" + " LISTAGG(wud.data_date, ',') WITHIN GROUP (ORDER BY wud.data_date) as date_list" +
" FROM watch_device wd" + " FROM watch_device wd" +
" LEFT JOIN watch_bind_his wbh" + " LEFT JOIN watch_bind_his wbh" +
" ON wd.watch_no = wbh.watch_no AND wd.bind_user_id = wbh.bind_user_id AND wbh.bind_end_date IS NULL" + " ON wd.watch_no = wbh.watch_no AND wd.bind_user_id = wbh.bind_user_id AND wbh.bind_end_date IS NULL" +
@@ -55,13 +55,13 @@
</if> </if>
<if test="req.flag!=null and req.flag==3"> <if test="req.flag!=null and req.flag==3">
<if test="req.dateMonth!=null"> <if test="req.dateMonth!=null">
and DATE_FORMAT(wdsn.data_date,'%Y-%m') =DATE_FORMAT(#{req.dateMonth},'%Y-%m') and TO_CHAR(wdsn.data_date,'YYYY-MM') = TO_CHAR(#{req.dateMonth},'YYYY-MM')
</if> </if>
</if> </if>
<if test="req.flag!=null and req.flag==4"> <if test="req.flag!=null and req.flag==4">
<if test="req.dateYear!=null"> <if test="req.dateYear!=null">
and year(wdsn.data_date) =#{req.dateYear} and EXTRACT(YEAR FROM wdsn.data_date) = #{req.dateYear}
</if> </if>
</if> </if>
</where> </where>
@@ -6,7 +6,7 @@
s.data_value stepsValue, s.data_value stepsValue,
d.data_value distanceValue, d.data_value distanceValue,
c.data_value calorieValue, c.data_value calorieValue,
DATE_FORMAT(s.data_date, '%Y-%m-%d') dataDate TO_CHAR(s.data_date, 'YYYY-MM-DD') dataDate
FROM FROM
watch_data_steps s watch_data_steps s
LEFT JOIN watch_data_distance d ON s.bind_user_id = d.bind_user_id LEFT JOIN watch_data_distance d ON s.bind_user_id = d.bind_user_id
@@ -15,7 +15,7 @@
AND s.data_date = c.data_date AND s.data_date = c.data_date
WHERE WHERE
s.bind_user_id = #{id} s.bind_user_id = #{id}
AND DATE_FORMAT(s.data_date, #{format}) = #{date} AND TO_CHAR(s.data_date, #{format}) = #{date}
ORDER BY ORDER BY
s.data_date ASC s.data_date ASC
</select> </select>
@@ -29,36 +29,33 @@
watch_data_temperature watch_data_temperature
WHERE WHERE
bind_user_id = #{id} bind_user_id = #{id}
AND DATE_FORMAT( data_date, #{format}) = #{date} AND TO_CHAR(data_date, #{format}) = #{date}
ORDER BY ORDER BY
data_date ASC data_date ASC
</select> </select>
<select id="getMapRateValue" resultType="java.util.Map"> <select id="getMapRateValue" resultType="java.util.Map">
SELECT SELECT
max( data_value ) `maxValue`, max( data_value ) maxValue,
min( data_value ) `minValue` min( data_value ) minValue
FROM FROM
watch_monitor_data watch_monitor_data
WHERE WHERE
event_type = 'heart_rate' event_type = 'heart_rate'
AND data_value != NULL AND data_value != NULL
AND bind_user_id = #{id} AND bind_user_id = #{id}
AND data_date BETWEEN ( AND data_date BETWEEN TRUNC(#{date}, 'IW') AND TRUNC(#{date}, 'IW') + 6
DATE_SUB(#{date}, INTERVAL WEEKDAY(#{date}) DAY ))
AND (
DATE_SUB(#{date}, INTERVAL WEEKDAY(#{date}) - 6 DAY ))
</select> </select>
<select id="getMapRateValueFormat" resultType="java.util.Map"> <select id="getMapRateValueFormat" resultType="java.util.Map">
SELECT SELECT
max( data_value ) `maxValue`, max( data_value ) maxValue,
min( data_value ) `minValue` min( data_value ) minValue
FROM FROM
watch_monitor_data watch_monitor_data
WHERE WHERE
event_type = 'heart_rate' event_type = 'heart_rate'
AND data_value != NULL AND data_value != NULL
AND bind_user_id = #{id} AND bind_user_id = #{id}
AND DATE_FORMAT( data_date, #{format} ) = #{date} AND TO_CHAR(data_date, #{format}) = #{date}
</select> </select>
<select id="getMapDataValueFormat" resultType="java.util.Map"> <select id="getMapDataValueFormat" resultType="java.util.Map">
SELECT SELECT
@@ -68,7 +65,7 @@
watch_data_heart_rate watch_data_heart_rate
WHERE WHERE
bind_user_id = #{id} bind_user_id = #{id}
AND DATE_FORMAT( data_date, #{format} ) = #{date} AND TO_CHAR(data_date, #{format}) = #{date}
ORDER BY ORDER BY
time_stamp ASC time_stamp ASC
</select> </select>
@@ -80,7 +77,7 @@
watch_data_stress watch_data_stress
WHERE WHERE
bind_user_id = #{id} bind_user_id = #{id}
AND DATE_FORMAT( data_date, #{format}) = #{date} AND TO_CHAR(data_date, #{format}) = #{date}
ORDER BY ORDER BY
start_time_stamp DESC start_time_stamp DESC
</select> </select>
@@ -92,7 +89,7 @@
watch_data_spo2 watch_data_spo2
WHERE WHERE
bind_user_id = #{id} bind_user_id = #{id}
AND DATE_FORMAT( data_date,#{format}) = #{date} AND TO_CHAR(data_date, #{format}) = #{date}
ORDER BY ORDER BY
time_stamp DESC time_stamp DESC
</select> </select>
@@ -109,18 +106,19 @@
WHERE WHERE
bind_user_id = #{id} bind_user_id = #{id}
AND event_type = #{type} AND event_type = #{type}
AND DATE_FORMAT( data_date, '%Y-%m' ) = #{date} AND TO_CHAR(data_date, 'YYYY-MM') = #{date}
ORDER BY ORDER BY
data_date DESC data_date DESC
LIMIT #{startNo}, #{pageSize} LIMIT #{pageSize} OFFSET #{startNo}
</select> </select>
<select id="getAverageDay" resultType="java.util.Map"> <select id="getAverageDay" resultType="java.util.Map">
SELECT SELECT
CAST( AVG( total_minutes ) AS UNSIGNED ) AS minutes, ROUND( AVG( total_minutes ) ) AS minutes,
( SELECT COUNT(*) FROM watch_data_sleep_new_day WHERE sleep_id IN ( SELECT id FROM watch_data_sleep_new WHERE ( SELECT COUNT(*) FROM watch_data_sleep_new_day WHERE sleep_id IN ( SELECT id FROM watch_data_sleep_new WHERE
bind_user_id = #{id}) ) AS sum bind_user_id = #{id}) ) AS sum
FROM FROM
( SELECT TIMESTAMPDIFF( MINUTE, fall_asleep_time, wake_up_time ) AS total_minutes FROM watch_data_sleep_new_day ( SELECT ROUND((CAST(wake_up_time AS DATE) - CAST(fall_asleep_time AS DATE)) * 24 * 60) AS total_minutes
WHERE sleep_id IN ( SELECT id FROM watch_data_sleep_new WHERE bind_user_id = #{id}) ) AS subquery; FROM watch_data_sleep_new_day
WHERE sleep_id IN ( SELECT id FROM watch_data_sleep_new WHERE bind_user_id = #{id}) ) subquery
</select> </select>
</mapper> </mapper>
@@ -173,7 +173,7 @@
) as day_count, ) as day_count,
(select count(0) (select count(0)
from watch_monitor_data from watch_monitor_data
where yearweek(data_date,1) = yearweek(curdate(),1) where TO_CHAR(data_date,'IYYY-IW') = TO_CHAR(SYSDATE,'IYYY-IW')
<if test="orgCodes != null and orgCodes.size() > 0"> <if test="orgCodes != null and orgCodes.size() > 0">
and and
<foreach collection="orgCodes" item="orgCode" open="(" close=")" separator=" OR "> <foreach collection="orgCodes" item="orgCode" open="(" close=")" separator=" OR ">
@@ -183,7 +183,7 @@
) as week_count, ) as week_count,
(select count(0) (select count(0)
from watch_monitor_data from watch_monitor_data
where date_format(data_date, '%Y-%m') = date_format(curdate(), '%Y-%m') where TO_CHAR(data_date, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
<if test="orgCodes != null and orgCodes.size() > 0"> <if test="orgCodes != null and orgCodes.size() > 0">
and and
<foreach collection="orgCodes" item="orgCode" open="(" close=")" separator=" OR "> <foreach collection="orgCodes" item="orgCode" open="(" close=")" separator=" OR ">
@@ -195,9 +195,9 @@
</select> </select>
<select id="monitorDayStats" resultType="com.renkang.watch.api.bean.response.MonitorDayStats"> <select id="monitorDayStats" resultType="com.renkang.watch.api.bean.response.MonitorDayStats">
select data_date as date, year(data_date) as year, month(data_date) as month, dayofmonth(data_date) as day, count(0) as count select data_date as date, EXTRACT(YEAR FROM data_date) as year, EXTRACT(MONTH FROM data_date) as month, EXTRACT(DAY FROM data_date) as day, count(0) as count
from watch_monitor_data from watch_monitor_data
where date_format(data_date, '%Y-%m') = date_format(#{monthDate,jdbcType=DATE}, '%Y-%m') where TO_CHAR(data_date, 'YYYY-MM') = TO_CHAR(#{monthDate,jdbcType=DATE}, 'YYYY-MM')
<if test="orgCodes != null and orgCodes.size() > 0"> <if test="orgCodes != null and orgCodes.size() > 0">
and and
<foreach collection="orgCodes" item="orgCode" open="(" close=")" separator=" OR "> <foreach collection="orgCodes" item="orgCode" open="(" close=")" separator=" OR ">
@@ -214,7 +214,7 @@
WHERE WHERE
lon_gd IS NOT NULL lon_gd IS NOT NULL
AND lat_gd IS NOT NULL AND lat_gd IS NOT NULL
AND ifnull(address_gd, '') = '' AND NVL(address_gd, '') = ''
limit 100 limit 100
</select> </select>
</mapper> </mapper>
@@ -6,18 +6,18 @@
SELECT SELECT
id as id , id as id ,
user_id as userId, user_id as userId,
max_value as `maxValue`, max_value as maxValue,
min_value as minValue, min_value as minValue,
avg_value as avgValue, avg_value as avgValue,
silence_max_value as silenceMaxValue, silence_max_value as silenceMaxValue,
silence_avg_value as silenceAvgValue, silence_avg_value as silenceAvgValue,
silence_min_value as silenceMinValue, silence_min_value as silenceMinValue,
data_date as dataDate, data_date as dataDate,
DATE_FORMAT( data_date, '%m' ) AS dateStr TO_CHAR( data_date, 'MM' ) AS dateStr
FROM FROM
`watch_stat_user_info_day_heart_rate` watch_stat_user_info_day_heart_rate
WHERE WHERE
YEAR ( data_date )= #{dateYear} EXTRACT(YEAR FROM data_date) = #{dateYear}
and and
user_id=#{userId} user_id=#{userId}
@@ -76,33 +76,33 @@
watch_stat_user_info_day_heart_rate a watch_stat_user_info_day_heart_rate a
LEFT JOIN LEFT JOIN
(SELECT DISTINCT bind_user_id FROM watch_monitor_data (SELECT DISTINCT bind_user_id FROM watch_monitor_data
WHERE warn_time BETWEEN DATE_SUB(CURDATE(), INTERVAL WHERE warn_time BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
AND event_type = 'heart_rate') b AND event_type = 'heart_rate') b
ON ON
a.user_id = b.bind_user_id a.user_id = b.bind_user_id
WHERE WHERE
a.data_date BETWEEN DATE_SUB(CURDATE(), INTERVAL a.data_date BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
AND a.org_code like concat('%',#{orgCode},'%') AND a.org_code like concat('%',#{orgCode},'%')
</if> </if>
GROUP BY GROUP BY
a.user_id; a.user_id
</select> </select>
<select id="selectSpoDataByOrgCode" parameterType="com.renkang.watch.dto.BigScreenDTO" resultType="com.renkang.watch.vo.WatchDataVo"> <select id="selectSpoDataByOrgCode" parameterType="com.renkang.watch.dto.BigScreenDTO" resultType="com.renkang.watch.vo.WatchDataVo">
@@ -124,33 +124,33 @@
watch_stat_user_info_day_spo2 a watch_stat_user_info_day_spo2 a
LEFT JOIN LEFT JOIN
(SELECT DISTINCT bind_user_id FROM watch_monitor_data (SELECT DISTINCT bind_user_id FROM watch_monitor_data
WHERE warn_time BETWEEN DATE_SUB(CURDATE(), INTERVAL WHERE warn_time BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
AND event_type = 'spo') b AND event_type = 'spo') b
ON ON
a.user_id = b.bind_user_id a.user_id = b.bind_user_id
WHERE WHERE
a.data_date BETWEEN DATE_SUB(CURDATE(), INTERVAL a.data_date BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
AND a.org_code like concat('%',#{orgCode},'%') AND a.org_code like concat('%',#{orgCode},'%')
</if> </if>
GROUP BY GROUP BY
a.user_id; a.user_id
</select> </select>
<select id="selectStressDataByOrgCode" resultType="com.renkang.watch.vo.WatchDataVo"> <select id="selectStressDataByOrgCode" resultType="com.renkang.watch.vo.WatchDataVo">
SELECT SELECT
@@ -171,33 +171,33 @@
watch_stat_user_info_day_stress a watch_stat_user_info_day_stress a
LEFT JOIN LEFT JOIN
(SELECT DISTINCT bind_user_id FROM watch_monitor_data (SELECT DISTINCT bind_user_id FROM watch_monitor_data
WHERE warn_time BETWEEN DATE_SUB(CURDATE(), INTERVAL WHERE warn_time BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
AND event_type = 'stress') b AND event_type = 'stress') b
ON ON
a.user_id = b.bind_user_id a.user_id = b.bind_user_id
WHERE WHERE
a.data_date BETWEEN DATE_SUB(CURDATE(), INTERVAL a.data_date BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
AND a.org_code like concat('%',#{orgCode},'%') AND a.org_code like concat('%',#{orgCode},'%')
</if> </if>
GROUP BY GROUP BY
a.user_id; a.user_id
</select> </select>
<select id="selectTempDataByOrgCode" resultType="com.renkang.watch.vo.WatchDataVo"> <select id="selectTempDataByOrgCode" resultType="com.renkang.watch.vo.WatchDataVo">
SELECT SELECT
@@ -218,33 +218,33 @@
watch_stat_user_info_day_temp a watch_stat_user_info_day_temp a
LEFT JOIN LEFT JOIN
(SELECT DISTINCT bind_user_id FROM watch_monitor_data (SELECT DISTINCT bind_user_id FROM watch_monitor_data
WHERE warn_time BETWEEN DATE_SUB(CURDATE(), INTERVAL WHERE warn_time BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
AND event_type = 'temp') b AND event_type = 'temp') b
ON ON
a.user_id = b.bind_user_id a.user_id = b.bind_user_id
WHERE WHERE
a.data_date BETWEEN DATE_SUB(CURDATE(), INTERVAL a.data_date BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
AND a.org_code like concat('%',#{orgCode},'%') AND a.org_code like concat('%',#{orgCode},'%')
</if> </if>
GROUP BY GROUP BY
a.user_id; a.user_id
</select> </select>
<select id="selectSdcDataByOrgCode" resultType="com.renkang.watch.vo.WatchDataVo"> <select id="selectSdcDataByOrgCode" resultType="com.renkang.watch.vo.WatchDataVo">
SELECT SELECT
@@ -253,42 +253,22 @@
FROM FROM
watch_stat_user_info_day_sdc a watch_stat_user_info_day_sdc a
WHERE WHERE
a.data_date BETWEEN DATE_SUB(CURDATE(), INTERVAL a.data_date BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
AND a.org_code like concat('%',#{orgCode},'%') AND a.org_code like concat('%',#{orgCode},'%')
</if> </if>
GROUP BY GROUP BY
a.user_id; a.user_id
</select> </select>
<select id="selectSleepDataByOrgCode" resultType="com.renkang.watch.vo.BigScreenSleepVo"> <select id="selectSleepDataByOrgCode" resultType="com.renkang.watch.vo.BigScreenSleepVo">
<!-- SELECT
data_date,
SUM(long_count) AS long_count,
SUM(long_duration_total) AS long_duration,
SUM(short_count) AS short_count,
SUM(short_duration_total) AS short_duration,
AVG(sleep_avg) AS average_duration,
SUM(long_duration_total) + SUM(short_duration_total) AS sleep_duration,
(COUNT(DISTINCT user_id) * 1440) - (SUM(long_duration_total) + SUM(short_duration_total)) AS awake_duration -->
<!-- SELECT
data_date,
SUM(COALESCE(deep_sleep_times, 0)) AS long_duration,
SUM(COALESCE(light_sleep_times, 0)) AS short_duration,
AVG(COALESCE(deep_sleep_times, 0) + COALESCE(light_sleep_times, 0)) AS average_duration,
AVG(COALESCE(light_sleep_times, 0)) AS avg_short_duration,
AVG(COALESCE(deep_sleep_times, 0)) AS avg_long_duration,
SUM(COALESCE(deep_sleep_times, 0)) + SUM(COALESCE(light_sleep_times, 0)) AS sleep_duration
上面这个是正常按照数据库取值的 但是 说深睡浅睡反了 下面的是反着取值的 待排查问题原因-->
SELECT SELECT
data_date, data_date,
SUM(COALESCE(light_sleep_times, 0)) AS long_duration, SUM(COALESCE(light_sleep_times, 0)) AS long_duration,
@@ -300,22 +280,22 @@
FROM FROM
watch_stat_user_info_day_sleep watch_stat_user_info_day_sleep
WHERE WHERE
data_date BETWEEN DATE_SUB(CURDATE(), INTERVAL data_date BETWEEN
<choose> <choose>
<when test="type == 'day'">0 DAY</when> <when test="type == 'day'">TRUNC(SYSDATE)</when>
<when test="type == 'week'">7 DAY</when> <when test="type == 'week'">TRUNC(SYSDATE) - 7</when>
<when test="type == 'month'">1 MONTH</when> <when test="type == 'month'">ADD_MONTHS(TRUNC(SYSDATE), -1)</when>
<when test="type == 'year'">1 YEAR</when> <when test="type == 'year'">ADD_MONTHS(TRUNC(SYSDATE), -12)</when>
<otherwise>0 DAY</otherwise> <otherwise>TRUNC(SYSDATE)</otherwise>
</choose> </choose>
) AND CURDATE() AND SYSDATE
<if test="orgCode != null and orgCode != ''"> <if test="orgCode != null and orgCode != ''">
AND org_code like concat('%',#{orgCode},'%') AND org_code like concat('%',#{orgCode},'%')
</if> </if>
GROUP BY GROUP BY
data_date data_date
ORDER BY ORDER BY
data_date DESC; data_date DESC
</select> </select>
<select id="findUserNewDataByUserIds" resultType="com.renkang.watch.entity.WatchStatUserInfoDayHeartRate"> <select id="findUserNewDataByUserIds" resultType="com.renkang.watch.entity.WatchStatUserInfoDayHeartRate">
SELECT SELECT
@@ -331,22 +311,21 @@
</foreach> </foreach>
GROUP BY user_id ) temp GROUP BY user_id ) temp
ON wsd.user_id = temp.user_id ON wsd.user_id = temp.user_id
AND wsd.data_date = temp.latest_date; AND wsd.data_date = temp.latest_date
</select> </select>
<!-- 切记 此代码不能直接平移至四合一项目 ,该sql只适用mysql8.0及以上版本 ,四合一项目开发测试环境的mysql版本过低 , 但不影响正式环境-->
<insert id="insertStat"> <insert id="insertStat">
INSERT INTO watch_stat_user_info_day_heart_rate ( id, user_id, max_value, min_value, avg_value, silence_max_value, silence_min_value, silence_avg_value, last_upload_time, new_value, silence_new_value, data_date, org_code ) ( INSERT INTO watch_stat_user_info_day_heart_rate ( id, user_id, max_value, min_value, avg_value, silence_max_value, silence_min_value, silence_avg_value, last_upload_time, new_value, silence_new_value, data_date, org_code )
SELECT SELECT
#{id,jdbcType=VARCHAR}, #{id,jdbcType=VARCHAR},
bind_user_id, bind_user_id,
IFNULL( MAX( wd.data_value ), 0 ), NVL( MAX( wd.data_value ), 0 ),
IFNULL( MIN( wd.data_value ), 0 ), NVL( MIN( wd.data_value ), 0 ),
IFNULL( AVG( wd.data_value ), 0 ), NVL( AVG( wd.data_value ), 0 ),
IFNULL( MAX( wd.silence_value ), 0 ), NVL( MAX( wd.silence_value ), 0 ),
IFNULL( MIN( wd.silence_value ), 0 ), NVL( MIN( wd.silence_value ), 0 ),
IFNULL( AVG( wd.silence_value ), 0 ), NVL( AVG( wd.silence_value ), 0 ),
IFNULL(MAX( wd.time_stamp ),NOW()), NVL(MAX( wd.time_stamp ),SYSDATE),
MAX( CASE WHEN wd.rn = 1 THEN wd.data_value END ), MAX( CASE WHEN wd.rn = 1 THEN wd.data_value END ),
MAX( CASE WHEN wd.rn = 1 THEN wd.silence_value END ), MAX( CASE WHEN wd.rn = 1 THEN wd.silence_value END ),
data_date, data_date,
@@ -354,10 +333,10 @@
FROM FROM
( (
SELECT SELECT
*, t.*,
ROW_NUMBER() OVER ( PARTITION BY bind_user_id, data_date ORDER BY time_stamp DESC ) AS rn ROW_NUMBER() OVER ( PARTITION BY bind_user_id, data_date ORDER BY time_stamp DESC ) AS rn
FROM FROM
watch_data_heart_rate watch_data_heart_rate t
WHERE WHERE
bind_user_id = #{userId,jdbcType=VARCHAR} bind_user_id = #{userId,jdbcType=VARCHAR}
and data_date = #{dataDate,jdbcType=DATE} and data_date = #{dataDate,jdbcType=DATE}
@@ -365,44 +344,43 @@
GROUP BY GROUP BY
wd.bind_user_id, wd.bind_user_id,
wd.data_date wd.data_date
);
</insert> </insert>
<!-- 切记 此代码不能直接平移至四合一项目 ,该sql只适用mysql8.0及以上版本 ,四合一项目开发测试环境的mysql版本过低 , 但不影响正式环境--> <!-- MySQL 的 UPDATE ... LEFT JOIN ... SET 语法已改写为达梦兼容的 MERGE INTO -->
<update id="updateStat"> <update id="updateStat">
UPDATE watch_stat_user_info_day_heart_rate stat MERGE INTO watch_stat_user_info_day_heart_rate stat
LEFT JOIN ( USING (
SELECT SELECT
wd.bind_user_id, wd.bind_user_id,
wd.data_date, wd.data_date,
IFNULL( MAX( wd.data_value ), 0 ) AS max_value, NVL( MAX( wd.data_value ), 0 ) AS max_value,
IFNULL( MIN( wd.data_value ), 0 ) AS min_value, NVL( MIN( wd.data_value ), 0 ) AS min_value,
IFNULL( AVG( wd.data_value ), 0 ) AS avg_value, NVL( AVG( wd.data_value ), 0 ) AS avg_value,
IFNULL( MAX( wd.silence_value ), 0 ) AS silence_max_value, NVL( MAX( wd.silence_value ), 0 ) AS silence_max_value,
IFNULL( MIN( wd.silence_value ), 0 ) AS silence_min_value, NVL( MIN( wd.silence_value ), 0 ) AS silence_min_value,
IFNULL( AVG( wd.silence_value ), 0 ) AS silence_avg_value, NVL( AVG( wd.silence_value ), 0 ) AS silence_avg_value,
IFNULL(MAX( wd.time_stamp ),NOW()) AS last_upload_time, NVL(MAX( wd.time_stamp ),SYSDATE) AS last_upload_time,
MAX( CASE WHEN wd.rn = 1 THEN wd.data_value END ) AS new_value, MAX( CASE WHEN wd.rn = 1 THEN wd.data_value END ) AS new_value,
MAX( CASE WHEN wd.rn = 1 THEN wd.silence_value END ) AS silence_new_value MAX( CASE WHEN wd.rn = 1 THEN wd.silence_value END ) AS silence_new_value
FROM FROM
( SELECT *, ROW_NUMBER() OVER ( PARTITION BY bind_user_id, data_date ORDER BY time_stamp DESC ) AS rn FROM watch_data_heart_rate where bind_user_id = #{userId,jdbcType=VARCHAR} ( SELECT t.*, ROW_NUMBER() OVER ( PARTITION BY bind_user_id, data_date ORDER BY time_stamp DESC ) AS rn
and data_date = #{dataDate,jdbcType=DATE} ) wd FROM watch_data_heart_rate t
WHERE bind_user_id = #{userId,jdbcType=VARCHAR}
AND data_date = #{dataDate,jdbcType=DATE} ) wd
GROUP BY GROUP BY
wd.bind_user_id, wd.bind_user_id,
wd.data_date wd.data_date
) DATA ON stat.user_id = DATA.bind_user_id ) DATA ON (stat.user_id = DATA.bind_user_id AND stat.data_date = DATA.data_date)
AND stat.data_date = DATA.data_date WHEN MATCHED THEN UPDATE SET
SET stat.max_value = DATA.max_value, stat.max_value = DATA.max_value,
stat.min_value = DATA.min_value, stat.min_value = DATA.min_value,
stat.avg_value = DATA.avg_value, stat.avg_value = DATA.avg_value,
stat.silence_max_value = DATA.silence_max_value, stat.silence_max_value = DATA.silence_max_value,
stat.silence_min_value = DATA.silence_min_value, stat.silence_min_value = DATA.silence_min_value,
stat.silence_avg_value = DATA.silence_avg_value, stat.silence_avg_value = DATA.silence_avg_value,
stat.last_upload_time = DATA.last_upload_time, stat.last_upload_time = DATA.last_upload_time,
stat.new_value = DATA.new_value, stat.new_value = DATA.new_value,
stat.silence_new_value = COALESCE ( NULLIF( DATA.silence_new_value, 0 ), stat.silence_new_value ), stat.silence_new_value = COALESCE ( NULLIF( DATA.silence_new_value, 0 ), stat.silence_new_value ),
stat.org_code = #{orgCode,jdbcType=VARCHAR} stat.org_code = #{orgCode,jdbcType=VARCHAR}
where stat.user_id = #{userId,jdbcType=VARCHAR}
and stat.data_date = #{dataDate,jdbcType=DATE};
</update> </update>
</mapper> </mapper>
@@ -10,7 +10,7 @@
distance_value as distanceValue, distance_value as distanceValue,
calorie_value as calorieValue, calorie_value as calorieValue,
data_date as dataDate, data_date as dataDate,
DATE_FORMAT( data_date, '%m' ) AS dateStr TO_CHAR( data_date, 'MM' ) AS dateStr
FROM FROM
`watch_stat_user_info_day_sdc` `watch_stat_user_info_day_sdc`
WHERE WHERE
@@ -16,7 +16,7 @@
deep_sleep_times as deepSleepTimes, deep_sleep_times as deepSleepTimes,
light_sleep_times as lightSleepTimes, light_sleep_times as lightSleepTimes,
data_date as dataDate, data_date as dataDate,
DATE_FORMAT( data_date, '%m' ) AS dateStr TO_CHAR( data_date, 'MM' ) AS dateStr
FROM FROM
`watch_stat_user_info_day_sleep` `watch_stat_user_info_day_sleep`
WHERE WHERE
@@ -10,7 +10,7 @@
min_value as minValue, min_value as minValue,
avg_value as avgValue, avg_value as avgValue,
data_date as dataDate, data_date as dataDate,
DATE_FORMAT( data_date, '%m' ) AS dateStr TO_CHAR( data_date, 'MM' ) AS dateStr
FROM FROM
`watch_stat_user_info_day_spo2` `watch_stat_user_info_day_spo2`
WHERE WHERE
@@ -10,7 +10,7 @@
min_value as minValue, min_value as minValue,
avg_value as avgValue, avg_value as avgValue,
data_date as dataDate, data_date as dataDate,
DATE_FORMAT( data_date, '%m' ) AS dateStr TO_CHAR( data_date, 'MM' ) AS dateStr
FROM FROM
`watch_stat_user_info_day_stress` `watch_stat_user_info_day_stress`
WHERE WHERE
@@ -7,16 +7,16 @@
SELECT SELECT
id as id , id as id ,
user_id as userId, user_id as userId,
max_value as `maxValueB`, max_value as maxValueB,
min_value as minValueB, min_value as minValueB,
avg_value as avgValueB, avg_value as avgValueB,
skin_max_value as skinMaxValueB, skin_max_value as skinMaxValueB,
skin_min_value as skinMinValueB, skin_min_value as skinMinValueB,
skin_avg_value as skinAvgValueB, skin_avg_value as skinAvgValueB,
data_date as dataDate, data_date as dataDate,
DATE_FORMAT( data_date, '%m' ) AS dateStr TO_CHAR( data_date, 'MM' ) AS dateStr
FROM FROM
`watch_stat_user_info_day_temp` watch_stat_user_info_day_temp
WHERE WHERE
YEAR ( data_date )= #{dateYear} YEAR ( data_date )= #{dateYear}
and and
@@ -79,24 +79,24 @@
<select id="distanceMap" resultType="java.util.Map"> <select id="distanceMap" resultType="java.util.Map">
select data_value dateValue, select data_value dateValue,
DATE_FORMAT(sdc_date, '%Y-%m-%d') sdcDate TO_CHAR(sdc_date, 'YYYY-MM-DD') sdcDate
from watch_data_distance from watch_data_distance
WHERE sdc_date BETWEEN #{date1} AND #{date2} WHERE sdc_date BETWEEN #{date1} AND #{date2}
</select> </select>
<select id="heartRateMap" resultType="java.util.Map"> <select id="heartRateMap" resultType="java.util.Map">
select data_value dateValue select data_value dateValue
from watch_data_heart_rate from watch_data_heart_rate
WHERE DATE_FORMAT(data_date, '%Y-%m-%d') = #{queryDateStr} WHERE TO_CHAR(data_date, 'YYYY-MM-DD') = #{queryDateStr}
</select> </select>
<select id="spo2Map" resultType="java.util.Map"> <select id="spo2Map" resultType="java.util.Map">
select data_value dateValue select data_value dateValue
from watch_data_spo2 from watch_data_spo2
WHERE DATE_FORMAT(data_date, '%Y-%m-%d') = #{queryDateStr} WHERE TO_CHAR(data_date, 'YYYY-MM-DD') = #{queryDateStr}
</select> </select>
<select id="stressMap" resultType="java.util.Map"> <select id="stressMap" resultType="java.util.Map">
select data_value dateValue select data_value dateValue
from watch_data_stress from watch_data_stress
WHERE DATE_FORMAT(data_date, '%Y-%m-%d') = #{queryDateStr} WHERE TO_CHAR(data_date, 'YYYY-MM-DD') = #{queryDateStr}
</select> </select>
<select id="getUserDataByWeekly" resultType="java.util.Map"> <select id="getUserDataByWeekly" resultType="java.util.Map">
SELECT 'heart_rate' AS metric, AVG(avg_value) AS value SELECT 'heart_rate' AS metric, AVG(avg_value) AS value
@@ -1,8 +1,9 @@
PROFILE_NAME=dev PROFILE_NAME=dev
SERVER_PORT=7098 SERVER_PORT=7098
NACOS_SERVER_ADDR=localhost:8848 NACOS_SERVER_ADDR=192.168.1.80:8848
NACOS_USERNAME=nacos NACOS_USERNAME=xjuser
NACOS_PASSWORD=nacos NACOS_PASSWORD=Aa135790!123
NACOS_NAMESPACE=f3f65fb2-303b-4bf7-bccb-4755886503c1 NACOS_NAMESPACE=xjxc-space-common
NACOS_NAMESPACE_DISCOVERY=xjxc-space-common
NACOS_GROUP=dev NACOS_GROUP=dev
FILE_SERVER_URL=http://fileserver.yg.dt.io FILE_SERVER_URL=http://fileserver.yg.dt.io
@@ -21,7 +21,7 @@ spring:
password: ${spring.cloud.nacos.password} password: ${spring.cloud.nacos.password}
discovery: discovery:
enabled: true enabled: true
namespace: ${NACOS_NAMESPACE:} namespace: ${NACOS_NAMESPACE_DISCOVERY:}
group: ${NACOS_GROUP:DEFAULT_GROUP} group: ${NACOS_GROUP:DEFAULT_GROUP}
server-addr: ${spring.cloud.nacos.server-addr} server-addr: ${spring.cloud.nacos.server-addr}
username: ${spring.cloud.nacos.username} username: ${spring.cloud.nacos.username}
+4 -3
View File
@@ -140,10 +140,11 @@
</dependency> </dependency>
<!-- 数据库驱动 --> <!-- 数据库驱动 -->
<!--mysql--> <!-- 达梦数据库-->
<dependency> <dependency>
<groupId>com.mysql</groupId> <groupId>com.dameng</groupId>
<artifactId>mysql-connector-j</artifactId> <artifactId>DmJdbcDriver8</artifactId>
<scope>runtime</scope>
</dependency> </dependency>
<!-- sqlserver--> <!-- sqlserver-->
<dependency> <dependency>
@@ -307,7 +307,10 @@ public class CommonUtils {
String sqlserver = "SQL SERVER"; String sqlserver = "SQL SERVER";
if (dbType.indexOf(DataBaseConstant.DB_TYPE_MYSQL) >= 0) { if (dbType.indexOf(DataBaseConstant.DB_TYPE_MYSQL) >= 0) {
DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL; DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL;
} else if (dbType.indexOf(DataBaseConstant.DB_TYPE_ORACLE) >= 0 || dbType.indexOf(DataBaseConstant.DB_TYPE_DM) >= 0) { } else if (dbType.indexOf(DataBaseConstant.DB_TYPE_DM) >= 0) {
// 达梦数据库:getDatabaseProductName() 返回 "DM DBMS",需在 ORACLE 之前判断
DB_TYPE = DataBaseConstant.DB_TYPE_DM;
} else if (dbType.indexOf(DataBaseConstant.DB_TYPE_ORACLE) >= 0) {
DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE; DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
} else if (dbType.indexOf(DataBaseConstant.DB_TYPE_SQLSERVER) >= 0 || dbType.indexOf(sqlserver) >= 0) { } else if (dbType.indexOf(DataBaseConstant.DB_TYPE_SQLSERVER) >= 0 || dbType.indexOf(sqlserver) >= 0) {
DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER; DB_TYPE = DataBaseConstant.DB_TYPE_SQLSERVER;
@@ -90,6 +90,9 @@ public class DbTypeUtils {
return DataBaseConstant.DB_TYPE_DB2; return DataBaseConstant.DB_TYPE_DB2;
} else if (DbType.HSQL.equals(dbType)) { } else if (DbType.HSQL.equals(dbType)) {
return DataBaseConstant.DB_TYPE_HSQL; return DataBaseConstant.DB_TYPE_HSQL;
} else if (DbType.DM.equals(dbType)) {
// 达梦数据库单独返回 DM 类型,避免被归入 Oracle 分支
return DataBaseConstant.DB_TYPE_DM;
} else if (dbTypeIsOracle(dbType)) { } else if (dbTypeIsOracle(dbType)) {
return DataBaseConstant.DB_TYPE_ORACLE; return DataBaseConstant.DB_TYPE_ORACLE;
} else if (dbTypeIsSqlServer(dbType)) { } else if (dbTypeIsSqlServer(dbType)) {
@@ -0,0 +1,124 @@
package org.jeecg.config.mybatis;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.SystemMetaObject;
import org.springframework.stereotype.Component;
import java.sql.Connection;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 达梦数据库关键字拦截器
* 自动为 SQL 中的关键字别名添加双引号,避免关键字冲突
*
* @author system
* @date 2026-03-05
*/
@Slf4j
@Component
@Intercepts({
@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})
})
public class DmKeywordInterceptor implements Interceptor {
/**
* 达梦数据库关键字列表(常见关键字)
* 可根据实际需要添加更多关键字
*/
private static final Set<String> DM_KEYWORDS = new HashSet<>(Arrays.asList(
"MODEL", "BEGIN", "END"
));
@Override
public Object intercept(Invocation invocation) throws Throwable {
try {
StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
String sql = (String) metaObject.getValue("delegate.boundSql.sql");
// 处理 AS 别名关键字冲突
String processedSql = processKeywordAlias(sql);
// 如果 SQL 被修改,则记录日志并更新
if (!sql.equals(processedSql)) {
log.debug("达梦关键字拦截器处理SQL - 原始: {} => 处理后: {}", sql, processedSql);
metaObject.setValue("delegate.boundSql.sql", processedSql);
}
} catch (Exception e) {
log.error("达梦关键字拦截器处理SQL异常", e);
// 发生异常时不影响正常流程,继续执行
}
return invocation.proceed();
}
/**
* 处理 SQL 中的关键字别名
* 将关键字别名用双引号包裹
*
* @param sql 原始 SQL
* @return 处理后的 SQL
*/
private String processKeywordAlias(String sql) {
if (sql == null || sql.trim().isEmpty()) {
return sql;
}
// 正则匹配: 字段名 as 别名 的模式
// 例如: model_no as model -> model_no as "model"
Pattern pattern = Pattern.compile(
"\\b([\\w.`]+)\\s+(?i:as)\\s+(\\w+)\\b",
Pattern.CASE_INSENSITIVE
);
Matcher matcher = pattern.matcher(sql);
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String alias = matcher.group(2);
// 检查别名是否为关键字,且未被引号包裹
if (DM_KEYWORDS.contains(alias.toUpperCase()) && !alias.startsWith("\"")) {
// 给关键字别名加上双引号
matcher.appendReplacement(sb,
matcher.group(1) + " AS \"" + alias + "\"");
}
}
matcher.appendTail(sb);
return sb.toString();
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
@Override
public void setProperties(Properties properties) {
// 可以通过配置文件注入额外的关键字
}
/**
* 添加自定义关键字到黑名单
*
* @param keywords 关键字数组
*/
public static void addKeywords(String... keywords) {
if (keywords != null) {
for (String keyword : keywords) {
if (keyword != null && !keyword.trim().isEmpty()) {
DM_KEYWORDS.add(keyword.toUpperCase());
}
}
}
}
}
@@ -1,5 +1,6 @@
package org.jeecg.config.mybatis; package org.jeecg.config.mybatis;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.DynamicTableNameInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.DynamicTableNameInnerInterceptor;
@@ -119,7 +120,7 @@ public class MybatisPlusSaasConfig {
// 青海动态表名设置 // 青海动态表名设置
interceptor.addInnerInterceptor(dynamicTableNameQhInterceptor()); interceptor.addInnerInterceptor(dynamicTableNameQhInterceptor());
//update-end-author:zyf date:20220425 for:【VUEN-606】注入动态表名适配拦截器解决多表名问题 //update-end-author:zyf date:20220425 for:【VUEN-606】注入动态表名适配拦截器解决多表名问题
interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.DM));
//【jeecg-boot/issues/3847】增加@Version乐观锁支持 //【jeecg-boot/issues/3847】增加@Version乐观锁支持
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor; return interceptor;
@@ -66,7 +66,7 @@ public class SmsSendMsgHandle implements ISendMsgHandle {
queryWrapper.eq(SysMessage::getEsType,"2");//群发,群发不重发 queryWrapper.eq(SysMessage::getEsType,"2");//群发,群发不重发
queryWrapper.eq(SysMessage::getEsSendStatus, SendMsgStatusEnum.WAIT.getCode()); queryWrapper.eq(SysMessage::getEsSendStatus, SendMsgStatusEnum.WAIT.getCode());
} }
queryWrapper.orderByAsc(SysMessage::getCreateTime).last("limit "+pageSize); queryWrapper.orderByAsc(SysMessage::getCreateTime).last("FETCH FIRST " + pageSize + " ROWS ONLY");
//查询需要发送的数据 //查询需要发送的数据
List<SysMessage> sysMessages = sysMessageService.getBaseMapper().selectList(queryWrapper); List<SysMessage> sysMessages = sysMessageService.getBaseMapper().selectList(queryWrapper);
// log.info("开始发送短信("+sysMessages.size()+")"+logSuffix); // log.info("开始发送短信("+sysMessages.size()+")"+logSuffix);
@@ -42,7 +42,7 @@ import java.util.Map;
* @Date: 2019-01-02 * @Date: 2019-01-02
* @Version:V1.0 * @Version:V1.0
*/ */
@RestController //@RestController
@RequestMapping("/sys/quartzJob") @RequestMapping("/sys/quartzJob")
@Slf4j @Slf4j
@Tag(name = "定时任务接口") @Tag(name = "定时任务接口")
@@ -23,7 +23,7 @@ import java.util.List;
* @Version: V1.1 * @Version: V1.1
*/ */
@Slf4j @Slf4j
@Service //@Service
public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob> implements IQuartzJobService { public class QuartzJobServiceImpl extends ServiceImpl<QuartzJobMapper, QuartzJob> implements IQuartzJobService {
/** /**
* 立即执行的任务分组 * 立即执行的任务分组
@@ -80,15 +80,15 @@
SELECT SELECT
device_code, device_code,
SUM(CASE SUM(CASE
WHEN YEARWEEK(exam_time, 1) = YEARWEEK(NOW(), 1) THEN 1 WHEN TO_CHAR(exam_time, 'IYYY-IW') = TO_CHAR(SYSDATE, 'IYYY-IW') THEN 1
ELSE 0 ELSE 0
END) AS week_count, END) AS week_count,
SUM(CASE SUM(CASE
WHEN YEAR(exam_time) = YEAR(NOW()) AND MONTH(create_time) = MONTH(NOW()) THEN 1 WHEN EXTRACT(YEAR FROM exam_time) = EXTRACT(YEAR FROM SYSDATE) AND EXTRACT(MONTH FROM create_time) = EXTRACT(MONTH FROM SYSDATE) THEN 1
ELSE 0 ELSE 0
END) AS month_count, END) AS month_count,
SUM(CASE SUM(CASE
WHEN YEAR(exam_time) = YEAR(NOW()) THEN 1 WHEN EXTRACT(YEAR FROM exam_time) = EXTRACT(YEAR FROM SYSDATE) THEN 1
ELSE 0 ELSE 0
END) AS year_count, END) AS year_count,
COUNT(*) AS total_count COUNT(*) AS total_count
@@ -116,22 +116,22 @@
<select id="selectWrapper" resultType="org.jeecg.modules.system.entity.DetailVO"> <select id="selectWrapper" resultType="org.jeecg.modules.system.entity.DetailVO">
SELECT * FROM `remote_weight_manufacturer_one` one LEFT JOIN sys_user user ON one.card_number = user.id_card SELECT * FROM remote_weight_manufacturer_one one LEFT JOIN sys_user su ON one.card_number = su.id_card
<where> <where>
<if test="dto.code != null and dto.code != ''"> <if test="dto.code != null and dto.code != ''">
AND one.device_code = #{dto.code} AND one.device_code = #{dto.code}
</if> </if>
<if test="dto.orgCode != null and dto.orgCode != ''"> <if test="dto.orgCode != null and dto.orgCode != ''">
AND user.org_code like CONCAT(#{dto.orgCode},'%') AND su.org_code like CONCAT(#{dto.orgCode},'%')
</if> </if>
<if test="dto.realName != null and dto.realName != ''"> <if test="dto.realName != null and dto.realName != ''">
AND user.realname like CONCAT('%', #{dto.realName}, '%') AND su.realname like CONCAT('%', #{dto.realName}, '%')
</if> </if>
<if test="dto.workNo != null and dto.workNo != ''"> <if test="dto.workNo != null and dto.workNo != ''">
AND user.work_no like CONCAT('%', #{dto.workNo}, '%') AND su.work_no like CONCAT('%', #{dto.workNo}, '%')
</if> </if>
<if test="dto.sex != null and dto.sex != ''"> <if test="dto.sex != null and dto.sex != ''">
AND user.sex = #{dto.sex} AND su.sex = #{dto.sex}
</if> </if>
<if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''"> <if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
AND exam_time between #{dto.startDate} and #{dto.endDate} AND exam_time between #{dto.startDate} and #{dto.endDate}
@@ -32,7 +32,7 @@
</foreach> </foreach>
</if> </if>
<if test="dateStr != null"> <if test="dateStr != null">
AND DATE(data_date) = #{dateStr} AND TRUNC(data_date) = #{dateStr}
</if> </if>
</where> </where>
GROUP BY user_id ) GROUP BY user_id )
@@ -82,10 +82,10 @@
<select id="dayMinWeight" resultType="org.jeecg.bean.entity.UserDataRecordBmi"> <select id="dayMinWeight" resultType="org.jeecg.bean.entity.UserDataRecordBmi">
SELECT * SELECT *
FROM user_data_record_bmi FROM user_data_record_bmi
WHERE DATE(data_date) = (SELECT MAX(DATE(data_date)) FROM user_data_record_bmi where user_id = #{userId}) WHERE TRUNC(data_date) = (SELECT MAX(TRUNC(data_date)) FROM user_data_record_bmi where user_id = #{userId})
and user_id = #{userId} and user_id = #{userId}
ORDER BY weight ASC ORDER BY weight ASC
LIMIT 1 FETCH FIRST 1 ROWS ONLY
</select> </select>
@@ -333,7 +333,7 @@ public class WeighingDeviceServiceImpl implements WeighingDeviceService {
queryWrapper.select(ScalePersonal::getId,ScalePersonal::getBindUserId) queryWrapper.select(ScalePersonal::getId,ScalePersonal::getBindUserId)
.eq(ScalePersonal::getDelFlag, CommonConstant.DEL_FLAG_0) .eq(ScalePersonal::getDelFlag, CommonConstant.DEL_FLAG_0)
.eq(ScalePersonal::getCode, deviceCode) .eq(ScalePersonal::getCode, deviceCode)
.last("limit 1"); .last("FETCH FIRST 1 ROWS ONLY");
ScalePersonal scalePersonal = scalePersonalMapper.selectOne(queryWrapper); ScalePersonal scalePersonal = scalePersonalMapper.selectOne(queryWrapper);
if (scalePersonal == null) { if (scalePersonal == null) {
return null; return null;
@@ -257,11 +257,11 @@ public class ArchivesBasePhysiqueServiceImpl implements ArchivesBasePhysiqueServ
//周数据和月数据查询每天的平均值 , 年数据查询每月的记录值 //周数据和月数据查询每天的平均值 , 年数据查询每月的记录值
trendWrapper.selectAvg(column,PhysiqueDataCommonTrendVO.CommonTrend::getDataValue); trendWrapper.selectAvg(column,PhysiqueDataCommonTrendVO.CommonTrend::getDataValue);
if(4 == scope){ if(4 == scope){
trendWrapper.selectAs("DATE_FORMAT(create_time, '%Y-%m')",PhysiqueDataCommonTrendVO.CommonTrend::getTime); trendWrapper.selectAs("TO_CHAR(create_time, 'YYYY-MM')",PhysiqueDataCommonTrendVO.CommonTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(create_time, '%Y-%m')"); trendWrapper.groupBy("TO_CHAR(create_time, 'YYYY-MM')");
}else { }else {
trendWrapper.selectAs("DATE_FORMAT(create_time, '%Y-%m-%d')",PhysiqueDataCommonTrendVO.CommonTrend::getTime); trendWrapper.selectAs("TO_CHAR(create_time, 'YYYY-MM-DD')",PhysiqueDataCommonTrendVO.CommonTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(create_time, '%Y-%m-%d')"); trendWrapper.groupBy("TO_CHAR(create_time, 'YYYY-MM-DD')");
} }
} }
} }
@@ -292,11 +292,11 @@ public class ArchivesBasePhysiqueServiceImpl implements ArchivesBasePhysiqueServ
//周数据和月数据查询每天的平均值 , 年数据查询每月的记录值 //周数据和月数据查询每天的平均值 , 年数据查询每月的记录值
trendWrapper.selectAvg(UserDataRecordBmi::getWeight,PhysiqueDataCommonTrendVO.CommonTrend::getDataValue); trendWrapper.selectAvg(UserDataRecordBmi::getWeight,PhysiqueDataCommonTrendVO.CommonTrend::getDataValue);
if(4 == scope){ if(4 == scope){
trendWrapper.selectAs("DATE_FORMAT(data_date, '%Y-%m')",PhysiqueDataCommonTrendVO.CommonTrend::getTime); trendWrapper.selectAs("TO_CHAR(data_date, 'YYYY-MM')",PhysiqueDataCommonTrendVO.CommonTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(data_date, '%Y-%m')"); trendWrapper.groupBy("TO_CHAR(data_date, 'YYYY-MM')");
}else { }else {
trendWrapper.selectAs("DATE_FORMAT(data_date, '%Y-%m-%d')",PhysiqueDataCommonTrendVO.CommonTrend::getTime); trendWrapper.selectAs("TO_CHAR(data_date, 'YYYY-MM-DD')",PhysiqueDataCommonTrendVO.CommonTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(data_date, '%Y-%m-%d')"); trendWrapper.groupBy("TO_CHAR(data_date, 'YYYY-MM-DD')");
} }
} }
}else { }else {
@@ -313,11 +313,11 @@ public class ArchivesBasePhysiqueServiceImpl implements ArchivesBasePhysiqueServ
//周数据和月数据查询每天的平均值 , 年数据查询每月的记录值 //周数据和月数据查询每天的平均值 , 年数据查询每月的记录值
trendWrapper.selectAvg(UserDataRecordBmi::getBmi,PhysiqueDataCommonTrendVO.CommonTrend::getDataValue); trendWrapper.selectAvg(UserDataRecordBmi::getBmi,PhysiqueDataCommonTrendVO.CommonTrend::getDataValue);
if(4 == scope){ if(4 == scope){
trendWrapper.selectAs("DATE_FORMAT(data_date, '%Y-%m')",PhysiqueDataCommonTrendVO.CommonTrend::getTime); trendWrapper.selectAs("TO_CHAR(data_date, 'YYYY-MM')",PhysiqueDataCommonTrendVO.CommonTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(data_date, '%Y-%m')"); trendWrapper.groupBy("TO_CHAR(data_date, 'YYYY-MM')");
}else { }else {
trendWrapper.selectAs("DATE_FORMAT(data_date, '%Y-%m-%d')",PhysiqueDataCommonTrendVO.CommonTrend::getTime); trendWrapper.selectAs("TO_CHAR(data_date, 'YYYY-MM-DD')",PhysiqueDataCommonTrendVO.CommonTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(data_date, '%Y-%m-%d')"); trendWrapper.groupBy("TO_CHAR(data_date, 'YYYY-MM-DD')");
} }
} }
} }
@@ -372,11 +372,11 @@ public class ArchivesBasePhysiqueServiceImpl implements ArchivesBasePhysiqueServ
trendWrapper.selectAvg(UserDataRecordBloodPressure::getDbp,PhysiqueDataBloodTrendVO.BloodTrend::getDbp); trendWrapper.selectAvg(UserDataRecordBloodPressure::getDbp,PhysiqueDataBloodTrendVO.BloodTrend::getDbp);
trendWrapper.selectAvg(UserDataRecordBloodPressure::getSbp,PhysiqueDataBloodTrendVO.BloodTrend::getSbp); trendWrapper.selectAvg(UserDataRecordBloodPressure::getSbp,PhysiqueDataBloodTrendVO.BloodTrend::getSbp);
if(4 == scope){ if(4 == scope){
trendWrapper.selectAs("DATE_FORMAT(create_time, '%Y-%m')",PhysiqueDataBloodTrendVO.BloodTrend::getTime); trendWrapper.selectAs("TO_CHAR(create_time, 'YYYY-MM')",PhysiqueDataBloodTrendVO.BloodTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(create_time, '%Y-%m')"); trendWrapper.groupBy("TO_CHAR(create_time, 'YYYY-MM')");
}else { }else {
trendWrapper.selectAs("DATE_FORMAT(create_time, '%Y-%m-%d')",PhysiqueDataBloodTrendVO.BloodTrend::getTime); trendWrapper.selectAs("TO_CHAR(create_time, 'YYYY-MM-DD')",PhysiqueDataBloodTrendVO.BloodTrend::getTime);
trendWrapper.groupBy("DATE_FORMAT(create_time, '%Y-%m-%d')"); trendWrapper.groupBy("TO_CHAR(create_time, 'YYYY-MM-DD')");
} }
List<PhysiqueDataBloodTrendVO.BloodTrend> dataList = recordBloodMapper.selectJoinList(PhysiqueDataBloodTrendVO.BloodTrend.class,trendWrapper); List<PhysiqueDataBloodTrendVO.BloodTrend> dataList = recordBloodMapper.selectJoinList(PhysiqueDataBloodTrendVO.BloodTrend.class,trendWrapper);
if(ObjectUtil.isNotEmpty(dataList)){ if(ObjectUtil.isNotEmpty(dataList)){
@@ -1004,7 +1004,7 @@ public class LoginController {
.eq(SysUser::getIdCard, idCard) .eq(SysUser::getIdCard, idCard)
.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0) .eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0)
.eq(SysUser::getPersonType, "1") .eq(SysUser::getPersonType, "1")
.last("limit 1"); .last("FETCH FIRST 1 ROWS ONLY");
SysUser sysUser = sysUserService.getOne(queryWrapper); SysUser sysUser = sysUserService.getOne(queryWrapper);
if (sysUser == null) { if (sysUser == null) {
return Result.error("未知用户!"); return Result.error("未知用户!");
@@ -45,7 +45,7 @@ public class SysIosRedeem implements Serializable {
/** /**
* 使用状态 0-未使用 1-已使用 * 使用状态 0-未使用 1-已使用
*/ */
@TableField(value = "`status`") @TableField(value = "status")
@Schema(title = "使用状态 0-未使用 1-已使用") @Schema(title = "使用状态 0-未使用 1-已使用")
private Byte status; private Byte status;
/** /**
@@ -59,14 +59,14 @@ public class DepartCacheManager {
initDepartCache(); initDepartCache();
log.info("========缓存部门信息完成========"); log.info("========缓存部门信息完成========");
}); });
// 新疆项目无需缓存青海部门
taskExecutor.execute(() -> { // taskExecutor.execute(() -> {
ClientSignThreadLocal.setClientSign(CommonConstant.QUARRY); // ClientSignThreadLocal.setClientSign(CommonConstant.QUARRY);
log.info("========缓存青海部门信息开始========"); // log.info("========缓存青海部门信息开始========");
initDepartCache(); // initDepartCache();
log.info("========缓存青海部门信息完成========"); // log.info("========缓存青海部门信息完成========");
ClientSignThreadLocal.clear(); // ClientSignThreadLocal.clear();
}); // });
} }
private void initDepartCache() { private void initDepartCache() {
@@ -146,15 +146,16 @@ public class UserCacheManager {
log.info("缓存用户信息完成"); log.info("缓存用户信息完成");
}); });
asyncTaskExecutor.execute(() -> { // 新疆项目无需缓存青海用户
ClientSignThreadLocal.setClientSign(CommonConstant.QUARRY); // asyncTaskExecutor.execute(() -> {
log.info("缓存青海用户信息开始"); // ClientSignThreadLocal.setClientSign(CommonConstant.QUARRY);
// 青海用户缓存 // log.info("缓存青海用户信息开始");
delCacheUser(); // // 青海用户缓存
initUserCache(); // delCacheUser();
log.info("缓存青海用户信息完成"); // initUserCache();
ClientSignThreadLocal.clear(); // log.info("缓存青海用户信息完成");
}); // ClientSignThreadLocal.clear();
// });
} }
private String getRedisKey() { private String getRedisKey() {
@@ -328,7 +328,7 @@ public interface SysUserMapper extends BaseMapper<SysUser>, MPJBaseMapper<SysUse
* 分组统计所有部门下的员工数量 * 分组统计所有部门下的员工数量
* @return 所有orgCode的统计人数数据 * @return 所有orgCode的统计人数数据
*/ */
@Select("SELECT org_code as orgCode,COUNT(1) as peopleNumber FROM `sys_user` where person_type =1 and del_flag = 0 and `status` =1 and org_code is not null GROUP BY org_code") @Select("SELECT org_code as orgCode,COUNT(1) as peopleNumber FROM sys_user where person_type =1 and del_flag = 0 and status =1 and org_code is not null GROUP BY org_code")
List<OrgPeopleNumberVO> statisticOrgPeopleNumber(); List<OrgPeopleNumberVO> statisticOrgPeopleNumber();
/** /**
@@ -336,7 +336,7 @@ public interface SysUserMapper extends BaseMapper<SysUser>, MPJBaseMapper<SysUse
* @param orgCode 部门 * @param orgCode 部门
* @return 人数 * @return 人数
*/ */
@Select("SELECT COUNT(1) FROM `sys_user` where person_type =1 and del_flag = 0 and `status` =1 and org_code is not null and org_code like concat(#{orgCode},'%')") @Select("SELECT COUNT(1) FROM sys_user where person_type =1 and del_flag = 0 and status =1 and org_code is not null and org_code like concat(#{orgCode},'%')")
Long statisticPeopleNumberByOrgCode(@Param("orgCode") String orgCode); Long statisticPeopleNumberByOrgCode(@Param("orgCode") String orgCode);
/** /**
@@ -346,8 +346,8 @@ public interface SysUserMapper extends BaseMapper<SysUser>, MPJBaseMapper<SysUse
*/ */
@Select("<script> " + @Select("<script> " +
"SELECT id as id,org_code as orgCode " + "SELECT id as id,org_code as orgCode " +
"FROM `sys_user` " + "FROM sys_user " +
"where del_flag = 0 and `status` =1 and id in " + "where del_flag = 0 and status =1 and id in " +
"<foreach item='item' index='index' collection='userIdSet' open='(' separator=',' close=')'> #{item} </foreach> " + "<foreach item='item' index='index' collection='userIdSet' open='(' separator=',' close=')'> #{item} </foreach> " +
"</script> ") "</script> ")
@MapKey("id") @MapKey("id")
@@ -44,7 +44,7 @@
<where> <where>
and a.del_flag = '0' and a.del_flag = '0'
<if test="healthUserDoctorEx.id != null and healthUserDoctorEx.id != ''"> <if test="healthUserDoctorEx.id != null and healthUserDoctorEx.id != ''">
and FIND_IN_SET(a.id,#{#{healthUserDoctorEx.id}}) and INSTR(',' || #{healthUserDoctorEx.id} || ',', ',' || a.id || ',') > 0
</if> </if>
<if test="healthUserDoctorEx.hospitalId != null and healthUserDoctorEx.hospitalId != ''"> <if test="healthUserDoctorEx.hospitalId != null and healthUserDoctorEx.hospitalId != ''">
and a.hospital_id = #{healthUserDoctorEx.hospitalId} and a.hospital_id = #{healthUserDoctorEx.hospitalId}
@@ -2,10 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.system.mapper.HealthUserEmployeeExMapper"> <mapper namespace="org.jeecg.modules.system.mapper.HealthUserEmployeeExMapper">
<sql id="UserEmployeeCols"> <sql id="UserEmployeeCols">
a a.id,
.
id
,
emp_id, emp_id,
emp_no, emp_no,
emp_sysno, emp_sysno,
@@ -66,7 +63,7 @@
medical_work_type_other, medical_work_type_other,
username, username,
realname, realname,
`password`, password,
salt, salt,
avatar, avatar,
birthday, birthday,
@@ -87,7 +84,7 @@
client_id, client_id,
login_tenant_id, login_tenant_id,
bpm_status, bpm_status,
`status`, status,
b.del_flag, b.del_flag,
create_by, create_by,
create_time, create_time,
@@ -315,9 +312,11 @@
<choose> <choose>
<when test="filter.idList != null and !filter.idList.isEmpty()"> <when test="filter.idList != null and !filter.idList.isEmpty()">
order by order by
FIELD(b.id, <foreach collection="filter.idList" item="id" separator="," open="" close=""> CASE b.id
#{id} <foreach collection="filter.idList" item="id" index="idx" separator=" ">
</foreach>) ASC, b.create_time DESC WHEN #{id} THEN #{idx}
</foreach>
ELSE 99999 END ASC, b.create_time DESC
</when> </when>
<otherwise> <otherwise>
order by b.create_time DESC order by b.create_time DESC
@@ -616,7 +615,7 @@
t2.org_code, t2.org_code,
t2.sex, t2.sex,
t2.id_card, t2.id_card,
IF(t2.user_group IS NULL OR t2.user_group = '', 'e', t2.user_group) AS userGroup, CASE WHEN t2.user_group IS NULL OR t2.user_group = '' THEN 'e' ELSE t2.user_group END AS userGroup,
t2.user_group, t2.user_group,
t2.user_group_update_time, t2.user_group_update_time,
t2.avatar, t2.avatar,
@@ -1101,15 +1100,21 @@
<update id="updateAge"> <update id="updateAge">
UPDATE health_user_employee_ex he UPDATE health_user_employee_ex he
JOIN sys_user su SET he.current_age = (
ON he.id = su.id SELECT FLOOR((CURRENT_DATE - TO_DATE(SUBSTRING(REPLACE(su.id_card, ' ', ''), 7, 8), 'YYYYMMDD')) / 365)
SET he.current_age = FLOOR(DATEDIFF(CURDATE(), STR_TO_DATE(SUBSTRING (REPLACE(su.id_card, ' ', ''), 7, 8), '%Y%m%d')) / 365) FROM sys_user su
WHERE WHERE he.id = su.id
LENGTH (REPLACE(su.id_card AND LENGTH(REPLACE(su.id_card, ' ', '')) = 18
, ' ' AND su.person_type = '1'
, '')) = 18 AND su.del_flag = 0
and su.person_type = '1' )
and su.del_flag = 0; WHERE EXISTS (
SELECT 1 FROM sys_user su
WHERE he.id = su.id
AND LENGTH(REPLACE(su.id_card, ' ', '')) = 18
AND su.person_type = '1'
AND su.del_flag = 0
)
</update> </update>
</mapper> </mapper>
@@ -46,7 +46,7 @@
<where> <where>
and a.del_flag = '0' and a.del_flag = '0'
<if test="healthUserOperatorEx.userId != null and healthUserOperatorEx.userId != ''"> <if test="healthUserOperatorEx.userId != null and healthUserOperatorEx.userId != ''">
and FIND_IN_SET(a.user_id,#{healthUserOperatorEx.userId}) and INSTR(',' || #{healthUserOperatorEx.userId} || ',', ',' || a.user_id || ',') > 0
</if> </if>
<if test="healthUserOperatorEx.userType != null and healthUserOperatorEx.userType != ''"> <if test="healthUserOperatorEx.userType != null and healthUserOperatorEx.userType != ''">
and a.user_type = #{healthUserOperatorEx.userType} and a.user_type = #{healthUserOperatorEx.userType}
@@ -9,7 +9,7 @@
t2.work_no, t2.work_no,
t2.org_code as userOrgCode t2.org_code as userOrgCode
FROM FROM
`scale_personal` t1 scale_personal t1
LEFT JOIN sys_user t2 on t1.bind_user_id = t2.id LEFT JOIN sys_user t2 on t1.bind_user_id = t2.id
<where> <where>
<if test="managedCodes != null and managedCodes.size() > 0"> <if test="managedCodes != null and managedCodes.size() > 0">
@@ -74,7 +74,7 @@
AND t2.org_code like CONCAT(#{filter.userOrgCode}, '%') AND t2.org_code like CONCAT(#{filter.userOrgCode}, '%')
</if> </if>
</where> </where>
ORDER BY IF(t1.bind_user_id IS NOT NULL AND t1.bind_user_id != '', 0, 1) ORDER BY CASE WHEN t1.bind_user_id IS NOT NULL AND t1.bind_user_id != '' THEN 0 ELSE 1 END
</select> </select>
<select id="getUserInfoBySnCode" resultType="org.jeecg.modules.system.bean.response.ScalePersonalUserInfo"> <select id="getUserInfoBySnCode" resultType="org.jeecg.modules.system.bean.response.ScalePersonalUserInfo">
@@ -107,7 +107,7 @@
and status = 1 and status = 1
and depart_ids is not null and depart_ids is not null
and depart_ids != '' and depart_ids != ''
and FIND_IN_SET(#{departId}, depart_ids) > 0 and INSTR(',' || depart_ids || ',', ',' || #{departId} || ',') > 0
<if test="name != null and name != '' "> <if test="name != null and name != '' ">
and realname like CONCAT('%',#{name},'%') and realname like CONCAT('%',#{name},'%')
</if> </if>
@@ -136,10 +136,10 @@
where sd.del_flag = '0' and sd.status = '1' where sd.del_flag = '0' and sd.status = '1'
</select> </select>
<select id="queryDepartIdsByCodes" resultType="java.lang.String" parameterType="java.lang.String"> <select id="queryDepartIdsByCodes" resultType="java.lang.String" parameterType="java.lang.String">
select GROUP_CONCAT(id) from sys_depart where FIND_IN_SET(org_code,#{orgCodes})>0 select LISTAGG(id, ',') WITHIN GROUP (ORDER BY id) from sys_depart where INSTR(',' || #{orgCodes} || ',', ',' || org_code || ',') > 0
</select> </select>
<select id="queryCodesByDepartIds" resultType="java.lang.String" parameterType="java.lang.String"> <select id="queryCodesByDepartIds" resultType="java.lang.String" parameterType="java.lang.String">
select GROUP_CONCAT(org_code) from sys_depart where FIND_IN_SET(id,#{departIds})>0 select LISTAGG(org_code, ',') WITHIN GROUP (ORDER BY org_code) from sys_depart where INSTR(',' || #{departIds} || ',', ',' || id || ',') > 0
</select> </select>
<insert id="insertGps"> <insert id="insertGps">
insert into sys_depart_gps (id, depart_id, lng, lat) insert into sys_depart_gps (id, depart_id, lng, lat)
@@ -165,7 +165,7 @@
b.lng, b.lng,
b.lat b.lat
from sys_depart a left join sys_depart_gps b on a.id = b.depart_id from sys_depart a left join sys_depart_gps b on a.id = b.depart_id
where FIND_IN_SET(a.id,#{departId}) where INSTR(',' || #{departId} || ',', ',' || a.id || ',') > 0
</select> </select>
@@ -12,6 +12,6 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, app_package, redeem_code, `status`, use_time id, app_package, redeem_code, status, use_time
</sql> </sql>
</mapper> </mapper>
@@ -55,7 +55,7 @@
t3.realname AS applyUserName, t3.realname AS applyUserName,
t5.realname AS opUserName, t5.realname AS opUserName,
t4.current_age AS age t4.current_age AS age
FROM `sys_user_depart_change_apply` t1 FROM sys_user_depart_change_apply t1
LEFT JOIN sys_user t2 ON t1.user_id = t2.id LEFT JOIN sys_user t2 ON t1.user_id = t2.id
LEFT JOIN sys_user t3 ON t1.apply_user_id = t3.id LEFT JOIN sys_user t3 ON t1.apply_user_id = t3.id
LEFT JOIN health_user_employee_ex t4 ON t1.user_id = t4.id LEFT JOIN health_user_employee_ex t4 ON t1.user_id = t4.id
@@ -137,7 +137,7 @@
user_id, user_id,
create_time create_time
FROM FROM
`sys_user_depart_change_apply` sys_user_depart_change_apply
</sql> </sql>
<sql id="statWhereSql"> <sql id="statWhereSql">
and create_time between #{beginOfYear} and #{endOfYear} and create_time between #{beginOfYear} and #{endOfYear}
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.system.mapper.SysUserMapper"> <mapper namespace="org.jeecg.modules.system.mapper.SysUserMapper">
<insert id="batchInsert" parameterType="java.util.List"> <insert id="batchInsert" parameterType="java.util.List">
insert IGNORE into sys_user (id, username, realname, password, salt, avatar, birthday, id_card,person_type, sex, insert into sys_user (id, username, realname, password, salt, avatar, birthday, id_card,person_type, sex,
email, phone, org_code, work_no, post, create_time, update_time, user_identity) email, phone, org_code, work_no, post, create_time, update_time, user_identity)
values values
<foreach collection="list" item="t" index="index" separator=","> <foreach collection="list" item="t" index="index" separator=",">
@@ -275,7 +275,7 @@
<select id="selectGroupIdByName" resultType="String"> <select id="selectGroupIdByName" resultType="String">
select select
GROUP_CONCAT(id) LISTAGG(id, ',') WITHIN GROUP (ORDER BY id)
from sys_user from sys_user
where realname LIKE concat(concat('%',#{realName}),'%') where realname LIKE concat(concat('%',#{realName}),'%')
</select> </select>
@@ -400,11 +400,11 @@
select id as "userId", select id as "userId",
org_code as "orgCode" org_code as "orgCode"
from sys_user from sys_user
where FIND_IN_SET(id,#{userIds}) where INSTR(',' || #{userIds} || ',', ',' || id || ',') > 0
</select> </select>
<select id="getUserNumByOrgCodeList" resultType="java.util.HashMap"> <select id="getUserNumByOrgCodeList" resultType="java.util.HashMap">
SELECT org_code as orgCode, count(org_code) as num SELECT org_code as orgCode, count(org_code) as num
FROM `sys_user` FROM sys_user
WHERE org_code LIKE WHERE org_code LIKE
<foreach collection="orgCodeList" item="orgCode" separator=" OR " open="(" close=")"> <foreach collection="orgCodeList" item="orgCode" separator=" OR " open="(" close=")">
CONCAT('', #{orgCode}, '%') CONCAT('', #{orgCode}, '%')
@@ -437,7 +437,7 @@
<select id="selectUserIdByWorkNo" resultType="String"> <select id="selectUserIdByWorkNo" resultType="String">
select id from sys_user where del_flag = 0 and work_no = #{workNo} limit 1 select id from sys_user where del_flag = 0 and work_no = #{workNo} FETCH FIRST 1 ROWS ONLY
</select> </select>
@@ -582,24 +582,24 @@
</select> </select>
<select id="checkExistUser" resultType="org.jeecg.bean.response.CheckExistUserRes"> <select id="checkExistUser" resultType="org.jeecg.bean.response.CheckExistUserRes">
SELECT 'account' ,1 as count SELECT 'account' as account, 1 as count
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
UNION ALL UNION ALL
select 'userName', count(1) as count FROM sys_user WHERE username = #{userName} and del_flag = 0 select 'userName' as account, CAST(count(1) AS INT) as count FROM sys_user WHERE username = #{userName} and del_flag = 0
<if test="existUserId != null and existUserId != ''"> <if test="existUserId != null and existUserId != ''">
and id != #{existUserId} and id != #{existUserId}
</if> </if>
</if> </if>
<if test="mobile != null and mobile != ''"> <if test="mobile != null and mobile != ''">
UNION ALL UNION ALL
select 'mobile', count(1) as count FROM sys_user WHERE phone = #{mobile} and del_flag = 0 select 'mobile' as account, CAST(count(1) AS INT) as count FROM sys_user WHERE phone = #{mobile} and del_flag = 0
<if test="existUserId != null and existUserId != ''"> <if test="existUserId != null and existUserId != ''">
and id != #{existUserId} and id != #{existUserId}
</if> </if>
</if> </if>
<if test="idCard != null and idCard != ''"> <if test="idCard != null and idCard != ''">
UNION ALL UNION ALL
select 'idCard', count(1) as count FROM sys_user WHERE id_card = #{idCard} and del_flag = 0 select 'idCard' as account, CAST(count(1) AS INT) as count FROM sys_user WHERE id_card = #{idCard} and del_flag = 0
<if test="existUserId != null and existUserId != ''"> <if test="existUserId != null and existUserId != ''">
and id != #{existUserId} and id != #{existUserId}
</if> </if>
@@ -1016,7 +1016,7 @@
LEFT JOIN health_user_employee_ex e on u.id = e.id LEFT JOIN health_user_employee_ex e on u.id = e.id
WHERE 1=1 WHERE 1=1
<if test="ex.sex != null and ex.sex != ''"> <if test="ex.sex != null and ex.sex != ''">
AND FIND_IN_SET(u.sex, #{ex.sex}) AND INSTR(',' || #{ex.sex} || ',', ',' || u.sex || ',') > 0
</if> </if>
<if test="ex.dataAgeAnalysis != null and ex.dataAgeAnalysis != ''"> <if test="ex.dataAgeAnalysis != null and ex.dataAgeAnalysis != ''">
AND ( AND (
@@ -1029,19 +1029,19 @@
) )
</if> </if>
<if test="ex.empNation != null and ex.empNation != ''"> <if test="ex.empNation != null and ex.empNation != ''">
AND FIND_IN_SET(e.emp_nation, #{ex.empNation}) AND INSTR(',' || #{ex.empNation} || ',', ',' || e.emp_nation || ',') > 0
</if> </if>
<if test="ex.empPolitical != null and ex.empPolitical != ''"> <if test="ex.empPolitical != null and ex.empPolitical != ''">
AND FIND_IN_SET(e.emp_political, #{ex.empPolitical}) AND INSTR(',' || #{ex.empPolitical} || ',', ',' || e.emp_political || ',') > 0
</if> </if>
<if test="ex.jobLevel != null and ex.jobLevel != ''"> <if test="ex.jobLevel != null and ex.jobLevel != ''">
AND FIND_IN_SET(e.job_level, #{ex.jobLevel}) AND INSTR(',' || #{ex.jobLevel} || ',', ',' || e.job_level || ',') > 0
</if> </if>
<if test="ex.empMarriage != null and ex.empMarriage != ''"> <if test="ex.empMarriage != null and ex.empMarriage != ''">
AND FIND_IN_SET(e.emp_marriage, #{ex.empMarriage}) AND INSTR(',' || #{ex.empMarriage} || ',', ',' || e.emp_marriage || ',') > 0
</if> </if>
<if test="ex.userGroup != null and ex.userGroup != ''"> <if test="ex.userGroup != null and ex.userGroup != ''">
AND FIND_IN_SET(u.user_group, #{ex.userGroup}) AND INSTR(',' || #{ex.userGroup} || ',', ',' || u.user_group || ',') > 0
</if> </if>
<if test="ex.orgCodeList != null and ex.orgCodeList.size() > 0"> <if test="ex.orgCodeList != null and ex.orgCodeList.size() > 0">
AND ( AND (
@@ -1120,7 +1120,7 @@
<select id="userInfoMap" resultType="org.jeecg.modules.system.bean.response.UserBmiGroupInfo"> <select id="userInfoMap" resultType="org.jeecg.modules.system.bean.response.UserBmiGroupInfo">
SELECT SELECT
t1.id_card, t1.id_card,
IFNULL( t1.user_group, 'e' ) AS user_group, NVL( t1.user_group, 'e' ) AS user_group,
t2.height, t2.height,
t2.weight, t2.weight,
t2.bmi, t2.bmi,
@@ -108,7 +108,7 @@
and svi.device_type = #{deviceType} and svi.device_type = #{deviceType}
and sva.package_name = #{packageName} and sva.package_name = #{packageName}
order by svi.version_no desc order by svi.version_no desc
limit 1 FETCH FIRST 1 ROWS ONLY
</select> </select>
@@ -19,7 +19,7 @@
</foreach> </foreach>
</if> </if>
<if test="dateStr != null"> <if test="dateStr != null">
AND DATE(create_time) = #{dateStr} AND TRUNC(create_time) = #{dateStr}
</if> </if>
</where> </where>
GROUP BY user_id ) GROUP BY user_id )
@@ -50,10 +50,10 @@
<select id="getUserBwhMin" resultType="org.jeecg.bean.entity.UserDataRecordBWH"> <select id="getUserBwhMin" resultType="org.jeecg.bean.entity.UserDataRecordBWH">
SELECT * SELECT *
FROM user_data_record_bwh FROM user_data_record_bwh
WHERE DATE(create_time) = (SELECT MAX(DATE(create_time)) FROM user_data_record_bwh where user_id = #{userId}) WHERE TRUNC(create_time) = (SELECT MAX(TRUNC(create_time)) FROM user_data_record_bwh where user_id = #{userId})
and user_id = #{userId} and user_id = #{userId}
ORDER BY waist ASC ORDER BY waist ASC
LIMIT 1 FETCH FIRST 1 ROWS ONLY
</select> </select>
</mapper> </mapper>
@@ -581,7 +581,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
LambdaQueryWrapper<UserDataRecordBmi> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<UserDataRecordBmi> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(UserDataRecordBmi::getUserId, userId) queryWrapper.eq(UserDataRecordBmi::getUserId, userId)
.orderByDesc(UserDataRecordBmi::getDataDate) .orderByDesc(UserDataRecordBmi::getDataDate)
.last("limit 1"); .last("FETCH FIRST 1 ROWS ONLY");
return queryWrapper; return queryWrapper;
} }
@@ -1180,7 +1180,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
} else { } else {
sysUnit = sysDepartService.lambdaQuery() sysUnit = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, userEmployeeVo.getUnit()) .eq(SysDepart::getDepartName, userEmployeeVo.getUnit())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
if (Objects.isNull(sysUnit)) { if (Objects.isNull(sysUnit)) {
return Result.error(userEmployeeVo.getRealname() + "上传的单位错误,不存在该单位!"); return Result.error(userEmployeeVo.getRealname() + "上传的单位错误,不存在该单位!");
} }
@@ -1191,7 +1191,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
SysDepart sysDepart = sysDepartService.lambdaQuery() SysDepart sysDepart = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, userEmployeeVo.getDepart()) .eq(SysDepart::getDepartName, userEmployeeVo.getDepart())
.eq(SysDepart::getParentId, sysUnit.getId()) .eq(SysDepart::getParentId, sysUnit.getId())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
if (Objects.isNull(sysDepart)) { if (Objects.isNull(sysDepart)) {
return Result.error(userEmployeeVo.getRealname() + "上传的部门错误,上传单位不存在该部门!"); return Result.error(userEmployeeVo.getRealname() + "上传的部门错误,上传单位不存在该部门!");
} else { } else {
@@ -1343,7 +1343,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
} else { } else {
sysUnit = sysDepartService.lambdaQuery() sysUnit = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, userEmployeeVo.getUnit()) .eq(SysDepart::getDepartName, userEmployeeVo.getUnit())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
if (Objects.isNull(sysUnit)) { if (Objects.isNull(sysUnit)) {
sd.append("上传的单位错误,不存在该单位!"); sd.append("上传的单位错误,不存在该单位!");
} }
@@ -1356,7 +1356,7 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
sysDepart = sysDepartService.lambdaQuery() sysDepart = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, userEmployeeVo.getDepart()) .eq(SysDepart::getDepartName, userEmployeeVo.getDepart())
.eq(SysDepart::getParentId, sysUnit.getId()) .eq(SysDepart::getParentId, sysUnit.getId())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
} }
if (Objects.isNull(sysDepart)) { if (Objects.isNull(sysDepart)) {
sd.append("上传的部门错误,上传单位不存在该部门!"); sd.append("上传的部门错误,上传单位不存在该部门!");
@@ -1490,11 +1490,11 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
//处理单位及部门 //处理单位及部门
SysDepart sysUnit = sysDepartService.lambdaQuery() SysDepart sysUnit = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, userEmployeeVo.getUnit()) .eq(SysDepart::getDepartName, userEmployeeVo.getUnit())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
SysDepart sysDepart = sysDepartService.lambdaQuery() SysDepart sysDepart = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, userEmployeeVo.getDepart()) .eq(SysDepart::getDepartName, userEmployeeVo.getDepart())
.eq(SysDepart::getParentId, sysUnit != null ? sysUnit.getId() : "") .eq(SysDepart::getParentId, sysUnit != null ? sysUnit.getId() : "")
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
//userEmployee的orgCode是id,顾将orgCode替换成id //userEmployee的orgCode是id,顾将orgCode替换成id
userEmployee.setOrgCode(sysDepart != null ? sysDepart.getId() : null); userEmployee.setOrgCode(sysDepart != null ? sysDepart.getId() : null);
BeanUtils.copyProperties(userEmployeeVo, userEmployee); BeanUtils.copyProperties(userEmployeeVo, userEmployee);
@@ -1565,14 +1565,14 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
} }
SysDepart sysUnit = sysDepartService.lambdaQuery() SysDepart sysUnit = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, sysDepartVo.getUnit()) .eq(SysDepart::getDepartName, sysDepartVo.getUnit())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
if (Objects.isNull(sysUnit)) { if (Objects.isNull(sysUnit)) {
return Result.error("上传的单位错误,不存在该单位!"); return Result.error("上传的单位错误,不存在该单位!");
} }
SysDepart sysDepart = sysDepartService.lambdaQuery() SysDepart sysDepart = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, sysDepartVo.getDepart()) .eq(SysDepart::getDepartName, sysDepartVo.getDepart())
.eq(SysDepart::getParentId, sysUnit.getId()) .eq(SysDepart::getParentId, sysUnit.getId())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
if (Objects.isNull(sysDepart)) { if (Objects.isNull(sysDepart)) {
return Result.error("上传的部门错误,上传单位不存在该部门!"); return Result.error("上传的部门错误,上传单位不存在该部门!");
} }
@@ -1666,14 +1666,14 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
} }
SysDepart sysUnit = sysDepartService.lambdaQuery() SysDepart sysUnit = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, sysDepartVo.getUnit()) .eq(SysDepart::getDepartName, sysDepartVo.getUnit())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
if (Objects.isNull(sysUnit)) { if (Objects.isNull(sysUnit)) {
sd.append("上传的单位错误,不存在该单位!"); sd.append("上传的单位错误,不存在该单位!");
} }
SysDepart sysDepart = sysDepartService.lambdaQuery() SysDepart sysDepart = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, sysDepartVo.getDepart()) .eq(SysDepart::getDepartName, sysDepartVo.getDepart())
.eq(SysDepart::getParentId, sysUnit.getId()) .eq(SysDepart::getParentId, sysUnit.getId())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
if (Objects.isNull(sysDepart)) { if (Objects.isNull(sysDepart)) {
sd.append("上传的部门错误,上传单位不存在该部门!"); sd.append("上传的部门错误,上传单位不存在该部门!");
} }
@@ -1751,14 +1751,14 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
.eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0) .eq(SysUser::getDelFlag, CommonConstant.DEL_FLAG_0)
.eq(SysUser::getPersonType, "1") .eq(SysUser::getPersonType, "1")
// .eq(SysUser::getWorkNo, sysDepartVo.getWorkNo())//工号有空的,这里不根据工号查 // .eq(SysUser::getWorkNo, sysDepartVo.getWorkNo())//工号有空的,这里不根据工号查
.last("LIMIT 1").one(); .last("FETCH FIRST 1 ROWS ONLY").one();
SysDepart sysUnit = sysDepartService.lambdaQuery() SysDepart sysUnit = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, sysDepartVo.getUnit()) .eq(SysDepart::getDepartName, sysDepartVo.getUnit())
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
SysDepart sysDepart = sysDepartService.lambdaQuery() SysDepart sysDepart = sysDepartService.lambdaQuery()
.eq(SysDepart::getDepartName, sysDepartVo.getDepart()) .eq(SysDepart::getDepartName, sysDepartVo.getDepart())
.eq(SysDepart::getParentId, sysUnit != null ? sysUnit.getId() : "") .eq(SysDepart::getParentId, sysUnit != null ? sysUnit.getId() : "")
.orderByDesc(SysDepart::getUpdateTime).last("LIMIT 1").one(); .orderByDesc(SysDepart::getUpdateTime).last("FETCH FIRST 1 ROWS ONLY").one();
LambdaUpdateChainWrapper<SysUser> lambdaUpdate = sysUserService.lambdaUpdate(); LambdaUpdateChainWrapper<SysUser> lambdaUpdate = sysUserService.lambdaUpdate();
lambdaUpdate.eq(SysUser::getIdCard, sysDepartVo.getIdCard()); lambdaUpdate.eq(SysUser::getIdCard, sysDepartVo.getIdCard());
if (!StrUtil.isBlank(sysDepartVo.getRealName())) { if (!StrUtil.isBlank(sysDepartVo.getRealName())) {
@@ -149,7 +149,7 @@ public class SysAnonServiceImpl implements ISysAnonService {
LambdaQueryWrapper<SysIosRedeem> queryWrapper = Wrappers.<SysIosRedeem>lambdaQuery() LambdaQueryWrapper<SysIosRedeem> queryWrapper = Wrappers.<SysIosRedeem>lambdaQuery()
.eq(SysIosRedeem::getAppPackage, pkg) .eq(SysIosRedeem::getAppPackage, pkg)
.eq(SysIosRedeem::getStatus, 0) .eq(SysIosRedeem::getStatus, 0)
.last("LIMIT 1 OFFSET 0"); .last("FETCH FIRST 1 ROWS ONLY");
SysIosRedeem sysIosRedeem = sysIosRedeemMapper.selectOne(queryWrapper); SysIosRedeem sysIosRedeem = sysIosRedeemMapper.selectOne(queryWrapper);
if (Objects.isNull(sysIosRedeem)) { if (Objects.isNull(sysIosRedeem)) {
ExceptionAssertsUtil.fail("未找到指定应用"); ExceptionAssertsUtil.fail("未找到指定应用");
@@ -1193,6 +1193,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
String dbType = md.getDatabaseProductName().toLowerCase(); String dbType = md.getDatabaseProductName().toLowerCase();
if (dbType.indexOf(DataBaseConstant.DB_TYPE_MYSQL.toLowerCase()) >= 0) { if (dbType.indexOf(DataBaseConstant.DB_TYPE_MYSQL.toLowerCase()) >= 0) {
DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL; DB_TYPE = DataBaseConstant.DB_TYPE_MYSQL;
} else if (dbType.indexOf(DataBaseConstant.DB_TYPE_DM.toLowerCase()) >= 0) {
// 达梦数据库:getDatabaseProductName() 返回 "DM DBMS"
DB_TYPE = DataBaseConstant.DB_TYPE_DM;
} else if (dbType.indexOf(DataBaseConstant.DB_TYPE_ORACLE.toLowerCase()) >= 0) { } else if (dbType.indexOf(DataBaseConstant.DB_TYPE_ORACLE.toLowerCase()) >= 0) {
DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE; DB_TYPE = DataBaseConstant.DB_TYPE_ORACLE;
} else if (dbType.indexOf(DataBaseConstant.DB_TYPE_SQLSERVER.toLowerCase()) >= 0 || dbType.indexOf(DataBaseConstant.DB_TYPE_SQL_SERVER_BLANK) >= 0) { } else if (dbType.indexOf(DataBaseConstant.DB_TYPE_SQLSERVER.toLowerCase()) >= 0 || dbType.indexOf(DataBaseConstant.DB_TYPE_SQL_SERVER_BLANK) >= 0) {
@@ -439,7 +439,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysUser::getStatus, "1") queryWrapper.eq(SysUser::getStatus, "1")
.eq(SysUser::getDelFlag, "0") .eq(SysUser::getDelFlag, "0")
.apply("FIND_IN_SET({0}, depart_ids) > 0", departId); .apply("INSTR(',' || depart_ids || ',', ',' || {0} || ',') > 0", departId);
List<SysUser> sysUsers = sysUserMapper.selectList(queryWrapper); List<SysUser> sysUsers = sysUserMapper.selectList(queryWrapper);
if (CollectionUtil.isEmpty(sysUsers)) { if (CollectionUtil.isEmpty(sysUsers)) {
@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
@@ -22,7 +23,7 @@ import java.net.UnknownHostException;
* @date: 2022/4/21 10:55 * @date: 2022/4/21 10:55
*/ */
@Slf4j @Slf4j
@SpringBootApplication(scanBasePackages = {"com.renkang", "org.jeecg"}) @SpringBootApplication(scanBasePackages = {"com.renkang", "org.jeecg"},exclude = QuartzAutoConfiguration.class)
@EnableFeignClients(basePackages = {"org.jeecg", "com.renkang"}) @EnableFeignClients(basePackages = {"org.jeecg", "com.renkang"})
@EnableScheduling @EnableScheduling
public class JeecgSystemCloudApplication extends SpringBootServletInitializer { public class JeecgSystemCloudApplication extends SpringBootServletInitializer {
@@ -1,8 +1,8 @@
PROFILE_NAME=dev PROFILE_NAME=dev
SERVER_PORT=7001 SERVER_PORT=7001
NACOS_SERVER_ADDR=localhost:8848 NACOS_SERVER_ADDR=192.168.1.80:8848
NACOS_USERNAME=nacos NACOS_USERNAME=xjuser
NACOS_PASSWORD=nacos NACOS_PASSWORD=Aa135790!123
NACOS_NAMESPACE=f3f65fb2-303b-4bf7-bccb-4755886503c1 NACOS_NAMESPACE=xjxc-space-common
NACOS_GROUP=dev NACOS_NAMESPACE_DISCOVERY=xjxc-space-common
FILE_SERVER_URL=http://fileserver.yg.dt.io NACOS_GROUP=dev
@@ -21,7 +21,7 @@ spring:
password: ${spring.cloud.nacos.password} password: ${spring.cloud.nacos.password}
discovery: discovery:
enabled: true enabled: true
namespace: ${NACOS_NAMESPACE:} namespace: ${NACOS_NAMESPACE_DISCOVERY:}
group: ${NACOS_GROUP:DEFAULT_GROUP} group: ${NACOS_GROUP:DEFAULT_GROUP}
server-addr: ${spring.cloud.nacos.server-addr} server-addr: ${spring.cloud.nacos.server-addr}
username: ${spring.cloud.nacos.username} username: ${spring.cloud.nacos.username}
+9 -2
View File
@@ -46,7 +46,8 @@
<!-- 数据库驱动 --> <!-- 数据库驱动 -->
<oracle-database.version>21.13.0.0</oracle-database.version> <oracle-database.version>21.13.0.0</oracle-database.version>
<mssql-jdbc.version>12.6.1.jre8</mssql-jdbc.version> <mssql-jdbc.version>12.6.1.jre8</mssql-jdbc.version>
<mysql.version>8.4.0</mysql.version> <!-- 达梦8数据库驱动版本 -->
<dm8.version>8.1.4.181</dm8.version>
<postgresql.version>42.6.2</postgresql.version> <postgresql.version>42.6.2</postgresql.version>
<!-- 持久层 --> <!-- 持久层 -->
@@ -642,6 +643,12 @@
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId> <artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
<version>${knife4j-spring-boot-starter.version}</version> <version>${knife4j-spring-boot-starter.version}</version>
</dependency> </dependency>
<!-- Source: https://mvnrepository.com/artifact/com.dameng/DmJdbcDriver8 -->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver8</artifactId>
<version>${dm8.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@@ -695,7 +702,7 @@
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<filtering>true</filtering> <filtering>true</filtering>
<excludes> <excludes>
<exclude>.env</exclude> <!--<exclude>.env</exclude>-->
<exclude>rebel.xml</exclude> <exclude>rebel.xml</exclude>
</excludes> </excludes>
</resource> </resource>