bug修改代码备份
parent
92a6a6d253
commit
9e25fc5036
@ -0,0 +1,34 @@
|
||||
package com.glxp.api.util;
|
||||
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.net.NetUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* @Author tan
|
||||
* @Date 2021/10/16 16:23
|
||||
*/
|
||||
@Component
|
||||
public class SnowflakeUtil {
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
private long workerId = 0;//为终端ID
|
||||
private long dataCenterId = 1;//数据中心ID
|
||||
private Snowflake snowflake = IdUtil.createSnowflake(workerId,dataCenterId);
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
workerId = NetUtil.ipv4ToLong(NetUtil.getLocalhostStr());
|
||||
}
|
||||
public synchronized String snowflakeId(){
|
||||
return String.valueOf(snowflake.nextId());
|
||||
}
|
||||
public synchronized long snowflakeId(long workerId,long dataCenterId){
|
||||
Snowflake snowflake = IdUtil.createSnowflake(workerId, dataCenterId);
|
||||
return snowflake.nextId();
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +1,43 @@
|
||||
<?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.glxp.api.dao.basic.BasicHospTypeDao">
|
||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicHospTypeEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table basic_hosp_type-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="code" jdbcType="VARCHAR" property="code" />
|
||||
<result column="parentCode" jdbcType="VARCHAR" property="parentCode" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="createUser" jdbcType="VARCHAR" property="createUser" />
|
||||
<result column="updateUser" jdbcType="VARCHAR" property="updateUser" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, code, parentCode, `name`, remark, createTime, updateTime, `createUser`, updateUser
|
||||
</sql>
|
||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicHospTypeEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table basic_hosp_type-->
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="code" jdbcType="VARCHAR" property="code"/>
|
||||
<result column="parentCode" jdbcType="VARCHAR" property="parentCode"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
<result column="createUser" jdbcType="VARCHAR" property="createUser"/>
|
||||
<result column="updateUser" jdbcType="VARCHAR" property="updateUser"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, code, parentCode, `name`, remark, createTime, updateTime, `createUser`, updateUser
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getTreeList" resultType="com.glxp.api.res.basic.BasicHospTypeResponse">
|
||||
SELECT id, code,name as label,parentCode FROM basic_hosp_type ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectLowTypeAll" parameterType="java.lang.String" resultType="com.glxp.api.entity.basic.BasicHospTypeEntity">
|
||||
WITH recursive table_a AS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
basic_hosp_type ta
|
||||
WHERE
|
||||
code = #{code}
|
||||
UNION ALL
|
||||
SELECT
|
||||
tb.*
|
||||
FROM
|
||||
basic_hosp_type tb
|
||||
INNER JOIN table_a ON table_a.CODE = tb.parentCode
|
||||
) SELECT
|
||||
*
|
||||
FROM
|
||||
table_a
|
||||
</select>
|
||||
|
||||
<select id="getTreeList" resultType="com.glxp.api.res.basic.BasicHospTypeResponse">
|
||||
SELECT id, code, name as label, parentCode
|
||||
FROM basic_hosp_type
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectLowTypeAll" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.basic.BasicHospTypeEntity">
|
||||
WITH recursive table_a AS (
|
||||
SELECT *
|
||||
FROM basic_hosp_type ta
|
||||
WHERE code = #{code}
|
||||
UNION ALL
|
||||
SELECT tb.*
|
||||
FROM basic_hosp_type tb
|
||||
INNER JOIN table_a ON table_a.CODE = tb.parentCode
|
||||
)
|
||||
SELECT *
|
||||
FROM table_a
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue