PatentLogMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.PatentLogMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.PatentLog" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="pid" property="pid" jdbcType="VARCHAR" />
  7. <result column="record_time" property="recordTime" jdbcType="TIMESTAMP" />
  8. <result column="state" property="state" 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, pid, record_time, state, 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 patent_log
  20. where id = #{id,jdbcType=VARCHAR}
  21. </select>
  22. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  23. delete from patent_log
  24. where id = #{id,jdbcType=VARCHAR}
  25. </delete>
  26. <insert id="insert" parameterType="com.goafanti.common.model.PatentLog" >
  27. insert into patent_log (id, pid, record_time,
  28. state, principal, operator,
  29. comment)
  30. values (#{id,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{recordTime,jdbcType=TIMESTAMP},
  31. #{state,jdbcType=INTEGER}, #{principal,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR},
  32. #{comment,jdbcType=VARCHAR})
  33. </insert>
  34. <insert id="insertSelective" parameterType="com.goafanti.common.model.PatentLog" >
  35. insert into patent_log
  36. <trim prefix="(" suffix=")" suffixOverrides="," >
  37. <if test="id != null" >
  38. id,
  39. </if>
  40. <if test="pid != null" >
  41. pid,
  42. </if>
  43. <if test="recordTime != null" >
  44. record_time,
  45. </if>
  46. <if test="state != null" >
  47. state,
  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="pid != null" >
  64. #{pid,jdbcType=VARCHAR},
  65. </if>
  66. <if test="recordTime != null" >
  67. #{recordTime,jdbcType=TIMESTAMP},
  68. </if>
  69. <if test="state != null" >
  70. #{state,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.PatentLog" >
  84. update patent_log
  85. <set >
  86. <if test="pid != null" >
  87. pid = #{pid,jdbcType=VARCHAR},
  88. </if>
  89. <if test="recordTime != null" >
  90. record_time = #{recordTime,jdbcType=TIMESTAMP},
  91. </if>
  92. <if test="state != null" >
  93. state = #{state,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.PatentLog" >
  108. update patent_log
  109. set pid = #{pid,jdbcType=VARCHAR},
  110. record_time = #{recordTime,jdbcType=TIMESTAMP},
  111. state = #{state,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="selectProcessByPid" parameterType="java.lang.String" resultMap="BaseResultMap">
  118. select b.name as principal , m.operator , m.id , m.pid , m.state , m.comment , m.record_time from
  119. (select a.name as operator, p.id ,p.pid , p.state , p.comment ,p.record_time , p.principal as pri
  120. from patent_log p LEFT JOIN admin a
  121. on a.id = p.operator ) m LEFT JOIN admin b on m.pri = b. id
  122. where pid = #{pid,jdbcType=VARCHAR} order by m.record_time desc
  123. </select>
  124. </mapper>