|
|
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.chenhai.muhu.mapper.MerchantMapInfoMapper"> <resultMap type="MerchantMapInfo" id="MerchantMapInfoResult"> <result property="id" column="id" /> <result property="merchantName" column="merchant_name" /> <result property="merchantType" column="merchant_type" /> <result property="merchantSubtype" column="merchant_subtype" /> <result property="region" column="region" /> <result property="address" column="address" /> <result property="latitude" column="latitude" /> <result property="longitude" column="longitude" /> </resultMap>
<sql id="selectMerchantMapInfoVo"> select id, merchant_name, merchant_type, merchant_subtype, region, address, latitude, longitude from merchant_map_info </sql>
<select id="selectMerchantMapInfoList" parameterType="MerchantMapInfo" resultMap="MerchantMapInfoResult"> <include refid="selectMerchantMapInfoVo"/> <where> <if test="merchantName != null and merchantName != ''"> and merchant_name like concat('%', #{merchantName}, '%')</if> <if test="merchantType != null and merchantType != ''"> and merchant_type = #{merchantType}</if> <if test="merchantSubtype != null and merchantSubtype != ''"> and merchant_subtype = #{merchantSubtype}</if> <if test="region != null and region != ''"> and region = #{region}</if> <if test="address != null and address != ''"> and address = #{address}</if> <if test="latitude != null "> and latitude = #{latitude}</if> <if test="longitude != null "> and longitude = #{longitude}</if> </where> </select> <select id="selectMerchantMapInfoById" parameterType="Long" resultMap="MerchantMapInfoResult"> <include refid="selectMerchantMapInfoVo"/> where id = #{id} </select>
<insert id="insertMerchantMapInfo" parameterType="MerchantMapInfo" useGeneratedKeys="true" keyProperty="id"> insert into merchant_map_info <trim prefix="(" suffix=")" suffixOverrides=","> <if test="merchantName != null and merchantName != ''">merchant_name,</if> <if test="merchantType != null and merchantType != ''">merchant_type,</if> <if test="merchantSubtype != null">merchant_subtype,</if> <if test="region != null and region != ''">region,</if> <if test="address != null and address != ''">address,</if> <if test="latitude != null">latitude,</if> <if test="longitude != null">longitude,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="merchantName != null and merchantName != ''">#{merchantName},</if> <if test="merchantType != null and merchantType != ''">#{merchantType},</if> <if test="merchantSubtype != null">#{merchantSubtype},</if> <if test="region != null and region != ''">#{region},</if> <if test="address != null and address != ''">#{address},</if> <if test="latitude != null">#{latitude},</if> <if test="longitude != null">#{longitude},</if> </trim> </insert>
<update id="updateMerchantMapInfo" parameterType="MerchantMapInfo"> update merchant_map_info <trim prefix="SET" suffixOverrides=","> <if test="merchantName != null and merchantName != ''">merchant_name = #{merchantName},</if> <if test="merchantType != null and merchantType != ''">merchant_type = #{merchantType},</if> <if test="merchantSubtype != null">merchant_subtype = #{merchantSubtype},</if> <if test="region != null and region != ''">region = #{region},</if> <if test="address != null and address != ''">address = #{address},</if> <if test="latitude != null">latitude = #{latitude},</if> <if test="longitude != null">longitude = #{longitude},</if> </trim> where id = #{id} </update>
<delete id="deleteMerchantMapInfoById" parameterType="Long"> delete from merchant_map_info where id = #{id} </delete>
<delete id="deleteMerchantMapInfoByIds" parameterType="String"> delete from merchant_map_info where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete></mapper>
|