ContractLogMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.goafanti.common.dao.ContractLogMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.ContractLog" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="cid" property="cid" jdbcType="VARCHAR" />
  7. <result column="record_time" property="recordTime" jdbcType="TIMESTAMP" />
  8. <result column="status" property="status" jdbcType="INTEGER" />
  9. <result column="principal" property="principal" jdbcType="VARCHAR" />
  10. <result column="operator" property="operator" jdbcType="VARCHAR" />
  11. <result column="comment" property="comment" jdbcType="VARCHAR" />
  12. </resultMap>
  13. <sql id="Base_Column_List" >
  14. id, cid, record_time, status, principal, operator, comment
  15. </sql>
  16. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  17. select
  18. <include refid="Base_Column_List" />
  19. from contract_log
  20. where id = #{id,jdbcType=VARCHAR}
  21. </select>
  22. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  23. delete from contract_log
  24. where id = #{id,jdbcType=VARCHAR}
  25. </delete>
  26. <insert id="insert" parameterType="com.goafanti.common.model.ContractLog" >
  27. insert into contract_log (id, cid, record_time,
  28. status, principal, operator,
  29. comment)
  30. values (#{id,jdbcType=VARCHAR}, #{cid,jdbcType=VARCHAR}, #{recordTime,jdbcType=TIMESTAMP},
  31. #{status,jdbcType=INTEGER}, #{principal,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR},
  32. #{comment,jdbcType=VARCHAR})
  33. </insert>
  34. <insert id="insertSelective" parameterType="com.goafanti.common.model.ContractLog" >
  35. insert into contract_log
  36. <trim prefix="(" suffix=")" suffixOverrides="," >
  37. <if test="id != null" >
  38. id,
  39. </if>
  40. <if test="cid != null" >
  41. cid,
  42. </if>
  43. <if test="recordTime != null" >
  44. record_time,
  45. </if>
  46. <if test="status != null" >
  47. status,
  48. </if>
  49. <if test="principal != null" >
  50. principal,
  51. </if>
  52. <if test="operator != null" >
  53. operator,
  54. </if>
  55. <if test="comment != null" >
  56. comment,
  57. </if>
  58. </trim>
  59. <trim prefix="values (" suffix=")" suffixOverrides="," >
  60. <if test="id != null" >
  61. #{id,jdbcType=VARCHAR},
  62. </if>
  63. <if test="cid != null" >
  64. #{cid,jdbcType=VARCHAR},
  65. </if>
  66. <if test="recordTime != null" >
  67. #{recordTime,jdbcType=TIMESTAMP},
  68. </if>
  69. <if test="status != null" >
  70. #{status,jdbcType=INTEGER},
  71. </if>
  72. <if test="principal != null" >
  73. #{principal,jdbcType=VARCHAR},
  74. </if>
  75. <if test="operator != null" >
  76. #{operator,jdbcType=VARCHAR},
  77. </if>
  78. <if test="comment != null" >
  79. #{comment,jdbcType=VARCHAR},
  80. </if>
  81. </trim>
  82. </insert>
  83. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ContractLog" >
  84. update contract_log
  85. <set >
  86. <if test="cid != null" >
  87. cid = #{cid,jdbcType=VARCHAR},
  88. </if>
  89. <if test="recordTime != null" >
  90. record_time = #{recordTime,jdbcType=TIMESTAMP},
  91. </if>
  92. <if test="status != null" >
  93. status = #{status,jdbcType=INTEGER},
  94. </if>
  95. <if test="principal != null" >
  96. principal = #{principal,jdbcType=VARCHAR},
  97. </if>
  98. <if test="operator != null" >
  99. operator = #{operator,jdbcType=VARCHAR},
  100. </if>
  101. <if test="comment != null" >
  102. comment = #{comment,jdbcType=VARCHAR},
  103. </if>
  104. </set>
  105. where id = #{id,jdbcType=VARCHAR}
  106. </update>
  107. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ContractLog" >
  108. update contract_log
  109. set cid = #{cid,jdbcType=VARCHAR},
  110. record_time = #{recordTime,jdbcType=TIMESTAMP},
  111. status = #{status,jdbcType=INTEGER},
  112. principal = #{principal,jdbcType=VARCHAR},
  113. operator = #{operator,jdbcType=VARCHAR},
  114. comment = #{comment,jdbcType=VARCHAR}
  115. where id = #{id,jdbcType=VARCHAR}
  116. </update>
  117. <insert id="insertBatch" parameterType="com.goafanti.common.model.ContractLog">
  118. insert into contract_log (id, cid, record_time, status, principal, operator, comment)
  119. values
  120. <foreach item="item" index="index" collection="list" separator=",">
  121. (
  122. #{item.id,jdbcType=VARCHAR}, #{item.cid,jdbcType=VARCHAR}, #{item.recordTime,jdbcType=TIMESTAMP},
  123. #{item.status,jdbcType=INTEGER}, #{item.principal,jdbcType=VARCHAR}, #{item.operator,jdbcType=VARCHAR},
  124. #{item.comment,jdbcType=VARCHAR}
  125. )
  126. </foreach>
  127. </insert>
  128. <select id="selectContractLogByCid" parameterType="java.lang.String" resultMap="BaseResultMap">
  129. select cl.id, cl.cid, cl.comment, cl.record_time,
  130. cl.status, aa.name as operator, a.name as principal
  131. FROM contract_log cl
  132. LEFT JOIN admin aa on aa.id = cl.operator
  133. LEFT JOIN admin a on a.id = cl.principal
  134. where cl.cid = #{cid,jdbcType=VARCHAR}
  135. order by cl.record_time
  136. </select>
  137. </mapper>