BusiSchoolsMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.voluntary.mapper.BusiSchoolsMapper">
  6. <resultMap type="BusiSchools" id="BusiSchoolsResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="agentId" column="agent_id" />
  10. <result property="location" column="location" />
  11. <result property="pro" column="pro" />
  12. <result property="city" column="city" />
  13. <result property="area" column="area" />
  14. <result property="status" column="status" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateTime" column="update_time" />
  17. </resultMap>
  18. <sql id="selectBusiSchoolsVo">
  19. select id, name, agent_id, location, pro, city, area, status, create_time, update_time from b_busi_schools
  20. </sql>
  21. <select id="selectBusiSchoolsList" parameterType="BusiSchools" resultMap="BusiSchoolsResult">
  22. <include refid="selectBusiSchoolsVo"/>
  23. <where>
  24. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  25. <if test="agentId != null "> and agent_id = #{agentId}</if>
  26. <if test="location != null and location != ''"> and location = #{location}</if>
  27. <if test="pro != null "> and pro = #{pro}</if>
  28. <if test="city != null "> and city = #{city}</if>
  29. <if test="area != null "> and area = #{area}</if>
  30. <if test="status != null "> and status = #{status}</if>
  31. </where>
  32. order by id desc
  33. </select>
  34. <select id="selectBusiSchoolsById" parameterType="Long" resultMap="BusiSchoolsResult">
  35. <include refid="selectBusiSchoolsVo"/>
  36. where id = #{id}
  37. </select>
  38. <select id="selectBusiSchoolsByIds" resultMap="BusiSchoolsResult">
  39. <include refid="selectBusiSchoolsVo"/>
  40. where 1=1 and id in
  41. <foreach collection="list" item="id" open="(" separator="," close=")">
  42. #{id}
  43. </foreach>
  44. </select>
  45. <insert id="insertBusiSchools" parameterType="BusiSchools" useGeneratedKeys="true" keyProperty="id">
  46. insert into b_busi_schools
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="name != null and name != ''">name,</if>
  49. <if test="agentId != null">agent_id,</if>
  50. <if test="location != null">location,</if>
  51. <if test="pro != null">pro,</if>
  52. <if test="city != null">city,</if>
  53. <if test="area != null">area,</if>
  54. <if test="status != null">status,</if>
  55. <if test="createTime != null">create_time,</if>
  56. <if test="updateTime != null">update_time,</if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides=",">
  59. <if test="name != null and name != ''">#{name},</if>
  60. <if test="agentId != null">#{agentId},</if>
  61. <if test="location != null">#{location},</if>
  62. <if test="pro != null">#{pro},</if>
  63. <if test="city != null">#{city},</if>
  64. <if test="area != null">#{area},</if>
  65. <if test="status != null">#{status},</if>
  66. <if test="createTime != null">#{createTime},</if>
  67. <if test="updateTime != null">#{updateTime},</if>
  68. </trim>
  69. </insert>
  70. <update id="updateBusiSchools" parameterType="BusiSchools">
  71. update b_busi_schools
  72. <trim prefix="SET" suffixOverrides=",">
  73. <if test="name != null and name != ''">name = #{name},</if>
  74. <if test="agentId != null">agent_id = #{agentId},</if>
  75. <if test="location != null">location = #{location},</if>
  76. <if test="pro != null">pro = #{pro},</if>
  77. <if test="city != null">city = #{city},</if>
  78. <if test="area != null">area = #{area},</if>
  79. <if test="status != null">status = #{status},</if>
  80. <if test="createTime != null">create_time = #{createTime},</if>
  81. <if test="updateTime != null">update_time = #{updateTime},</if>
  82. </trim>
  83. where id = #{id}
  84. </update>
  85. <delete id="deleteBusiSchoolsById" parameterType="Long">
  86. delete from b_busi_schools where id = #{id}
  87. </delete>
  88. <delete id="deleteBusiSchoolsByIds" parameterType="String">
  89. delete from b_busi_schools where id in
  90. <foreach item="id" collection="array" open="(" separator="," close=")">
  91. #{id}
  92. </foreach>
  93. </delete>
  94. </mapper>