| | |
| | | expireTime: 300 |
| | | |
| | | mybatis-plus: |
| | | # configuration: |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | # configuration: |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | typeAliasesPackage: com.zhitan.**.domain |
| | | mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # 加载全局的配置文件 |
| | |
| | | token: == |
| | | org: org |
| | | bucket: bucket |
| | | |
| | | |
| | | ###################### MQTT ################################# |
| | | mqtt: |
| | | # 服务器地址 |
| | |
| | | # 用户名 |
| | | username: admin |
| | | # 密码 |
| | | password: 111111 |
| | | password: 1q2w3e4r. |
| | | # 连接超时 |
| | | timeout: 30 |
| | | # 心跳检测 |
| | |
| | | # false为建立持久会话 |
| | | cleanSession: false |
| | | # 断开后重新连接 |
| | | automaticReconnect: true |
| | | automaticReconnect: true |
| | | singleLoginUrl: localhost:8090/singleLogin/getInfo |
| | |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 |
| | | validationQuery: SELECT 1 |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:postgresql://127.0.0.1:5432/energy |
| | | url: jdbc:postgresql://127.0.0.1:5432/energy_ml |
| | | username: root |
| | | password: 123456 |
| | | # 从库数据源 |
| | |
| | | expireTime: 300 |
| | | |
| | | mybatis-plus: |
| | | # configuration: |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | # configuration: |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | typeAliasesPackage: com.zhitan.**.domain |
| | | mapperLocations: classpath*:mapper/**/*Mapper.xml |
| | | # 加载全局的配置文件 |
| | |
| | | token: == |
| | | org: org |
| | | bucket: bucket |
| | | |
| | | |
| | | ###################### MQTT ################################# |
| | | mqtt: |
| | | # 服务器地址 |
| | |
| | | # 用户名 |
| | | username: admin |
| | | # 密码 |
| | | password: 111111 |
| | | password: 1q2w3e4r. |
| | | # 连接超时 |
| | | timeout: 30 |
| | | # 心跳检测 |
| | |
| | | # false为建立持久会话 |
| | | cleanSession: false |
| | | # 断开后重新连接 |
| | | automaticReconnect: true |
| | | automaticReconnect: true |
| | | singleLoginUrl: localhost:8090/singleLogin/getInfo |
| | |
| | | JOIN node_index ni ON ni.node_id = nd.node_id |
| | | where ni.node_id= #{nodeId} and index_id= #{indexId} |
| | | </select> |
| | | <select id="listMeterImplByInstallLocation" resultType="com.zhitan.basicdata.domain.MeterImplement"> |
| | | <include refid="selectMeterImplementVo"/> |
| | | <where> |
| | | installaction_location = #{installactionLocation} |
| | | </where> |
| | | </select> |
| | | |
| | | <insert id="insertMeterImplement" parameterType="MeterImplement"> |
| | | insert into meter_implement |
| | |
| | | </foreach> |
| | | AND time_code = #{timeCode} |
| | | </select> |
| | | <select id="getUpCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission"> |
| | | SELECT |
| | | di.index_id, |
| | | di.data_time, |
| | | di.value, |
| | | ei.energy_id |
| | | FROM |
| | | data_item di |
| | | JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | ei.energy_id != '' and |
| | | di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{indexId}) |
| | | AND di.data_time BETWEEN #{beginTime} AND #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | </select> |
| | | <select id="getMiddleCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission"> |
| | | SELECT |
| | | di.index_id, |
| | | di.data_time, |
| | | CASE |
| | | WHEN di.time_type = 'MONTH' THEN |
| | | TO_CHAR( di.create_time, 'MM' ) |
| | | WHEN di.time_type = 'DAY' THEN |
| | | TO_CHAR( di.create_time, 'DD' ) |
| | | WHEN di.time_type = 'HOUR' THEN |
| | | TO_CHAR( di.data_time, 'HH' ) |
| | | ELSE TO_CHAR( di.data_time, 'YYMMDD' ) |
| | | END AS dataTimeStr, |
| | | di.value, |
| | | ei.energy_id, |
| | | di.time_type |
| | | FROM |
| | | data_item di |
| | | JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{indexId}) |
| | | <if test="emissionType !='' and emissionType !=null and emissionType =='allType'"> |
| | | AND ei.energy_id != '' |
| | | </if> |
| | | <if test="emissionType !='' and emissionType !=null and emissionType !='allType'"> |
| | | AND ei.energy_id = #{emissionType} |
| | | </if> |
| | | AND di.data_time BETWEEN #{beginTime} AND #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | </select> |
| | | <select id="getDownCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission"> |
| | | SELECT |
| | | di.index_id, |
| | | di.data_time, |
| | | di.value, |
| | | ei.energy_id, |
| | | mn.name as nodeName |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN data_item di ON di.index_id = ni.index_id |
| | | LEFT JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | ei.energy_id != '' |
| | | AND mn.parent_id = #{indexId} |
| | | AND di.data_time BETWEEN #{beginTime} AND #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="energyId != null">#{energyId}, |
| | | </if> |
| | | </trim> |
| | | |
| | | |
| | | </insert> |
| | | <insert id="insertNodeIndex"> |
| | | insert into node_index (node_id, index_id) values (#{nodeId}, #{indexId}); |
| | |
| | | and ei.meter_id = me.id |
| | | order by ei.order_num |
| | | </select> |
| | | |
| | | |
| | | <select id="selectEnergyIndexPage" resultMap="EnergyIndexResult"> |
| | | select ni.index_id, name, code, index_type, remark, unit_id, index_category |
| | | from energy_index ei left join node_index ni on ei.index_id = ni.index_id |
| | |
| | | </if> |
| | | </where> |
| | | order by ei.order_num |
| | | |
| | | |
| | | </select> |
| | | <select id="listIndexByMeterIds" resultType="com.zhitan.model.domain.EnergyIndex"> |
| | | select ei.index_id, |
| | |
| | | from energy_index ei |
| | | left join node_index ni on ei.index_id = ni.index_id |
| | | <where> |
| | | |
| | | |
| | | <if test="nodeId != null and nodeId != ''">and ni.node_id = #{nodeId}</if> |
| | | <if test="meterIds != null"> |
| | | and ei.meter_id in |
| | |
| | | <include refid="selectEnergyIndexVo"/> |
| | | where code = #{cdoe} |
| | | </select> |
| | | <select id="getIndexByCode" resultType="com.zhitan.model.domain.EnergyIndex"> |
| | | SELECT ei.code,mi.meter_name||'_'||ei.name as name from energy_index ei |
| | | LEFT JOIN node_device nd on ei.meter_id = nd.device_id |
| | | LEFT JOIN meter_implement mi on mi."id" = nd.device_id |
| | | <where> |
| | | <if test="nodeId != null and nodeId != ''">and nd.node_id = #{nodeId}</if> |
| | | <if test="code != null and code != ''"> |
| | | and (mi.meter_name like concat('%', #{code}, '%') |
| | | or ei.code like concat('%', #{code}, '%') |
| | | or ei.name like concat('%', #{code}, '%') |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | values (#{nodeId}, #{indexId}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | |
| | | <select id="getModelNodeIndexIdByNodeId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN energy_index ei on ni.index_id = ei.index_id |
| | | WHERE ni.node_id = #{nodeId} |
| | | WHERE ni.node_id = #{nodeId} |
| | | <if test="energyType!=null and energyType!=''"> |
| | | and ei.energy_id = #{energyType} |
| | | </if> |
| | |
| | | <select id="getFirstModeNodeInfo" resultType="com.zhitan.model.domain.ModelNode"> |
| | | <include refid="selectModelNodeVo"/> |
| | | where model_code = #{modelCode} AND parent_id is null |
| | | order by order_num |
| | | order by order_num |
| | | </select> |
| | | <select id="selectIndexByNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | left join energy_index ei on ni.index_id = ei.index_id |
| | | WHERE mn.model_code = #{modelCode} |
| | | <where> |
| | | mn.model_code = #{modelCode} |
| | | AND mn.node_id in |
| | | <foreach collection="nodeIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | <if test="modelCode!=null and modelCode!='' and nodeIds.size>0"> |
| | | and ei.index_type='STATISTIC' |
| | | </if> |
| | | |
| | | </where> |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | AND (data_time BETWEEN #{startTime} AND #{endTime}) |
| | | AND time_type = #{timeType} |
| | | </select> |
| | | <select id="getDataStatisticsDeviationAnalysis" |
| | | resultType="com.zhitan.peakvalley.domain.ElectricityDataItem"> |
| | | SELECT |
| | | index_code indexCode, |
| | | time_code timeCode, |
| | | electricity_type electricityType, |
| | | data_time dataTime, |
| | | electricity, |
| | | "cost", |
| | | time_type timeType, |
| | | price, |
| | | remark |
| | | FROM |
| | | "electricity_data_item" |
| | | WHERE |
| | | index_id IN |
| | | <foreach collection="indexIdSet" item="indexId" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | |
| | | AND time_type = #{timeType} |
| | | </select> |
| | | </mapper> |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectElectricityPriceDatePageTacticsAll" resultMap="ElectricityPriceDateResult"> |
| | | <include refid="selectElectricityPriceDateVo"/> |
| | | WHERE begin_date < CURRENT_TIMESTAMP |
| | | AND end_date > CURRENT_TIMESTAMP |
| | | </select> |
| | | </mapper> |
| | |
| | | <result property="updateBy" column="update_by"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="remark" column="remark"/> |
| | | <result property="singleUser" column="single_user"/> |
| | | <association property="dept" javaType="SysDept" resultMap="deptResult" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> |
| | | </resultMap> |
| | |
| | | u.create_by, |
| | | u.create_time, |
| | | u.remark, |
| | | u.single_user, |
| | | d.dept_id, |
| | | d.parent_id, |
| | | d.ancestors, |
| | |
| | | |
| | | <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phone_number, u.password, u.sex, |
| | | u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from |
| | | u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.single_user, d.dept_name, d.leader from |
| | | sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | where u.del_flag = '0' |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="singleUser != null and singleUser != ''">single_user,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="singleUser != null and singleUser != ''">#{singleUser},</if> |
| | | now() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="loginDate != null">login_date = #{loginDate},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="singleUser != null and singleUser != ''">single_user = #{singleUser},</if> |
| | | update_time = now() |
| | | </set> |
| | | where user_id = #{userId} |
| | |
| | | </foreach> |
| | | </delete> |
| | | |
| | | </mapper> |
| | | </mapper> |