BusiAgentsMapper.xml 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.BusiAgentsMapper">
  6. <resultMap type="BusiAgents" id="BusiAgentsResult">
  7. <result property="agentId" column="agent_id" />
  8. <result property="agentType" column="agent_type" />
  9. <result property="phonenumber" column="phonenumber" />
  10. <result property="name" column="name" />
  11. <result property="status" column="status" />
  12. <result property="createTime" column="create_time" />
  13. <result property="userId" column="user_id" />
  14. </resultMap>
  15. <sql id="selectBusiAgentsVo">
  16. select agent_id, agent_type, phonenumber, name, status, create_time,user_id from b_busi_agents
  17. </sql>
  18. <select id="selectBusiAgentsList" parameterType="BusiAgents" resultMap="BusiAgentsResult">
  19. <include refid="selectBusiAgentsVo"/>
  20. <where>
  21. <if test="agentType != null "> and agent_type = #{agentType}</if>
  22. <if test="phonenumber != null and phonenumber != ''"> and phonenumber = #{phonenumber}</if>
  23. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  24. <if test="status != null "> and status = #{status}</if>
  25. <if test="userId != null "> and user_id = #{userId}</if>
  26. </where>
  27. order by agent_id desc
  28. </select>
  29. <select id="selectBusiAgentsByAgentId" parameterType="Long" resultMap="BusiAgentsResult">
  30. <include refid="selectBusiAgentsVo"/>
  31. where agent_id = #{agentId}
  32. </select>
  33. <select id="selectBusiAgentsByUserId" parameterType="Long" resultMap="BusiAgentsResult">
  34. <include refid="selectBusiAgentsVo"/>
  35. where user_id = #{userId}
  36. </select>
  37. <insert id="insertBusiAgents" parameterType="BusiAgents" useGeneratedKeys="true" keyProperty="agentId">
  38. insert into b_busi_agents
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="agentType != null">agent_type,</if>
  41. <if test="phonenumber != null">phonenumber,</if>
  42. <if test="name != null">name,</if>
  43. <if test="status != null">status,</if>
  44. <if test="createTime != null">create_time,</if>
  45. <if test="userId != null">user_id,</if>
  46. </trim>
  47. <trim prefix="values (" suffix=")" suffixOverrides=",">
  48. <if test="agentType != null">#{agentType},</if>
  49. <if test="phonenumber != null">#{phonenumber},</if>
  50. <if test="name != null">#{name},</if>
  51. <if test="status != null">#{status},</if>
  52. <if test="createTime != null">#{createTime},</if>
  53. <if test="userId != null">#{userId},</if>
  54. </trim>
  55. </insert>
  56. <update id="updateBusiAgents" parameterType="BusiAgents">
  57. update b_busi_agents
  58. <trim prefix="SET" suffixOverrides=",">
  59. <if test="agentType != null">agent_type = #{agentType},</if>
  60. <if test="phonenumber != null">phonenumber = #{phonenumber},</if>
  61. <if test="name != null">name = #{name},</if>
  62. <if test="status != null">status = #{status},</if>
  63. <if test="createTime != null">create_time = #{createTime},</if>
  64. <if test="createTime != null">user_id = #{createTime},</if>
  65. </trim>
  66. where agent_id = #{agentId}
  67. </update>
  68. <delete id="deleteBusiAgentsByAgentId" parameterType="Long">
  69. delete from b_busi_agents where agent_id = #{agentId}
  70. </delete>
  71. <delete id="deleteBusiAgentsByAgentIds" parameterType="String">
  72. delete from b_busi_agents where agent_id in
  73. <foreach item="agentId" collection="array" open="(" separator="," close=")">
  74. #{agentId}
  75. </foreach>
  76. </delete>
  77. </mapper>