yn_img_tool/src/main/resources/mappers/basic/ProPullMapper.xml

133 lines
2.7 KiB
XML
Raw Normal View History

2025-04-01 15:10:29 +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">
<mapper namespace="com.bonus.imgTool.task.dao.ProPullDao">
<insert id="addProject">
insert into tb_project (
id,
`name`,
abbreviation,
pro_type,
voltage_level,
company_name,
origin,
lon,
lat,
`status`,
update_time,
is_active
)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.proId},
#{item.proName},
#{item.abbreviation},
#{item.proType},
#{item.voltageLevel},
#{item.companyName},
#{item.origin},
#{item.lon},
#{item.lat},
#{item.status},
#{item.updateTime},
#{item.isActive}
)
</foreach>
</insert>
<update id="updateProject">
update tb_project
<set>
<if test="proName != null">
`name` = #{proName},
</if>
<if test="abbreviation != null">
abbreviation = #{abbreviation},
</if>
<if test="proType != null">
pro_type = #{proType},
</if>
<if test="voltageLevel != null">
voltage_level = #{voltageLevel},
</if>
<if test="companyName != null">
company_name = #{companyName},
</if>
<if test="origin != null">
2025-04-01 15:34:06 +08:00
origin = #{origin},
2025-04-01 15:10:29 +08:00
</if>
<if test="lon != null">
lon = #{lon},
</if>
<if test="lat != null">
lat = #{lat},
</if>
<if test="status != null">
2025-04-01 15:34:06 +08:00
status = #{status},
2025-04-01 15:10:29 +08:00
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isActive != null">
is_active = #{isActive}
</if>
</set>
WHERE
id = #{proId}
</update>
<select id="getProjectData" resultType="com.bonus.imgTool.basic.vo.dto.ProDto">
SELECT
bp.id AS proId,
bp.`NAME` AS proName,
bp.abbreviation,
bp.pro_type AS proType,
po.`name` AS companyName,
td.`value` AS voltageLevel,
bp.project_address AS origin,
bp.lon,
bp.lat,
CASE
bp.pro_status
WHEN 0 THEN
'在建'
WHEN 1 THEN
'完工'
WHEN 2 THEN
'筹建'
WHEN 3 THEN
'停工'
WHEN 4 THEN
'收尾' ELSE '异常'
END AS `status`,
bp.update_time,
bp.is_active
FROM
ynrealname.bm_project bp
LEFT JOIN ynrealname.pm_organization po ON po.id = bp.two_com_id
LEFT JOIN ynrealname.t_dict td ON td.id = bp.level_id
AND td.type = 'voltageLevel'
</select>
<select id="getImgProjectData" resultType="com.bonus.imgTool.basic.vo.dto.ProDto">
SELECT
id AS proId,
`name` AS proName,
abbreviation,
pro_type,
voltage_level,
company_name,
origin,
lon,
lat,
`status`,
update_time,
is_active
FROM
tb_project
</select>
</mapper>