ShopAdminMapper.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.system1.mapper.ShopAdminMapper">
  6. <resultMap type="ShopAdmin" id="ShopAdminResult">
  7. <result property="shopId" column="shop_id" />
  8. <result property="userId" column="user_id" />
  9. </resultMap>
  10. <sql id="selectShopAdminVo">
  11. select shop_id, user_id from shop_admin
  12. </sql>
  13. <select id="selectShopAdminList" parameterType="ShopAdmin" resultMap="ShopAdminResult">
  14. <include refid="selectShopAdminVo"/>
  15. <where>
  16. </where>
  17. </select>
  18. <select id="selectShopAdminByShopId" parameterType="Long" resultMap="ShopAdminResult">
  19. <include refid="selectShopAdminVo"/>
  20. where shop_id = #{shopId}
  21. </select>
  22. <insert id="insertShopAdmin" parameterType="ShopAdmin">
  23. insert into shop_admin
  24. <trim prefix="(" suffix=")" suffixOverrides=",">
  25. <if test="shopId != null">shop_id,</if>
  26. <if test="userId != null">user_id,</if>
  27. </trim>
  28. <trim prefix="values (" suffix=")" suffixOverrides=",">
  29. <if test="shopId != null">#{shopId},</if>
  30. <if test="userId != null">#{userId},</if>
  31. </trim>
  32. </insert>
  33. <update id="updateShopAdmin" parameterType="ShopAdmin">
  34. update shop_admin
  35. <trim prefix="SET" suffixOverrides=",">
  36. <if test="userId != null">user_id = #{userId},</if>
  37. </trim>
  38. where shop_id = #{shopId}
  39. </update>
  40. <delete id="deleteShopAdminByShopId" parameterType="Long">
  41. delete from shop_admin where shop_id = #{shopId}
  42. </delete>
  43. <delete id="deleteShopAdminByShopIds" parameterType="String">
  44. delete from shop_admin where shop_id in
  45. <foreach item="shopId" collection="array" open="(" separator="," close=")">
  46. #{shopId}
  47. </foreach>
  48. </delete>
  49. </mapper>