CmAdvisoryMapper.xml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.caimei.modules.advisory.dao.CmAdvisoryDao">
  4. <sql id="cmAdvisoryColumns">
  5. a.id AS "id",
  6. a.name AS "name",
  7. a.mobile AS "mobile",
  8. a.commitTime AS "commitTime",
  9. a.delFlag AS "delFlag"
  10. </sql>
  11. <sql id="cmAdvisoryJoins">
  12. </sql>
  13. <select id="get" resultType="CmAdvisory">
  14. SELECT
  15. <include refid="cmAdvisoryColumns"/>
  16. FROM cm_advisory a
  17. <include refid="cmAdvisoryJoins"/>
  18. WHERE a.id = #{id}
  19. </select>
  20. <select id="findList" resultType="CmAdvisory">
  21. SELECT
  22. <include refid="cmAdvisoryColumns"/>
  23. FROM cm_advisory a
  24. <include refid="cmAdvisoryJoins"/>
  25. <where>
  26. <if test="name != null and name != ''">
  27. AND a.name LIKE
  28. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  29. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  30. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  31. </if>
  32. <if test="mobile != null and mobile != ''">
  33. AND a.mobile = #{mobile}
  34. </if>
  35. </where>
  36. <choose>
  37. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  38. ORDER BY ${page.orderBy}
  39. </when>
  40. <otherwise>
  41. ORDER BY a.commitTime DESC
  42. </otherwise>
  43. </choose>
  44. </select>
  45. <select id="findAllList" resultType="CmAdvisory">
  46. SELECT
  47. <include refid="cmAdvisoryColumns"/>
  48. FROM cm_advisory a
  49. <include refid="cmAdvisoryJoins"/>
  50. <where>
  51. </where>
  52. <choose>
  53. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  54. ORDER BY ${page.orderBy}
  55. </when>
  56. <otherwise>
  57. </otherwise>
  58. </choose>
  59. </select>
  60. <insert id="insert" parameterType="CmAdvisory" keyProperty="id" useGeneratedKeys="true">
  61. INSERT INTO cm_advisory(
  62. id,
  63. name,
  64. mobile,
  65. commitTime,
  66. delFlag
  67. ) VALUES (
  68. #{id},
  69. #{name},
  70. #{mobile},
  71. #{commitTime},
  72. #{delFlag}
  73. )
  74. </insert>
  75. <update id="update">
  76. UPDATE cm_advisory SET
  77. name = #{name},
  78. mobile = #{mobile},
  79. commitTime = #{commitTime},
  80. delFlag = #{delFlag}
  81. WHERE id = #{id}
  82. </update>
  83. <delete id="delete">
  84. DELETE FROM cm_advisory
  85. WHERE id = #{id}
  86. </delete>
  87. <select id="findUser" resultType="com.caimei.modules.user.entity.CmUser">
  88. SELECT * FROM USER WHERE bindMobile = #{mobile} AND validFlag='1'
  89. </select>
  90. </mapper>