codeConvert.sql.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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="codeConvertSqlMapper">
  4. <sql id="base_column">
  5. id,
  6. advertiser_id as advertiserId,
  7. name as convertName,
  8. type as convertType,
  9. script_code as script,
  10. pic_code as picture,
  11. updated
  12. </sql>
  13. <select id="selectByName" parameterType="string" resultType="com.cloudcross.ssp.model.CodeConvert">
  14. select
  15. <include refid="base_column" />
  16. from t_code_convert
  17. <where>
  18. name = #{convertName}
  19. </where>
  20. order by id desc
  21. </select>
  22. <select id="selectById" parameterType="int" resultType="com.cloudcross.ssp.model.CodeConvert">
  23. select
  24. <include refid="base_column" />
  25. from t_code_convert
  26. <where>
  27. id = #{id}
  28. </where>
  29. </select>
  30. <!-- 搜索用-->
  31. <select id="selectByParamsadvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.CodeConvert">
  32. select
  33. <include refid="base_column" />
  34. from t_code_convert
  35. <where>
  36. <if test="advertiserId!=null and advertiserId != '' and advertiserId!=-1 ">
  37. advertiser_id=#{advertiserId}
  38. </if>
  39. <if test="convertName!=null">
  40. and name like #{convertName}
  41. </if>
  42. <!--
  43. <if test="key!=null and value!=null">
  44. <choose>
  45. <when test="key=='convertName'">
  46. and name like #{convertName}
  47. </when>
  48. </choose>
  49. </if>
  50. -->
  51. </where>
  52. limit #{pager.offset}, #{pager.limit}
  53. </select>
  54. <select id="selectByParamsoperator" parameterType="map" resultType="com.cloudcross.ssp.model.CodeConvert">
  55. select
  56. <include refid="base_column" />
  57. from t_code_convert where id>0
  58. <if test="key!=null and value!=null">
  59. <choose>
  60. <when test="key=='convertName'">
  61. and name like #{value}
  62. </when>
  63. <when test="key=='id'">
  64. and id like #{value}
  65. </when>
  66. </choose>
  67. </if>
  68. order by id desc
  69. limit #{pager.offset}, #{pager.limit}
  70. </select>
  71. <select id="countByParamsadvertiser" parameterType="map" resultType="int">
  72. select count(id)
  73. from t_code_convert
  74. <where>
  75. <if test="advertiserId!=null and advertiserId != '' and advertiserId!=-1 ">
  76. advertiser_id=#{advertiserId}
  77. </if>
  78. <if test="convertName!=null">
  79. and name like #{convertName}
  80. </if>
  81. </where>
  82. <!-- <if test="key!=null and value!=null">
  83. <choose>
  84. <when test="key=='id'">
  85. and id like #{value}
  86. </when>
  87. <when test="key=='convertName'">
  88. and name like #{value}
  89. </when>
  90. </choose>
  91. </if>
  92. -->
  93. </select>
  94. <select id="countByParamsoperator" parameterType="map" resultType="int">
  95. select count(id)
  96. from t_code_convert where id>0
  97. <if test="key!=null and value!=null">
  98. <choose>
  99. <when test="key=='id'">
  100. and id like #{value}
  101. </when>
  102. <when test="key=='convertName'">
  103. and name like #{value}
  104. </when>
  105. </choose>
  106. </if>
  107. </select>
  108. <insert id="addCodeConvert" parameterType="com.cloudcross.ssp.model.CodeConvert">
  109. insert into t_code_convert(advertiser_Id, name, type, updated )
  110. values(#{advertiserId},#{convertName},#{convertType},#{updated})
  111. </insert>
  112. <update id="editCodeConvert" parameterType="com.cloudcross.ssp.model.CodeConvert">
  113. update t_code_convert
  114. set name=#{convertName}, type=#{convertType}, updated=#{updated}, script_code=#{script}, pic_code=#{picture}
  115. where id = #{id}
  116. </update>
  117. <!-- 根据id查询代码值 -->
  118. <select id="getScriptById" parameterType="int" resultType="String">
  119. select
  120. script_code
  121. from t_code_convert where id = #{id}
  122. </select>
  123. <!-- 根据id查询图片值 -->
  124. <select id="getPicyureById" parameterType="int" resultType="String">
  125. select
  126. pic_code
  127. from t_code_convert where id = #{id}
  128. </select>
  129. </mapper>