Files
jsowell-charger-web/jsowell-pile/src/main/resources/mapper/pile/StationSettingRelationMapper.xml

106 lines
5.1 KiB
XML

<?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.jsowell.pile.mapper.StationSettingRelationMapper">
<resultMap type="com.jsowell.pile.domain.StationSettingRelation" id="StationSettingRelationResult">
<result property="id" column="id" />
<result property="stationId" column="station_id" />
<result property="thirdPartyType" column="third_party_type" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectStationSettingRelationVo">
select id, station_id, third_party_type, create_time, create_by, update_time, update_by, del_flag from station_setting_relation
</sql>
<sql id="Base_Column_List" >
id, station_id, third_party_type, create_time, create_by, update_time, update_by, del_flag
</sql>
<select id="selectStationSettingRelationList" parameterType="com.jsowell.pile.domain.StationSettingRelation" resultMap="StationSettingRelationResult">
<include refid="selectStationSettingRelationVo"/>
<where>
<if test="stationId != null "> and station_id = #{stationId}</if>
<if test="thirdPartyType != null and thirdPartyType != ''"> and third_party_type = #{thirdPartyType}</if>
</where>
</select>
<select id="selectStationSettingRelationById" parameterType="Long" resultMap="StationSettingRelationResult">
<include refid="selectStationSettingRelationVo"/>
where id = #{id}
</select>
<insert id="insertStationSettingRelation" parameterType="com.jsowell.pile.domain.StationSettingRelation" useGeneratedKeys="true" keyProperty="id">
insert into station_setting_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stationId != null">station_id,</if>
<if test="thirdPartyType != null">third_party_type,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stationId != null">#{stationId},</if>
<if test="thirdPartyType != null">#{thirdPartyType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateStationSettingRelation" parameterType="com.jsowell.pile.domain.StationSettingRelation">
update station_setting_relation
<trim prefix="SET" suffixOverrides=",">
<if test="stationId != null">station_id = #{stationId},</if>
<if test="thirdPartyType != null">third_party_type = #{thirdPartyType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStationSettingRelationById" parameterType="Long">
delete from station_setting_relation where id = #{id}
</delete>
<delete id="deleteStationSettingRelationByIds" parameterType="String">
delete from station_setting_relation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectRelationInfo" resultType="com.jsowell.pile.vo.base.StationSettingRelationVO">
select
t1.station_id as stationId,
t1.third_party_type as thirdPartyType,
t2.url_address as urlAddress,
t2.operator_id as operatorId,
t2.operator_secret as operatorSecret,
t2.sign_secret as signSecret,
t2.data_secret as dataSecret,
t2.data_secret_IV as dataSecretIv,
from station_setting_relation t1 join thirdparty_setting_info t2 on t1.type = t2.type
where t1.del_flag = '0'
<if test="stationId != null">
and t1.station_id = #{stationId,jdbcType=BIGINT}
</if>
<if test="thirdPartyType != null and thirdPartyType != ''">
and t1.third_party_type = #{thirdPartyType,jdbcType=VARCHAR}
</if>
limit 1
</select>
</mapper>