parent
ed5baeb395
commit
498225344c
@ -0,0 +1,49 @@
|
||||
<?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.example.flower.mapper.DiscountMapper">
|
||||
<select id="discountList" resultType="com.example.flower.entity.Discount">
|
||||
select *
|
||||
from flower.discount
|
||||
order by discount_start_time desc
|
||||
</select>
|
||||
<select id="discountListByQuery" resultType="com.example.flower.entity.Discount">
|
||||
select *
|
||||
from flower.discount
|
||||
<where>
|
||||
<if test="discount_name != null and discount_name != '' ">
|
||||
and discount_name like concat('%',#{discount_name},'%')
|
||||
</if>
|
||||
</where>
|
||||
order by discount_start_time desc
|
||||
</select>
|
||||
<insert id="discountAdd" useGeneratedKeys="true" keyProperty="discount_id" parameterType="com.example.flower.entity.Discount">
|
||||
insert into flower.discount(discount_name, discount_num,discount_f_id,discount_c_id,discount_start_time,discount_end_time)
|
||||
value (#{discount_name},#{discount_num},#{discount_f_id},#{discount_c_id},#{discount_start_time},#{discount_end_time})
|
||||
</insert>
|
||||
<delete id="discountDeletePer">
|
||||
delete
|
||||
from flower.discount
|
||||
where discount_id = #{discount_id}
|
||||
</delete>
|
||||
<delete id="discountDeleteMul" parameterType="Integer">
|
||||
delete from flower.discount where discount.discount_id in
|
||||
<foreach collection="discount_ids" open="(" close=")" separator="," item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="discountInfo" resultType="com.example.flower.entity.Discount">
|
||||
select *
|
||||
from flower.discount
|
||||
where discount_id = #{discount_id}
|
||||
</select>
|
||||
<update id="discountModify" parameterType="com.example.flower.entity.Discount">
|
||||
update flower.discount
|
||||
set discount_name=if(#{discount_name} is not null and #{discount_name} != '',#{discount_name},discount_name),
|
||||
discount_num=#{discount_num},
|
||||
discount_f_id=#{discount_f_id},
|
||||
discount_c_id=#{discount_c_id},
|
||||
discount_start_time=if(#{discount_start_time} is not null and #{discount_start_time} != '',#{discount_start_time},discount_start_time),
|
||||
discount_end_time=if(#{discount_end_time} is not null and #{discount_end_time} != '',#{discount_end_time},discount_end_time)
|
||||
where discount.discount_id = #{discount_id}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in new issue