InvoiceModelMapper.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE mapper
  2. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.bosshand.virgo.api.workark.dao.InvoiceModelDao">
  5. <resultMap type="com.bosshand.virgo.api.workark.model.InvoiceModel" id="result">
  6. <id column="id" property="id"/>
  7. <result column="organizationId" property="organizationId"/>
  8. <result column="userId" property="userId"/>
  9. <result column="type" property="type"/>
  10. <result column="name" property="name"/>
  11. <result column="taxpayerIdentificationNumber" property="taxpayerIdentificationNumber"/>
  12. <result column="address" property="address"/>
  13. <result column="phone" property="phone"/>
  14. <result column="bankAccount" property="bankAccount"/>
  15. <result column="bankAccountNumber" property="bankAccountNumber"/>
  16. <result column="content" property="content"/>
  17. </resultMap>
  18. <select id="get" resultMap="result">
  19. select * from workark_invoice_model where id = #{id}
  20. </select>
  21. <select id="getList" resultMap="result">
  22. select * from workark_invoice_model
  23. <where>
  24. <if test="organizationId != 0">
  25. and organizationId = #{organizationId}
  26. </if>
  27. <if test="userId != 0">
  28. and userId = #{userId}
  29. </if>
  30. <if test="type != null">
  31. and type = #{type}
  32. </if>
  33. <if test="name != null">
  34. and name = #{name}
  35. </if>
  36. <if test="taxpayerIdentificationNumber != null">
  37. and taxpayerIdentificationNumber = #{taxpayerIdentificationNumber}
  38. </if>
  39. <if test="phone != null">
  40. and phone = #{phone}
  41. </if>
  42. <if test="bankAccount != null">
  43. and bankAccount = #{bankAccount}
  44. </if>
  45. <if test="bankAccountNumber != null">
  46. and bankAccountNumber = #{bankAccountNumber}
  47. </if>
  48. </where>
  49. </select>
  50. <insert id="save" useGeneratedKeys="true" keyProperty="id">
  51. INSERT INTO workark_invoice_model (`organizationId`, `userId`, `type`, `name`, `taxpayerIdentificationNumber`, `address`, `phone`, `bankAccount`, `bankAccountNumber`, `content`)
  52. VALUES (#{organizationId}, #{userId}, #{type}, #{name}, #{taxpayerIdentificationNumber}, #{address}, #{phone}, #{bankAccount}, #{bankAccountNumber}, #{content})
  53. </insert>
  54. <update id="update" parameterType="com.bosshand.virgo.api.workark.model.Invoice">
  55. UPDATE workark_invoice_model
  56. <trim prefix="set" suffixOverrides=",">
  57. <if test="organizationId != 0">organizationId = #{organizationId},</if>
  58. <if test="userId != 0">userId = #{userId},</if>
  59. <if test="type != null">type = #{type},</if>
  60. <if test="name != null">name = #{name},</if>
  61. <if test="taxpayerIdentificationNumber != null">taxpayerIdentificationNumber = #{taxpayerIdentificationNumber},</if>
  62. <if test="address != null">address = #{address},</if>
  63. <if test="phone != null">phone = #{phone},</if>
  64. <if test="bankAccount != null">bankAccount = #{bankAccount},</if>
  65. <if test="bankAccountNumber != null">bankAccountNumber = #{bankAccountNumber},</if>
  66. <if test="content != null">content = #{content},</if>
  67. </trim>
  68. WHERE id=#{id}
  69. </update>
  70. <delete id="delete">
  71. DELETE FROM workark_invoice_model WHERE id=#{id}
  72. </delete>
  73. </mapper>