2025-06-17 19:18:39 +08:00
|
|
|
<?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">
|
2025-06-20 12:17:04 +08:00
|
|
|
<mapper namespace="com.xzzn.ems.mapper.EmsSiteSettingMapper">
|
2025-06-17 19:18:39 +08:00
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<resultMap type="EmsSiteSetting" id="EmsSiteSettingResult">
|
2025-06-17 19:18:39 +08:00
|
|
|
<result property="id" column="id" />
|
|
|
|
<result property="siteName" column="site_name" />
|
2025-06-20 12:17:04 +08:00
|
|
|
<result property="siteAddress" column="site_address" />
|
|
|
|
<result property="runningTime" column="running_time" />
|
|
|
|
<result property="latitude" column="latitude" />
|
|
|
|
<result property="longitude" column="longitude" />
|
2025-06-25 12:40:04 +08:00
|
|
|
<result property="installCapacity" column="install_capacity" />
|
|
|
|
<result property="installPower" column="install_power" />
|
2025-06-17 19:18:39 +08:00
|
|
|
<result property="remark" column="remark" />
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
2025-06-29 10:55:05 +08:00
|
|
|
<result property="siteId" column="site_id" />
|
2025-06-17 19:18:39 +08:00
|
|
|
</resultMap>
|
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<sql id="selectEmsSiteSettingVo">
|
2025-06-29 10:55:05 +08:00
|
|
|
select id, site_name, site_address, running_time, latitude, longitude, install_capacity, install_power, remark, create_by, update_by, create_time, update_time, site_id from ems_site_setting
|
2025-06-17 19:18:39 +08:00
|
|
|
</sql>
|
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<select id="selectEmsSiteSettingList" parameterType="EmsSiteSetting" resultMap="EmsSiteSettingResult">
|
|
|
|
<include refid="selectEmsSiteSettingVo"/>
|
2025-06-17 19:18:39 +08:00
|
|
|
<where>
|
|
|
|
<if test="siteName != null and siteName != ''"> and site_name like concat('%', #{siteName}, '%')</if>
|
2025-06-20 12:17:04 +08:00
|
|
|
<if test="siteAddress != null and siteAddress != ''"> and site_address = #{siteAddress}</if>
|
|
|
|
<if test="runningTime != null "> and running_time = #{runningTime}</if>
|
|
|
|
<if test="latitude != null "> and latitude = #{latitude}</if>
|
|
|
|
<if test="longitude != null "> and longitude = #{longitude}</if>
|
2025-06-25 12:40:04 +08:00
|
|
|
<if test="installCapacity != null "> and install_capacity = #{installCapacity}</if>
|
|
|
|
<if test="installPower != null "> and install_power = #{installPower}</if>
|
2025-06-29 10:55:05 +08:00
|
|
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
2025-06-17 19:18:39 +08:00
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<select id="selectEmsSiteSettingById" parameterType="Long" resultMap="EmsSiteSettingResult">
|
|
|
|
<include refid="selectEmsSiteSettingVo"/>
|
2025-06-17 19:18:39 +08:00
|
|
|
where id = #{id}
|
|
|
|
</select>
|
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<insert id="insertEmsSiteSetting" parameterType="EmsSiteSetting" useGeneratedKeys="true" keyProperty="id">
|
2025-06-17 19:18:39 +08:00
|
|
|
insert into ems_site_setting
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="siteName != null and siteName != ''">site_name,</if>
|
2025-06-20 12:17:04 +08:00
|
|
|
<if test="siteAddress != null">site_address,</if>
|
|
|
|
<if test="runningTime != null">running_time,</if>
|
|
|
|
<if test="latitude != null">latitude,</if>
|
|
|
|
<if test="longitude != null">longitude,</if>
|
2025-06-25 12:40:04 +08:00
|
|
|
<if test="installCapacity != null">install_capacity,</if>
|
|
|
|
<if test="installPower != null">install_power,</if>
|
2025-06-17 19:18:39 +08:00
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
2025-06-29 10:55:05 +08:00
|
|
|
<if test="siteId != null and siteId != ''">site_id,</if>
|
2025-06-17 19:18:39 +08:00
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="siteName != null and siteName != ''">#{siteName},</if>
|
2025-06-20 12:17:04 +08:00
|
|
|
<if test="siteAddress != null">#{siteAddress},</if>
|
|
|
|
<if test="runningTime != null">#{runningTime},</if>
|
|
|
|
<if test="latitude != null">#{latitude},</if>
|
|
|
|
<if test="longitude != null">#{longitude},</if>
|
2025-06-25 12:40:04 +08:00
|
|
|
<if test="installCapacity != null">#{installCapacity},</if>
|
|
|
|
<if test="installPower != null">#{installPower},</if>
|
2025-06-17 19:18:39 +08:00
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
2025-06-29 10:55:05 +08:00
|
|
|
<if test="siteId != null and siteId != ''">#{siteId},</if>
|
2025-06-17 19:18:39 +08:00
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<update id="updateEmsSiteSetting" parameterType="EmsSiteSetting">
|
2025-06-17 19:18:39 +08:00
|
|
|
update ems_site_setting
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="siteName != null and siteName != ''">site_name = #{siteName},</if>
|
2025-06-20 12:17:04 +08:00
|
|
|
<if test="siteAddress != null">site_address = #{siteAddress},</if>
|
|
|
|
<if test="runningTime != null">running_time = #{runningTime},</if>
|
|
|
|
<if test="latitude != null">latitude = #{latitude},</if>
|
|
|
|
<if test="longitude != null">longitude = #{longitude},</if>
|
2025-06-25 12:40:04 +08:00
|
|
|
<if test="installCapacity != null">install_capacity = #{installCapacity},</if>
|
|
|
|
<if test="installPower != null">install_power = #{installPower},</if>
|
2025-06-17 19:18:39 +08:00
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
2025-06-29 10:55:05 +08:00
|
|
|
<if test="siteId != null and siteId != ''">site_id = #{siteId},</if>
|
2025-06-17 19:18:39 +08:00
|
|
|
</trim>
|
|
|
|
where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<delete id="deleteEmsSiteSettingById" parameterType="Long">
|
2025-06-17 19:18:39 +08:00
|
|
|
delete from ems_site_setting where id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
2025-06-20 12:17:04 +08:00
|
|
|
<delete id="deleteEmsSiteSettingByIds" parameterType="String">
|
2025-06-17 19:18:39 +08:00
|
|
|
delete from ems_site_setting where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="getSiteTotalInfo" resultType="com.xzzn.ems.domain.vo.SiteTotalInfoVo">
|
2025-06-29 10:55:05 +08:00
|
|
|
select count(DISTINCT s.site_id) as siteNum,
|
2025-06-25 12:40:04 +08:00
|
|
|
SUM(s.install_capacity) as installCapacity,
|
|
|
|
SUM(s.install_power) as installPower
|
|
|
|
from ems_site_setting s
|
2025-06-17 19:18:39 +08:00
|
|
|
</select>
|
2025-06-29 10:55:05 +08:00
|
|
|
|
|
|
|
<select id="selectEmsSiteSettingBySiteId" parameterType="String" resultMap="EmsSiteSettingResult">
|
|
|
|
<include refid="selectEmsSiteSettingVo"/>
|
|
|
|
where site_id = #{siteId}
|
|
|
|
</select>
|
2025-06-17 19:18:39 +08:00
|
|
|
</mapper>
|