BCustomerMarjorsMapper.xml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.syzy.mapper.BCustomerMarjorsMapper">
  6. <resultMap type="BCustomerMarjors" id="BCustomerMarjorsResult">
  7. <result property="id" column="id" />
  8. <result property="customerCode" column="customerCode" />
  9. <result property="marjorId" column="marjorId" />
  10. <result property="createTime" column="createTime" />
  11. <result property="status" column="status" />
  12. </resultMap>
  13. <sql id="selectBCustomerMarjorsVo">
  14. select id, customerCode, marjorId, createTime, status from b_customer_marjors
  15. </sql>
  16. <select id="selectBCustomerMarjorsList" parameterType="BCustomerMarjors" resultMap="BCustomerMarjorsResult">
  17. <include refid="selectBCustomerMarjorsVo" />
  18. <where>
  19. <if test="customerCode != null and customerCode != ''"> and customerCode = #{customerCode}</if>
  20. <if test="marjorId != null and marjorId != ''"> and marjorId = #{marjorId}</if>
  21. <if test="createTime != null "> and createTime = #{createTime}</if>
  22. <if test="status != null "> and status = #{status}</if>
  23. <if test="status == null "> and status >0 </if>
  24. </where>
  25. </select>
  26. <select id="selectBCustomerMarjorsById" parameterType="Long" resultMap="BCustomerMarjorsResult">
  27. <include refid="selectBCustomerMarjorsVo" />
  28. where id = #{id}
  29. </select>
  30. <select id="listMyByPage" parameterType="String" resultType="com.alibaba.fastjson.JSONObject">
  31. select b.code, b.parent_code, b.name, b.type, b.level, b.ancestors, b.child_count, b.grandchild_count, b.learn_year_arab,
  32. a.id,a.customerCode,a.marjorId,a.status,a.createTime
  33. from b_customer_marjors a, sy_major b
  34. where a.status > 0 and a.marjorId=b.id
  35. <if test="customerCode != null and customerCode!=''"> and a.customerCode = #{customerCode} </if>
  36. order by a.id desc
  37. </select>
  38. <insert id="insertBCustomerMarjors" parameterType="BCustomerMarjors" useGeneratedKeys="true" keyProperty="id">
  39. insert into b_customer_marjors
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="customerCode != null">customerCode,</if>
  42. <if test="marjorId != null">marjorId,</if>
  43. <if test="createTime != null">createTime,</if>
  44. <if test="status != null">status,</if>
  45. </trim>
  46. <trim prefix="values (" suffix=")" suffixOverrides=",">
  47. <if test="customerCode != null">#{customerCode},</if>
  48. <if test="marjorId != null">#{marjorId},</if>
  49. <if test="createTime != null">#{createTime},</if>
  50. <if test="status != null">#{status},</if>
  51. </trim>
  52. </insert>
  53. <update id="updateBCustomerMarjors" parameterType="BCustomerMarjors">
  54. update b_customer_marjors
  55. <trim prefix="SET" suffixOverrides=",">
  56. <if test="customerCode != null">customerCode = #{customerCode},</if>
  57. <if test="marjorId != null">marjorId = #{marjorId},</if>
  58. <if test="createTime != null">createTime = #{createTime},</if>
  59. <if test="status != null">status = #{status},</if>
  60. </trim>
  61. where id = #{id}
  62. </update>
  63. <delete id="deleteBCustomerMarjorsById" parameterType="Long">
  64. delete from b_customer_marjors where id = #{id}
  65. </delete>
  66. <delete id="deleteBCustomerMarjorsByIds" parameterType="String">
  67. delete from b_customer_marjors where id in
  68. <foreach item="id" collection="array" open="(" separator="," close=")">
  69. #{id}
  70. </foreach>
  71. </delete>
  72. </mapper>