CopyrightLogMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.CopyrightLogMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.CopyrightLog">
  5. <id column="id" jdbcType="VARCHAR" property="id" />
  6. <result column="cid" jdbcType="VARCHAR" property="cid" />
  7. <result column="record_time" jdbcType="TIMESTAMP" property="recordTime" />
  8. <result column="status" jdbcType="INTEGER" property="status" />
  9. <result column="principal" jdbcType="VARCHAR" property="principal" />
  10. <result column="operator" jdbcType="VARCHAR" property="operator" />
  11. <result column="comment" jdbcType="VARCHAR" property="comment" />
  12. </resultMap>
  13. <sql id="Base_Column_List">
  14. id, cid, record_time, status, principal, operator, comment
  15. </sql>
  16. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  17. select
  18. <include refid="Base_Column_List" />
  19. from copyright_log
  20. where id = #{id,jdbcType=VARCHAR}
  21. </select>
  22. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  23. delete from copyright_log
  24. where id = #{id,jdbcType=VARCHAR}
  25. </delete>
  26. <insert id="insert" parameterType="com.goafanti.common.model.CopyrightLog">
  27. insert into copyright_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.CopyrightLog">
  35. insert into copyright_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.CopyrightLog">
  84. update copyright_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.CopyrightLog">
  108. update copyright_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. <select id="findByCopyrightId" parameterType="java.lang.String" resultType="com.goafanti.copyright.bo.CopyrightLogBo">
  118. select a.name as principal, b.name as operator, cl.record_time as recordTime, cl.status as status, cl.comment as comment
  119. from copyright_log cl
  120. left join admin a on cl.principal = a.id
  121. left join admin b on cl.operator = b.id
  122. where cl.cid = #{id,jdbcType=VARCHAR}
  123. order by cl.record_time
  124. </select>
  125. <insert id="batchInsert" parameterType="com.goafanti.common.model.CopyrightLog">
  126. insert into copyright_log (id, cid, record_time, status, principal, operator, comment)
  127. values
  128. <foreach item="item" index="index" collection="list" separator=",">
  129. (
  130. #{item.id,jdbcType=VARCHAR}, #{item.cid,jdbcType=VARCHAR}, #{item.recordTime,jdbcType=TIMESTAMP},
  131. #{item.status,jdbcType=INTEGER}, #{item.principal,jdbcType=VARCHAR}, #{item.operator,jdbcType=VARCHAR},
  132. #{item.comment,jdbcType=VARCHAR}
  133. )
  134. </foreach>
  135. </insert>
  136. </mapper>