CustomerSettlementUnitMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.zkqy.business.mapper.CustomerSettlementUnitMapper">
  6. <resultMap type="com.zkqy.business.domain.CustomerSettlementUnit" id="CustomerSettlementUnitResult">
  7. <result property="id" column="id" />
  8. <result property="customerId" column="customer_id" />
  9. <result property="customerName" column="customer_name" />
  10. <result property="customerRegion" column="customer_region" />
  11. <result property="remark" column="remark" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createById" column="create_by_id" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateById" column="update_by_id" />
  17. <result property="updateTime" column="update_time" />
  18. <result property="delFlag" column="del_flag" />
  19. </resultMap>
  20. <sql id="selectCustomerSettlementUnitVo">
  21. select id, customer_id, customer_name, customer_region, remark, create_by, create_by_id, create_time, update_by, update_by_id, update_time, del_flag from {DBNAME}.customer_settlement_unit
  22. </sql>
  23. <select id="selectCustomerSettlementUnitList" parameterType="com.zkqy.business.domain.CustomerSettlementUnit" resultMap="CustomerSettlementUnitResult">
  24. <include refid="selectCustomerSettlementUnitVo"/>
  25. where del_flag = '0'
  26. <if test="customerId != null "> and customer_id = #{customerId}</if>
  27. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  28. <if test="customerRegion != null and customerRegion != ''"> and customer_region = #{customerRegion}</if>
  29. </select>
  30. <select id="selectCustomerSettlementUnitById" parameterType="Long" resultMap="CustomerSettlementUnitResult">
  31. <include refid="selectCustomerSettlementUnitVo"/>
  32. where id = #{id}
  33. </select>
  34. <insert id="insertCustomerSettlementUnit" parameterType="com.zkqy.business.domain.CustomerSettlementUnit" useGeneratedKeys="true" keyProperty="id">
  35. insert into {DBNAME}.customer_settlement_unit
  36. <trim prefix="(" suffix=")" suffixOverrides=",">
  37. <if test="customerId != null">customer_id,</if>
  38. <if test="customerName != null">customer_name,</if>
  39. <if test="customerRegion != null">customer_region,</if>
  40. <if test="remark != null">remark,</if>
  41. <if test="createBy != null">create_by,</if>
  42. <if test="createById != null">create_by_id,</if>
  43. <if test="createTime != null">create_time,</if>
  44. del_flag
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="customerId != null">#{customerId},</if>
  48. <if test="customerName != null">#{customerName},</if>
  49. <if test="customerRegion != null">#{customerRegion},</if>
  50. <if test="remark != null">#{remark},</if>
  51. <if test="createBy != null">#{createBy},</if>
  52. <if test="createById != null">#{createById},</if>
  53. <if test="createTime != null">#{createTime},</if>
  54. '0'
  55. </trim>
  56. </insert>
  57. <update id="updateCustomerSettlementUnit" parameterType="com.zkqy.business.domain.CustomerSettlementUnit">
  58. update {DBNAME}.customer_settlement_unit
  59. <trim prefix="SET" suffixOverrides=",">
  60. <if test="customerId != null">customer_id = #{customerId},</if>
  61. <if test="customerName != null">customer_name = #{customerName},</if>
  62. <if test="customerRegion != null">customer_region = #{customerRegion},</if>
  63. <if test="remark != null">remark = #{remark},</if>
  64. <if test="updateBy != null">update_by = #{updateBy},</if>
  65. <if test="updateById != null">update_by_id = #{updateById},</if>
  66. <if test="updateTime != null">update_time = #{updateTime},</if>
  67. </trim>
  68. where id = #{id}
  69. </update>
  70. <delete id="deleteCustomerSettlementUnitById" parameterType="Long">
  71. delete from customer_settlement_unit where id = #{id}
  72. </delete>
  73. <delete id="deleteCustomerSettlementUnitByIds" parameterType="String">
  74. update {DBNAME}.customer_settlement_unit set del_flag = '2' where id in
  75. <foreach item="id" collection="array" open="(" separator="," close=")">
  76. #{id}
  77. </foreach>
  78. </delete>
  79. </mapper>