TenantContractTemplateMapper.xml 4.8 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. <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
  4. <mapper namespace="com.ym.mec.biz.dal.dao.TenantContractTemplateDao">
  5. <resultMap type="com.ym.mec.biz.dal.entity.TenantContractTemplate"
  6. id="TenantContractTemplate">
  7. <result column="id_" property="id" />
  8. <result column="name_" property="name" />
  9. <result column="type_" property="type" />
  10. <result column="contract_template_content_" property="contractTemplateContent" />
  11. <result column="origanal_file_url_" property="origanalFileUrl" />
  12. <result column="contract_no_" property="contractNo" />
  13. <result column="status_" property="status" />
  14. <result column="version_" property="version" />
  15. <result column="modify_by_" property="modifyBy" />
  16. <result column="update_time_" property="updateTime" />
  17. <result column="create_time_" property="createTime" />
  18. <result column="owner_" property="owner" />
  19. <result column="tenant_id_" property="tenantId" />
  20. </resultMap>
  21. <resultMap type="com.ym.mec.biz.dal.dto.TenantContractTemplateDto"
  22. id="TenantContractTemplateDto">
  23. <result column="latest_operator_" property="latestOperator" />
  24. </resultMap>
  25. <!-- 根据主键查询一条记录 -->
  26. <select id="get" resultMap="TenantContractTemplate">
  27. SELECT * FROM tenant_contract_template WHERE id_ = #{id}
  28. </select>
  29. <!-- 全查询 -->
  30. <select id="findAll" resultMap="TenantContractTemplate">
  31. SELECT * FROM tenant_contract_template ORDER BY id_
  32. </select>
  33. <!-- 向数据库增加一条记录 -->
  34. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.TenantContractTemplate"
  35. useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  36. <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
  37. AS ID FROM DUAL </selectKey> -->
  38. INSERT INTO tenant_contract_template
  39. (id_,name_,type_,contract_template_content_,origanal_file_url_,contract_no_,status_,version_,modify_by_,update_time_,create_time_,owner_,tenant_id_)
  40. VALUES(#{id},#{name},#{type},#{contractTemplateContent},#{origanalFileUrl},#{contractNo},#{status},#{version},#{modifyBy},#{updateTime},#{createTime},#{owner},#{tenantId})
  41. </insert>
  42. <!-- 根据主键查询一条记录 -->
  43. <update id="update" parameterType="com.ym.mec.biz.dal.entity.TenantContractTemplate">
  44. UPDATE tenant_contract_template
  45. <set>
  46. <if test="contractTemplateContent != null">
  47. contract_template_content_ = #{contractTemplateContent},
  48. </if>
  49. <if test="status != null">
  50. status_ = #{status},
  51. </if>
  52. <if test="type != null">
  53. type_ = #{type},
  54. </if>
  55. <if test="origanalFileUrl != null">
  56. origanal_file_url_ = #{origanalFileUrl},
  57. </if>
  58. <if test="id != null">
  59. id_ = #{id},
  60. </if>
  61. <if test="updateTime != null">
  62. update_time_ = #{updateTime},
  63. </if>
  64. <if test="version != null">
  65. version_ = #{version},
  66. </if>
  67. <if test="modifyBy != null">
  68. modify_by_ = #{modifyBy},
  69. </if>
  70. <if test="contractNo != null">
  71. contract_no_ = #{contractNo},
  72. </if>
  73. <if test="name != null">
  74. name_ = #{name},
  75. </if>
  76. <if test="createTime != null">
  77. create_time_ = #{createTime},
  78. </if>
  79. <if test="owner != null">
  80. owner_ = #{owner},
  81. </if>
  82. </set>
  83. WHERE id_ = #{id} and tenant_id_ = #{tenantId}
  84. </update>
  85. <!-- 根据主键删除一条记录 -->
  86. <delete id="delete">
  87. DELETE FROM tenant_contract_template WHERE id_ = #{id}
  88. </delete>
  89. <!-- 分页查询 -->
  90. <select id="queryPageList" resultMap="TenantContractTemplateDto"
  91. parameterType="map">
  92. SELECT tct.*,u.real_name_ latest_operator_ FROM tenant_contract_template tct left join sys_user u on tct.modify_by_ = u.id_
  93. <where>
  94. <if test="status != null">
  95. and tct.status_ = #{status}
  96. </if>
  97. <if test="type != null">
  98. and tct.type_ = #{type}
  99. </if>
  100. <if test="owner != null">
  101. and tct.owner_ = #{owner}
  102. </if>
  103. </where>
  104. ORDER BY id_
  105. <include refid="global.limit" />
  106. </select>
  107. <!-- 查询当前表的总记录数 -->
  108. <select id="queryCount" resultType="int">
  109. SELECT COUNT(tct.id_) FROM tenant_contract_template tct
  110. <where>
  111. <if test="status != null">
  112. and tct.status_ = #{status}
  113. </if>
  114. <if test="type != null">
  115. and tct.type_ = #{type}
  116. </if>
  117. <if test="owner != null">
  118. and tct.owner_ = #{owner}
  119. </if>
  120. </where>
  121. </select>
  122. <select id="queryLatestContractTemplate" resultMap="TenantContractTemplate" parameterType="map">
  123. SELECT * FROM tenant_contract_template where type_ = #{type} and owner_ = #{owner} and status_ = 1 and tenant_id_ = #{tenantId}
  124. </select>
  125. <update id="disableContract" parameterType="map">
  126. update tenant_contract_template set status_ = 0 where type_ = #{type} and owner_ = #{owner} and status_ = 1 and tenant_id_ = #{tenantId}
  127. </update>
  128. </mapper>