unis_sip/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml

112 lines
5.9 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.ruoyi.sip.mapper.PartnerInfoMapper">
<resultMap type="PartnerInfo" id="PartnerInfoResult">
<result property="id" column="id" />
<result property="partnerCode" column="partner_code" />
<result property="partnerName" column="partner_name" />
<result property="province" column="province" />
<result property="city" column="city" />
<result property="address" column="address" />
<result property="contactPerson" column="contact_person" />
<result property="contactPhone" column="contact_phone" />
<result property="level" column="level" />
<result property="createAt" column="create_at" />
<result property="updateAt" column="update_at" />
<result property="deleteAt" column="delete_at" />
<result property="status" column="status" />
</resultMap>
<sql id="selectPartnerInfoVo">
select id, partner_code, partner_name, province, city, address, contact_person, contact_phone, level, create_at, update_at, delete_at, status from partner_info
</sql>
<select id="selectPartnerInfoList" parameterType="PartnerInfo" resultMap="PartnerInfoResult">
<include refid="selectPartnerInfoVo"/>
<where>
<if test="partnerCode != null and partnerCode != ''"> and partner_code like concat('%', #{partnerCode}, '%')</if>
<if test="partnerName != null and partnerName != ''"> and partner_name like concat('%', #{partnerName}, '%')</if>
<if test="level != null and level != ''"> and level = #{level}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
</where>
</select>
<select id="selectPartnerInfoById" parameterType="Long" resultMap="PartnerInfoResult">
<include refid="selectPartnerInfoVo"/>
where id = #{id}
</select>
<select id="selectCountByCode" resultType="java.lang.Integer">
select count(1) from partner_info where partner_code = #{partnerCode} and status=0
<if test="id != null">and id != #{id}</if>
</select>
<insert id="insertPartnerInfo" parameterType="PartnerInfo" useGeneratedKeys="true" keyProperty="id">
insert into partner_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="partnerCode != null and partnerCode != ''">partner_code,</if>
<if test="partnerName != null and partnerName != ''">partner_name,</if>
<if test="province != null">province,</if>
<if test="city != null">city,</if>
<if test="address != null">address,</if>
<if test="contactPerson != null">contact_person,</if>
<if test="contactPhone != null">contact_phone,</if>
<if test="level != null">level,</if>
<if test="createAt != null">create_at,</if>
<if test="updateAt != null">update_at,</if>
<if test="deleteAt != null">delete_at,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy!=''">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="partnerCode != null and partnerCode != ''">#{partnerCode},</if>
<if test="partnerName != null and partnerName != ''">#{partnerName},</if>
<if test="province != null">#{province},</if>
<if test="city != null">#{city},</if>
<if test="address != null">#{address},</if>
<if test="contactPerson != null">#{contactPerson},</if>
<if test="contactPhone != null">#{contactPhone},</if>
<if test="level != null">#{level},</if>
<if test="createAt != null">#{createAt},</if>
<if test="updateAt != null">#{updateAt},</if>
<if test="deleteAt != null">#{deleteAt},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy!=''">#{createBy},</if>
</trim>
</insert>
<update id="updatePartnerInfo" parameterType="PartnerInfo">
update partner_info
<trim prefix="SET" suffixOverrides=",">
<if test="partnerCode != null and partnerCode != ''">partner_code = #{partnerCode},</if>
<if test="partnerName != null and partnerName != ''">partner_name = #{partnerName},</if>
<if test="province != null">province = #{province},</if>
<if test="city != null">city = #{city},</if>
<if test="address != null">address = #{address},</if>
<if test="contactPerson != null">contact_person = #{contactPerson},</if>
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
<if test="level != null">level = #{level},</if>
<if test="createAt != null">create_at = #{createAt},</if>
<if test="updateAt != null">update_at = #{updateAt},</if>
<if test="deleteAt != null">delete_at = #{deleteAt},</if>
<if test="status != null">status = #{status},</if>
<if test="updateBy != null and updateBy!=''">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePartnerInfoById" parameterType="Long">
delete from partner_info where id = #{id}
</delete>
<delete id="deletePartnerInfoByIds" parameterType="String">
delete from partner_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>