javacodeadmin/ruoyi-system/src/main/resources/mapper/system/MobileNotifyMapper.xml

76 lines
3.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.ruoyi.system.mapper.MobileNotifyMapper">
<resultMap type="MobileNotify" id="MobileNotifyResult">
<result property="id" column="id" />
<result property="phone" column="phone" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectMobileNotifyVo">
select id, phone, province_id, city_id, created_at, updated_at from mobile_notify
</sql>
<select id="selectMobileNotifyList" parameterType="MobileNotify" resultMap="MobileNotifyResult">
<include refid="selectMobileNotifyVo"/>
<where>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
<if test="provinceId != null and provinceId != ''"> and province_id like concat('%', #{provinceId}, '%')</if>
<if test="cityId != null and cityId != ''"> and city_id like concat('%', #{cityId}, '%')</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where>
order by id desc
</select>
<select id="selectMobileNotifyById" parameterType="Long" resultMap="MobileNotifyResult">
<include refid="selectMobileNotifyVo"/>
where id = #{id}
</select>
<insert id="insertMobileNotify" parameterType="MobileNotify" useGeneratedKeys="true" keyProperty="id">
insert into mobile_notify
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="phone != null and phone != ''">phone,</if>
<if test="provinceId != null and provinceId != ''">province_id,</if>
<if test="cityId != null and cityId != ''">city_id,</if>
created_at,
updated_at
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phone != null and phone != ''">#{phone},</if>
<if test="provinceId != null and provinceId != ''">#{provinceId},</if>
<if test="cityId != null and cityId != ''">#{cityId},</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateMobileNotify" parameterType="MobileNotify">
update mobile_notify
<trim prefix="SET" suffixOverrides=",">
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="provinceId != null and provinceId != ''">province_id = #{provinceId},</if>
<if test="cityId != null and cityId != ''">city_id = #{cityId},</if>
updated_at=NOW()
</trim>
where id = #{id}
</update>
<delete id="deleteMobileNotifyById" parameterType="Long">
delete from mobile_notify where id = #{id}
</delete>
<delete id="deleteMobileNotifyByIds" parameterType="String">
delete from mobile_notify where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>