unis_sip/ruoyi-sip/src/main/resources/mapper/Quotation/QuotationMapper.xml

281 lines
7.8 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.QuotationMapper">
<resultMap type="com.ruoyi.sip.domain.Quotation" id="QuotationMap">
<result property="id" column="id"/>
<result property="quotationCode" column="quotation_code"/>
<result property="quotationName" column="quotation_name"/>
<result property="quotationAmount" column="quotation_amount"/>
<result property="discountAmount" column="discount_amount"/>
<result property="quotationStatus" column="quotation_status"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="agentCode" column="agent_code"/>
<result property="amountType" column="amount_type"/>
<result property="customerName" column="customer_name"/>
</resultMap>
<!-- 基本字段 -->
<sql id="Base_Column_List">
id
, quotation_code, quotation_name, quotation_amount, discount_amount, quotation_status, create_time, create_by, update_by, update_time, remark, agent_code, amount_type, customer_name
</sql>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="QuotationMap">
select
<include refid="Base_Column_List"/>
from oms_quotation
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="quotationCode != null and quotationCode != ''">
and quotation_code = #{quotationCode}
</if>
<if test="quotationName != null and quotationName != ''">
and quotation_name = #{quotationName}
</if>
<if test="quotationAmount != null">
and quotation_amount = #{quotationAmount}
</if>
<if test="discountAmount != null">
and discount_amount = #{discountAmount}
</if>
<if test="quotationStatus != null and quotationStatus != ''">
and quotation_status = #{quotationStatus}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
<if test="agentCode != null and agentCode != ''">
and agent_code = #{agentCode}
</if>
<if test="amountType != null and amountType != ''">
and amount_type = #{amountType}
</if>
<if test="customerName != null and customerName != ''">
and customer_name = #{customerName}
</if>
<if test="customerName != null and customerName != ''">
and customer_name = #{customerName}
</if>
<if test="createTimeStart != null or createTimeEnd != null">
<choose>
<when test="createTimeStart != null and createTimeEnd != null">
and create_time between date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="createTimeStart != null">
and create_time <![CDATA[ >= ]]> date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="createTimeEnd != null">
and create_time <![CDATA[ <= ]]> date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
</where>
</select>
<!--根据ID查详情-->
<select id="queryById" parameterType="Integer" resultMap="QuotationMap">
SELECT id,
quotation_code,
quotation_name,
quotation_amount,
discount_amount,
quotation_status,
create_time,
create_by,
update_by,
update_time,
remark,
agent_code,
amount_type,
customer_name
FROM oms_quotation
WHERE id = #{id} LIMIT 1
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO oms_quotation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="quotationCode != null and quotationCode != ''">
quotation_code,
</if>
<if test="quotationName != null and quotationName != ''">
quotation_name,
</if>
<if test="quotationAmount != null">
quotation_amount,
</if>
<if test="discountAmount != null">
discount_amount,
</if>
<if test="quotationStatus != null and quotationStatus != ''">
quotation_status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="agentCode != null and agentCode != ''">
agent_code,
</if>
<if test="amountType != null and amountType != ''">
amount_type,
</if>
<if test="customerName != null and customerName != ''">
customer_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quotationCode != null and quotationCode != ''">
#{quotationCode},
</if>
<if test="quotationName != null and quotationName != ''">
#{quotationName},
</if>
<if test="quotationAmount != null">
#{quotationAmount},
</if>
<if test="discountAmount != null">
#{discountAmount},
</if>
<if test="quotationStatus != null and quotationStatus != ''">
#{quotationStatus},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="createBy != null and createBy != ''">
#{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="agentCode != null and agentCode != ''">
#{agentCode},
</if>
<if test="amountType != null and amountType != ''">
#{amountType},
</if>
<if test="customerName != null and customerName != ''">
#{customerName},
</if>
</trim>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE oms_quotation
<trim prefix="SET" suffixOverrides=",">
<if test="quotationCode != null and quotationCode != ''">
quotation_code = #{quotationCode},
</if>
<if test="quotationName != null and quotationName != ''">
quotation_name = #{quotationName},
</if>
<if test="quotationAmount != null">
quotation_amount = #{quotationAmount},
</if>
<if test="discountAmount != null">
discount_amount = #{discountAmount},
</if>
<if test="quotationStatus != null and quotationStatus != ''">
quotation_status = #{quotationStatus},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="agentCode != null and agentCode != ''">
agent_code = #{agentCode},
</if>
<if test="amountType != null and amountType != ''">
amount_type = #{amountType},
</if>
<if test="customerName != null and customerName != ''">
customer_name = #{customerName},
</if>
</trim>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE
FROM oms_quotation
WHERE id = #{id}
</delete>
<!--通过id批量删除-->
<delete id="batchRemove">
delete from oms_quotation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>