LicenseMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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.zhyc.xps.sys.mapper.LicenseMapper">
  4. <resultMap id="OcLicenseDtoResultMap" type="com.zhyc.xps.sys.dto.LicenseDto">
  5. <result column="ocId" property="ocId" jdbcType="BIGINT" />
  6. <result column="lic_key" property="licKey" jdbcType="VARCHAR" />
  7. <result column="lic_value" property="licValue" jdbcType="VARCHAR" />
  8. <result column="expired_time" property="expiredTime" jdbcType="TIMESTAMP" />
  9. <result column="lic_desc" property="licDesc" jdbcType="VARCHAR" />
  10. </resultMap>
  11. <sql id="OcLicenseDto_Cols">
  12. oc_id,
  13. lic_key,
  14. lic_value,
  15. expired_time,
  16. lic_desc
  17. </sql>
  18. <!--基于ID查询-->
  19. <select id="getByKey" resultMap="OcLicenseDtoResultMap">
  20. SELECT
  21. <include refid="OcLicenseDto_Cols"/>
  22. FROM oc_license
  23. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  24. AND lic_key = #{licKey ,jdbcType=VARCHAR}
  25. </select>
  26. <!--列表查询-->
  27. <select id="getByList" resultMap="OcLicenseDtoResultMap">
  28. SELECT
  29. <include refid="OcLicenseDto_Cols"/>
  30. FROM oc_license
  31. WHERE deleted_flag = 0
  32. WHERE oc_id = #{ocId ,jdbcType=BIGINT}
  33. </select>
  34. <!--新增 -->
  35. <insert id="create" parameterType="com.zhyc.xps.sys.entity.OrgCat">
  36. INSERT INTO oc_license
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="ocId != null">
  39. oc_id,
  40. </if>
  41. <if test="licKey != null and licKey != ''">
  42. lic_key,
  43. </if>
  44. <if test="licValue != null and licValue !=''">
  45. lic_value,
  46. </if>
  47. <if test="expiredTime != null">
  48. expired_time,
  49. </if>
  50. <if test="licDesc != null and licDesc !=''">
  51. lic_desc,
  52. </if>
  53. <if test="createdBy != null">
  54. created_by,
  55. </if>
  56. <if test="createdAt != null">
  57. created_at,
  58. </if>
  59. </trim>
  60. <trim prefix="values (" suffix=")" suffixOverrides=",">
  61. <if test="ocId != null">
  62. #{ocId ,jdbcType=BIGINT},
  63. </if>
  64. <if test="licKey != null and licKey != ''">
  65. #{licKey ,jdbcType=VARCHAR},
  66. </if>
  67. <if test="licValue != null and licValue != ''">
  68. #{licValue ,jdbcType=VARCHAR},
  69. </if>
  70. <if test="expiredTime != null">
  71. #{expiredTime ,jdbcType=TIMESTAMP},
  72. </if>
  73. <if test="licDesc != null and licDesc !=''">
  74. #{licDesc ,jdbcType=VARCHAR},
  75. </if>
  76. <if test="createdBy != null">
  77. #{createdBy ,jdbcType=BIGINT},
  78. </if>
  79. <if test="createdAt != null">
  80. #{createdAt ,jdbcType=TIMESTAMP},
  81. </if>
  82. </trim>
  83. </insert>
  84. <!--更新-->
  85. <update id="update" parameterType="com.zhyc.xps.sys.entity.OrgCat">
  86. UPDATE oc_license
  87. <trim suffixOverrides=",">
  88. <set>
  89. <if test="licValue != null and licValue != ''">
  90. lic_value = #{licValue, jdbcType=VARCHAR},
  91. </if>
  92. <if test="expiredTime != null">
  93. expired_time = #{expiredTime ,jdbcType=TIMESTAMP},
  94. </if>
  95. <if test="licDesc != null and licDesc != ''">
  96. lic_desc = #{licDesc, jdbcType=VARCHAR},
  97. </if>
  98. <if test="updatedBy != null">
  99. updated_by = #{updatedBy ,jdbcType=BIGINT},
  100. </if>
  101. <if test="updatedAt != null">
  102. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  103. </if>
  104. </set>
  105. </trim>
  106. WHERE 1 = 1
  107. <if test="ocId != null">
  108. AND oc_id = #{ocId, jdbcType=BIGINT}
  109. </if>
  110. <if test="licKey != null and licKey != ''">
  111. AND lic_key = #{licKey, jdbcType=VARCHAR}
  112. </if>
  113. </update>
  114. <!--删除-->
  115. <update id="delete" parameterType="java.util.Map">
  116. UPDATE oc_license
  117. <trim suffixOverrides=",">
  118. <set>
  119. <if test="deletedFlag != null">
  120. deleted_flag = #{deletedFlag,jdbcType=BIGINT},
  121. </if>
  122. <if test="deletedTime != null">
  123. deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
  124. </if>
  125. <if test="deletedBy != null">
  126. deleted_by = #{deletedBy,jdbcType=BIGINT},
  127. </if>
  128. </set>
  129. </trim>
  130. WHERE 1 =1
  131. <if test="ocId != null">
  132. AND oc_id = #{ocId, jdbcType=BIGINT}
  133. </if>
  134. <if test="licKey != null and licKey != ''">
  135. AND lic_key = #{licKey, jdbcType=VARCHAR}
  136. </if>
  137. </update>
  138. </mapper>