From c4ea4cf098ec9fb74aa82530970c9c2e98aec6b8 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期二, 15 四月 2025 14:46:50 +0800 Subject: [PATCH] 同步字典从数据库查询 --- src/main/java/com/example/scheudleds/DictSyncCommon.java | 11 + src/main/java/com/example/mapper/DictHospMapper.java | 18 ++ src/main/java/com/example/domain/DictHosp.java | 310 ++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/DictHospMapper.xml | 54 ++++++ src/main/java/com/example/service/impl/DictHospServiceImpl.java | 22 ++ src/main/java/com/example/service/DictHospService.java | 13 + 6 files changed, 427 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/example/domain/DictHosp.java b/src/main/java/com/example/domain/DictHosp.java new file mode 100644 index 0000000..211a5c6 --- /dev/null +++ b/src/main/java/com/example/domain/DictHosp.java @@ -0,0 +1,310 @@ +package com.example.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.util.Arrays; +import java.util.Date; +import lombok.Data; + +/** + * 闄㈠尯淇℃伅琛� + * @TableName dict_hosp + */ +@TableName(value ="dict_hosp") +@Data +public class DictHosp implements Serializable { + /** + * 闄㈠尯ID + */ + @TableId + private String hospAreaId; + + /** + * 闄㈠尯鍚嶇О + */ + private String hospAreaName; + + /** + * 鍖荤枟鏈烘瀯ID + */ + private String hospid; + + /** + * 鍖荤枟鏈烘瀯鍚嶇О + */ + private String hospName; + + /** + * 闄㈠尯缂栫爜 + */ + private String code; + + /** + * 浜旂瑪绠�鐮� + */ + private String wbm; + + /** + * 鎷奸煶绠�鐮� + */ + private String spell; + + /** + * 琛屾斂鍖哄垝ID + */ + private String areaid; + + /** + * 琛屾斂鍖哄垝鍚嶇О + */ + private String areaName; + + /** + * 鏄惁涓婚櫌鍖� 0-涓嶆槸 1-鏄� + */ + private String mainHospArea; + + /** + * 璐熻矗浜� + */ + private String principal; + + /** + * 璐熻矗浜虹數璇� + */ + private String phone; + + /** + * 缂栧埗搴婁綅鏁� + */ + private Integer plaitBed; + + /** + * 寮�鏀惧簥浣嶆暟 + */ + private Integer openBed; + + /** + * 寤虹珛鏃ユ湡 + */ + private Date buildDate; + + /** + * 澶囨敞 + */ + private String remark; + + /** + * 鍒涘缓浜� + */ + private String createBy; + + /** + * 鍒涘缓鏃堕棿 + */ + private Date createTime; + + /** + * 淇敼浜� + */ + private String updateBy; + + /** + * 淇敼鏃堕棿 + */ + private Date updateTime; + + /** + * 鎺掑簭 + */ + private Integer orderNum; + + /** + * 鏁版嵁鐘舵��(PT10.00.004) + */ + private String effective; + + /** + * 鍒涘缓浜哄鍚� + */ + private String createByName; + + /** + * 淇敼浜哄鍚� + */ + private String updateByName; + + /** + * 0鍒犻櫎1鏈垹闄� + */ + private Integer deleted; + + /** + * 鍒涘缓浜篿d + */ + private String createId; + + /** + * 淇敼浜篿d + */ + private String updateId; + + /** + * 绉橀挜 + */ + private String secretKey; + + /** + * 鍒版湡鏃堕棿 + */ + private Date expirationTime; + + /** + * 鏁版嵁搴撳悕 + */ + private String dbname; + + /** + * 涓棿灞備腑HisServiceBeanName鍦⊿erviceFactory绫讳腑鏌ョ湅 + */ + private String beanName; + + /** + * 鍥剧墖锛圔ase64缂栫爜锛� + */ + private byte[] imgbase64; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + DictHosp other = (DictHosp) that; + return (this.getHospAreaId() == null ? other.getHospAreaId() == null : this.getHospAreaId().equals(other.getHospAreaId())) + && (this.getHospAreaName() == null ? other.getHospAreaName() == null : this.getHospAreaName().equals(other.getHospAreaName())) + && (this.getHospid() == null ? other.getHospid() == null : this.getHospid().equals(other.getHospid())) + && (this.getHospName() == null ? other.getHospName() == null : this.getHospName().equals(other.getHospName())) + && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode())) + && (this.getWbm() == null ? other.getWbm() == null : this.getWbm().equals(other.getWbm())) + && (this.getSpell() == null ? other.getSpell() == null : this.getSpell().equals(other.getSpell())) + && (this.getAreaid() == null ? other.getAreaid() == null : this.getAreaid().equals(other.getAreaid())) + && (this.getAreaName() == null ? other.getAreaName() == null : this.getAreaName().equals(other.getAreaName())) + && (this.getMainHospArea() == null ? other.getMainHospArea() == null : this.getMainHospArea().equals(other.getMainHospArea())) + && (this.getPrincipal() == null ? other.getPrincipal() == null : this.getPrincipal().equals(other.getPrincipal())) + && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) + && (this.getPlaitBed() == null ? other.getPlaitBed() == null : this.getPlaitBed().equals(other.getPlaitBed())) + && (this.getOpenBed() == null ? other.getOpenBed() == null : this.getOpenBed().equals(other.getOpenBed())) + && (this.getBuildDate() == null ? other.getBuildDate() == null : this.getBuildDate().equals(other.getBuildDate())) + && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) + && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getOrderNum() == null ? other.getOrderNum() == null : this.getOrderNum().equals(other.getOrderNum())) + && (this.getEffective() == null ? other.getEffective() == null : this.getEffective().equals(other.getEffective())) + && (this.getCreateByName() == null ? other.getCreateByName() == null : this.getCreateByName().equals(other.getCreateByName())) + && (this.getUpdateByName() == null ? other.getUpdateByName() == null : this.getUpdateByName().equals(other.getUpdateByName())) + && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted())) + && (this.getCreateId() == null ? other.getCreateId() == null : this.getCreateId().equals(other.getCreateId())) + && (this.getUpdateId() == null ? other.getUpdateId() == null : this.getUpdateId().equals(other.getUpdateId())) + && (this.getSecretKey() == null ? other.getSecretKey() == null : this.getSecretKey().equals(other.getSecretKey())) + && (this.getExpirationTime() == null ? other.getExpirationTime() == null : this.getExpirationTime().equals(other.getExpirationTime())) + && (this.getDbname() == null ? other.getDbname() == null : this.getDbname().equals(other.getDbname())) + && (this.getBeanName() == null ? other.getBeanName() == null : this.getBeanName().equals(other.getBeanName())) + && (Arrays.equals(this.getImgbase64(), other.getImgbase64())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getHospAreaId() == null) ? 0 : getHospAreaId().hashCode()); + result = prime * result + ((getHospAreaName() == null) ? 0 : getHospAreaName().hashCode()); + result = prime * result + ((getHospid() == null) ? 0 : getHospid().hashCode()); + result = prime * result + ((getHospName() == null) ? 0 : getHospName().hashCode()); + result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode()); + result = prime * result + ((getWbm() == null) ? 0 : getWbm().hashCode()); + result = prime * result + ((getSpell() == null) ? 0 : getSpell().hashCode()); + result = prime * result + ((getAreaid() == null) ? 0 : getAreaid().hashCode()); + result = prime * result + ((getAreaName() == null) ? 0 : getAreaName().hashCode()); + result = prime * result + ((getMainHospArea() == null) ? 0 : getMainHospArea().hashCode()); + result = prime * result + ((getPrincipal() == null) ? 0 : getPrincipal().hashCode()); + result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); + result = prime * result + ((getPlaitBed() == null) ? 0 : getPlaitBed().hashCode()); + result = prime * result + ((getOpenBed() == null) ? 0 : getOpenBed().hashCode()); + result = prime * result + ((getBuildDate() == null) ? 0 : getBuildDate().hashCode()); + result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); + result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + ((getOrderNum() == null) ? 0 : getOrderNum().hashCode()); + result = prime * result + ((getEffective() == null) ? 0 : getEffective().hashCode()); + result = prime * result + ((getCreateByName() == null) ? 0 : getCreateByName().hashCode()); + result = prime * result + ((getUpdateByName() == null) ? 0 : getUpdateByName().hashCode()); + result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode()); + result = prime * result + ((getCreateId() == null) ? 0 : getCreateId().hashCode()); + result = prime * result + ((getUpdateId() == null) ? 0 : getUpdateId().hashCode()); + result = prime * result + ((getSecretKey() == null) ? 0 : getSecretKey().hashCode()); + result = prime * result + ((getExpirationTime() == null) ? 0 : getExpirationTime().hashCode()); + result = prime * result + ((getDbname() == null) ? 0 : getDbname().hashCode()); + result = prime * result + ((getBeanName() == null) ? 0 : getBeanName().hashCode()); + result = prime * result + (Arrays.hashCode(getImgbase64())); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", hospAreaId=").append(hospAreaId); + sb.append(", hospAreaName=").append(hospAreaName); + sb.append(", hospid=").append(hospid); + sb.append(", hospName=").append(hospName); + sb.append(", code=").append(code); + sb.append(", wbm=").append(wbm); + sb.append(", spell=").append(spell); + sb.append(", areaid=").append(areaid); + sb.append(", areaName=").append(areaName); + sb.append(", mainHospArea=").append(mainHospArea); + sb.append(", principal=").append(principal); + sb.append(", phone=").append(phone); + sb.append(", plaitBed=").append(plaitBed); + sb.append(", openBed=").append(openBed); + sb.append(", buildDate=").append(buildDate); + sb.append(", remark=").append(remark); + sb.append(", createBy=").append(createBy); + sb.append(", createTime=").append(createTime); + sb.append(", updateBy=").append(updateBy); + sb.append(", updateTime=").append(updateTime); + sb.append(", orderNum=").append(orderNum); + sb.append(", effective=").append(effective); + sb.append(", createByName=").append(createByName); + sb.append(", updateByName=").append(updateByName); + sb.append(", deleted=").append(deleted); + sb.append(", createId=").append(createId); + sb.append(", updateId=").append(updateId); + sb.append(", secretKey=").append(secretKey); + sb.append(", expirationTime=").append(expirationTime); + sb.append(", dbname=").append(dbname); + sb.append(", beanName=").append(beanName); + sb.append(", imgbase64=").append(imgbase64); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/example/mapper/DictHospMapper.java b/src/main/java/com/example/mapper/DictHospMapper.java new file mode 100644 index 0000000..2e4bb30 --- /dev/null +++ b/src/main/java/com/example/mapper/DictHospMapper.java @@ -0,0 +1,18 @@ +package com.example.mapper; + +import com.example.domain.DictHosp; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author w +* @description 閽堝琛ㄣ�恉ict_hosp(闄㈠尯淇℃伅琛�)銆戠殑鏁版嵁搴撴搷浣淢apper +* @createDate 2025-04-15 08:59:12 +* @Entity com.example.domain.DictHosp +*/ +public interface DictHospMapper extends BaseMapper<DictHosp> { + +} + + + + diff --git a/src/main/java/com/example/scheudleds/DictSyncCommon.java b/src/main/java/com/example/scheudleds/DictSyncCommon.java index 7a7bc05..c94b79e 100644 --- a/src/main/java/com/example/scheudleds/DictSyncCommon.java +++ b/src/main/java/com/example/scheudleds/DictSyncCommon.java @@ -1,6 +1,9 @@ package com.example.scheudleds; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.example.domain.DictHosp; import com.example.factory.ServiceFactory; +import com.example.service.DictHospService; import com.example.service.HisService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -11,6 +14,7 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.stream.Collectors; @Slf4j @Component @@ -25,9 +29,14 @@ private final ExecutorService executorService = Executors.newFixedThreadPool(40); + @Autowired + private DictHospService dictHospService; + @Scheduled(cron = "0 0 22 * * ?") public void executeTasks() { - List<String> list = Arrays.asList("shanxiqinxamjyy","shanxiqinpbkwyy","shanxiqinjdczgzyy","shanxiqinsqyy"); +// List<String> list = Arrays.asList("shanxiqinxamjyy","shanxiqinpbkwyy","shanxiqinjdczgzyy","shanxiqinsqyy"); + List<String> list = dictHospService.list(new LambdaQueryWrapper<DictHosp>().isNotNull(DictHosp::getBeanName)) + .stream().map(DictHosp::getBeanName).collect(Collectors.toList()); log.info("寮�濮嬫墽琛屽畾鏃朵换鍔★細{}", System.currentTimeMillis()); try { for (String hosp : list) { diff --git a/src/main/java/com/example/service/DictHospService.java b/src/main/java/com/example/service/DictHospService.java new file mode 100644 index 0000000..0e4273e --- /dev/null +++ b/src/main/java/com/example/service/DictHospService.java @@ -0,0 +1,13 @@ +package com.example.service; + +import com.example.domain.DictHosp; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author w +* @description 閽堝琛ㄣ�恉ict_hosp(闄㈠尯淇℃伅琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice +* @createDate 2025-04-15 08:59:12 +*/ +public interface DictHospService extends IService<DictHosp> { + +} diff --git a/src/main/java/com/example/service/impl/DictHospServiceImpl.java b/src/main/java/com/example/service/impl/DictHospServiceImpl.java new file mode 100644 index 0000000..7af3063 --- /dev/null +++ b/src/main/java/com/example/service/impl/DictHospServiceImpl.java @@ -0,0 +1,22 @@ +package com.example.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.example.domain.DictHosp; +import com.example.service.DictHospService; +import com.example.mapper.DictHospMapper; +import org.springframework.stereotype.Service; + +/** +* @author w +* @description 閽堝琛ㄣ�恉ict_hosp(闄㈠尯淇℃伅琛�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇 +* @createDate 2025-04-15 08:59:12 +*/ +@Service +public class DictHospServiceImpl extends ServiceImpl<DictHospMapper, DictHosp> + implements DictHospService{ + +} + + + + diff --git a/src/main/resources/mapper/DictHospMapper.xml b/src/main/resources/mapper/DictHospMapper.xml new file mode 100644 index 0000000..a993c8c --- /dev/null +++ b/src/main/resources/mapper/DictHospMapper.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.example.mapper.DictHospMapper"> + + <resultMap id="BaseResultMap" type="com.example.domain.DictHosp"> + <id property="hospAreaId" column="hosp_area_id" jdbcType="VARCHAR"/> + <result property="hospAreaName" column="hosp_area_name" jdbcType="VARCHAR"/> + <result property="hospid" column="hospId" jdbcType="VARCHAR"/> + <result property="hospName" column="hosp_name" jdbcType="VARCHAR"/> + <result property="code" column="code" jdbcType="VARCHAR"/> + <result property="wbm" column="wbm" jdbcType="VARCHAR"/> + <result property="spell" column="spell" jdbcType="VARCHAR"/> + <result property="areaid" column="areaId" jdbcType="VARCHAR"/> + <result property="areaName" column="area_name" jdbcType="VARCHAR"/> + <result property="mainHospArea" column="main_hosp_area" jdbcType="VARCHAR"/> + <result property="principal" column="principal" jdbcType="VARCHAR"/> + <result property="phone" column="phone" jdbcType="VARCHAR"/> + <result property="plaitBed" column="plait_bed" jdbcType="INTEGER"/> + <result property="openBed" column="open_bed" jdbcType="INTEGER"/> + <result property="buildDate" column="build_date" jdbcType="DATE"/> + <result property="remark" column="remark" jdbcType="VARCHAR"/> + <result property="createBy" column="create_by" jdbcType="VARCHAR"/> + <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> + <result property="updateBy" column="update_by" jdbcType="VARCHAR"/> + <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> + <result property="orderNum" column="order_num" jdbcType="INTEGER"/> + <result property="effective" column="effective" jdbcType="VARCHAR"/> + <result property="createByName" column="create_by_name" jdbcType="VARCHAR"/> + <result property="updateByName" column="update_by_name" jdbcType="VARCHAR"/> + <result property="deleted" column="deleted" jdbcType="TINYINT"/> + <result property="createId" column="create_id" jdbcType="VARCHAR"/> + <result property="updateId" column="update_id" jdbcType="VARCHAR"/> + <result property="secretKey" column="secret_key" jdbcType="VARCHAR"/> + <result property="expirationTime" column="expiration_time" jdbcType="TIMESTAMP"/> + <result property="dbname" column="dbname" jdbcType="VARCHAR"/> + <result property="beanName" column="bean_name" jdbcType="VARCHAR"/> + </resultMap> + + <sql id="Base_Column_List"> + hosp_area_id,hosp_area_name,hospId, + hosp_name,code,wbm, + spell,areaId,area_name, + main_hosp_area,principal,phone, + plait_bed,open_bed,build_date, + remark,create_by,create_time, + update_by,update_time,order_num, + effective,create_by_name,update_by_name, + deleted,create_id,update_id, + secret_key,expiration_time,dbname, + bean_name,imgBase64 + </sql> +</mapper> -- Gitblit v1.8.0