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

95 lines
4.3 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.MemberStationRelationMapper">
<resultMap type="com.jsowell.pile.domain.MemberStationRelation" id="MemberStationRelationResult">
<result property="id" column="id" />
<result property="memberId" column="member_id" />
<result property="stationId" column="station_id" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectMemberStationRelationVo">
select id, member_id, station_id, create_time, create_by, update_time, update_by from member_station_relation
</sql>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, member_id, station_id, create_time, create_by, update_time, update_by
</sql>
<select id="selectMemberStationRelationList" parameterType="com.jsowell.pile.domain.MemberStationRelation" resultMap="MemberStationRelationResult">
<include refid="selectMemberStationRelationVo"/>
<where>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="stationId != null "> and station_id = #{stationId}</if>
</where>
</select>
<select id="selectMemberStationRelationById" parameterType="Integer" resultMap="MemberStationRelationResult">
<include refid="selectMemberStationRelationVo"/>
where id = #{id}
</select>
<insert id="insertMemberStationRelation" parameterType="com.jsowell.pile.domain.MemberStationRelation" useGeneratedKeys="true" keyProperty="id">
insert into member_station_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="memberId != null">member_id,</if>
<if test="stationId != null">station_id,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="memberId != null">#{memberId},</if>
<if test="stationId != null">#{stationId},</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>
</trim>
</insert>
<update id="updateMemberStationRelation" parameterType="com.jsowell.pile.domain.MemberStationRelation">
update member_station_relation
<trim prefix="SET" suffixOverrides=",">
<if test="memberId != null">member_id = #{memberId},</if>
<if test="stationId != null">station_id = #{stationId},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteMemberStationRelationById" parameterType="Integer">
delete from member_station_relation where id = #{id}
</delete>
<delete id="deleteMemberStationRelationByIds" parameterType="String">
delete from member_station_relation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getStationIdListByMemberId" resultType="java.lang.String">
select
<include refid="Base_Column_List" />
from member_station_relation
where member_id = #{memberId,jdbcType=VARCHAR}
</select>
<delete id="deleteMemberStationRelation">
delete from member_station_relation
where member_id = #{memberId,jdbcType=VARCHAR}
and station_id = #{stationId,jdbcType=BIGINT}
</delete>
</mapper>