Files
jsowell-charger-web/jsowell-pile/src/main/resources/mapper/pile/MemberGroupMapper.xml
2024-01-02 15:29:30 +08:00

124 lines
6.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.MemberGroupMapper">
<resultMap type="com.jsowell.pile.domain.MemberGroup" id="MemberGroupResult">
<result property="id" column="id" />
<result property="groupCode" column="group_code" />
<result property="merchantId" column="merchant_id" />
<result property="stationId" column="station_id" />
<result property="groupLevel" column="group_level" />
<result property="groupType" column="group_type" />
<result property="discount" column="discount" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="Base_Column_List">
id, group_code, merchant_id, station_id, group_level, group_type, discount, create_by, create_time, update_by, update_time, del_flag
</sql>
<sql id="selectMemberGroupVo">
select id, group_code, merchant_id, station_id, group_level, group_type, discount, create_by, create_time, update_by, update_time, del_flag from member_group
</sql>
<select id="selectMemberGroupList" parameterType="com.jsowell.pile.domain.MemberGroup" resultMap="MemberGroupResult">
<include refid="selectMemberGroupVo"/>
<where>
<if test="groupCode != null and groupCode != ''"> and group_code = #{groupCode}</if>
<if test="merchantId != null and merchantId != ''"> and merchant_id = #{merchantId}</if>
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
<if test="groupLevel != null and groupLevel != ''"> and group_level = #{groupLevel}</if>
<if test="groupType != null and groupType != ''"> and group_type = #{groupType}</if>
<if test="discount != null "> and discount = #{discount}</if>
</where>
</select>
<select id="selectMemberGroupById" parameterType="Long" resultMap="MemberGroupResult">
<include refid="selectMemberGroupVo"/>
where id = #{id}
</select>
<insert id="insertMemberGroup" parameterType="com.jsowell.pile.domain.MemberGroup">
insert into member_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="groupCode != null">group_code,</if>
<if test="merchantId != null">merchant_id,</if>
<if test="stationId != null">station_id,</if>
<if test="groupLevel != null">group_level,</if>
<if test="groupType != null">group_type,</if>
<if test="discount != null">discount,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="groupCode != null">#{groupCode},</if>
<if test="merchantId != null">#{merchantId},</if>
<if test="stationId != null">#{stationId},</if>
<if test="groupLevel != null">#{groupLevel},</if>
<if test="groupType != null">#{groupType},</if>
<if test="discount != null">#{discount},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateMemberGroup" parameterType="com.jsowell.pile.domain.MemberGroup">
update member_group
<trim prefix="SET" suffixOverrides=",">
<if test="groupCode != null">group_code = #{groupCode},</if>
<if test="merchantId != null">merchant_id = #{merchantId},</if>
<if test="stationId != null">station_id = #{stationId},</if>
<if test="groupLevel != null">group_level = #{groupLevel},</if>
<if test="groupType != null">group_type = #{groupType},</if>
<if test="discount != null">discount = #{discount},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMemberGroupById" parameterType="Long">
delete from member_group where id = #{id}
</delete>
<delete id="deleteMemberGroupByIds" parameterType="String">
delete from member_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="queryMemberGroupList" resultType="com.jsowell.pile.vo.web.MemberGroupVO">
select
t1.id as id,
t1.group_code as groupCode,
t1.merchant_id as merchantId,
t1.station_id as stationId,
t1.group_level as groupLevel,
t1.group_type as groupType,
t1.discount as discount,
t2.merchant_name as merchantName,
t3.station_name as stationName
from member_group t1
left join pile_merchant_info t2 on t1.merchant_id = t2.id
left join pile_station_info t3 on t3.id = t1.station_id
where t1.del_flag = '0'
</select>
</mapper>