CrmCustomerHisOrderMapper.xml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.crm.mapper.CrmCustomerHisOrderMapper">
  6. <resultMap type="CrmCustomerHisOrder" id="CrmCustomerHisOrderResult">
  7. <result property="orderId" column="order_id" />
  8. <result property="customerId" column="customer_id" />
  9. <result property="customerCode" column="customer_code" />
  10. <result property="orderJson" column="order_json" />
  11. <result property="itemJson" column="item_json" />
  12. <result property="createTime" column="create_time" />
  13. </resultMap>
  14. <sql id="selectCrmCustomerHisOrderVo">
  15. select order_id, customer_id, customer_code, order_json, item_json, create_time from crm_customer_his_order
  16. </sql>
  17. <select id="selectCrmCustomerHisOrderList" parameterType="CrmCustomerHisOrder" resultMap="CrmCustomerHisOrderResult">
  18. <include refid="selectCrmCustomerHisOrderVo"/>
  19. <where>
  20. <if test="customerId != null "> and customer_id = #{customerId}</if>
  21. <if test="customerCode != null and customerCode != ''"> and customer_code = #{customerCode}</if>
  22. <if test="orderJson != null and orderJson != ''"> and order_json = #{orderJson}</if>
  23. <if test="itemJson != null and itemJson != ''"> and item_json = #{itemJson}</if>
  24. </where>
  25. </select>
  26. <select id="selectCrmCustomerHisOrderById" parameterType="Long" resultMap="CrmCustomerHisOrderResult">
  27. <include refid="selectCrmCustomerHisOrderVo"/>
  28. where order_id = #{orderId}
  29. </select>
  30. <insert id="insertCrmCustomerHisOrder" parameterType="CrmCustomerHisOrder" useGeneratedKeys="true" keyProperty="orderId">
  31. insert into crm_customer_his_order
  32. <trim prefix="(" suffix=")" suffixOverrides=",">
  33. <if test="customerId != null">customer_id,</if>
  34. <if test="customerCode != null">customer_code,</if>
  35. <if test="orderJson != null">order_json,</if>
  36. <if test="itemJson != null">item_json,</if>
  37. <if test="createTime != null">create_time,</if>
  38. </trim>
  39. <trim prefix="values (" suffix=")" suffixOverrides=",">
  40. <if test="customerId != null">#{customerId},</if>
  41. <if test="customerCode != null">#{customerCode},</if>
  42. <if test="orderJson != null">#{orderJson},</if>
  43. <if test="itemJson != null">#{itemJson},</if>
  44. <if test="createTime != null">#{createTime},</if>
  45. </trim>
  46. </insert>
  47. <update id="updateCrmCustomerHisOrder" parameterType="CrmCustomerHisOrder">
  48. update crm_customer_his_order
  49. <trim prefix="SET" suffixOverrides=",">
  50. <if test="customerId != null">customer_id = #{customerId},</if>
  51. <if test="customerCode != null">customer_code = #{customerCode},</if>
  52. <if test="orderJson != null">order_json = #{orderJson},</if>
  53. <if test="itemJson != null">item_json = #{itemJson},</if>
  54. <if test="createTime != null">create_time = #{createTime},</if>
  55. </trim>
  56. where order_id = #{orderId}
  57. </update>
  58. <delete id="deleteCrmCustomerHisOrderById" parameterType="Long">
  59. delete from crm_customer_his_order where order_id = #{orderId}
  60. </delete>
  61. <delete id="deleteCrmCustomerHisOrderByIds" parameterType="String">
  62. delete from crm_customer_his_order where order_id in
  63. <foreach item="orderId" collection="array" open="(" separator="," close=")">
  64. #{orderId}
  65. </foreach>
  66. </delete>
  67. </mapper>