TCustomerMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.system.mapper.crm.TCustomerMapper">
  6. <resultMap type="TCustomer" id="TCustomerResult">
  7. <result property="id" column="id" />
  8. <result property="companyName" column="company_name" />
  9. <result property="companyWhere" column="company_where" />
  10. <result property="companyEnterprisepro" column="company_enterprisepro" />
  11. <result property="companyState" column="company_state" />
  12. <result property="companyCapital" column="company_capital" />
  13. <result property="companySales" column="company_sales" />
  14. <result property="userName" column="user_name" />
  15. <result property="userPhone" column="user_phone" />
  16. <result property="userDepartment" column="user_department" />
  17. <result property="createBy" column="create_by" />
  18. <result property="createTime" column="create_time" />
  19. </resultMap>
  20. <sql id="selectTCustomerVo">
  21. select id, company_name, company_where, company_enterprisepro, company_state, company_capital, company_sales, user_name, user_phone, user_department, create_by, create_time from t_customer
  22. </sql>
  23. <select id="selectTCustomerList" parameterType="TCustomer" resultMap="TCustomerResult">
  24. <include refid="selectTCustomerVo"/>
  25. <where>
  26. <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
  27. <if test="companyWhere != null and companyWhere != ''"> and company_where = #{companyWhere}</if>
  28. <if test="companyEnterprisepro != null and companyEnterprisepro != ''"> and company_enterprisepro = #{companyEnterprisepro}</if>
  29. <if test="companyState != null and companyState != ''"> and company_state = #{companyState}</if>
  30. <if test="companyCapital != null and companyCapital != ''"> and company_capital = #{companyCapital}</if>
  31. <if test="companySales != null and companySales != ''"> and company_sales = #{companySales}</if>
  32. <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
  33. <if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
  34. <if test="userDepartment != null and userDepartment != ''"> and user_department = #{userDepartment}</if>
  35. <if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
  36. </where>
  37. </select>
  38. <select id="selectTCustomerById" parameterType="String" resultMap="TCustomerResult">
  39. <include refid="selectTCustomerVo"/>
  40. where id = #{id}
  41. </select>
  42. <insert id="insertTCustomer" parameterType="TCustomer" useGeneratedKeys="true" keyProperty="id">
  43. insert into t_customer
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="companyName != null">company_name,</if>
  46. <if test="companyWhere != null">company_where,</if>
  47. <if test="companyEnterprisepro != null">company_enterprisepro,</if>
  48. <if test="companyState != null">company_state,</if>
  49. <if test="companyCapital != null">company_capital,</if>
  50. <if test="companySales != null">company_sales,</if>
  51. <if test="userName != null">user_name,</if>
  52. <if test="userPhone != null">user_phone,</if>
  53. <if test="userDepartment != null">user_department,</if>
  54. <if test="createBy != null">create_by,</if>
  55. create_time,
  56. </trim>
  57. <trim prefix="values (" suffix=")" suffixOverrides=",">
  58. <if test="companyName != null">#{companyName},</if>
  59. <if test="companyWhere != null">#{companyWhere},</if>
  60. <if test="companyEnterprisepro != null">#{companyEnterprisepro},</if>
  61. <if test="companyState != null">#{companyState},</if>
  62. <if test="companyCapital != null">#{companyCapital},</if>
  63. <if test="companySales != null">#{companySales},</if>
  64. <if test="userName != null">#{userName},</if>
  65. <if test="userPhone != null">#{userPhone},</if>
  66. <if test="userDepartment != null">#{userDepartment},</if>
  67. <if test="createBy != null">#{createBy},</if>
  68. sysdate(),
  69. </trim>
  70. </insert>
  71. <update id="updateTCustomer" parameterType="TCustomer">
  72. update t_customer
  73. <trim prefix="SET" suffixOverrides=",">
  74. <if test="companyName != null">company_name = #{companyName},</if>
  75. <if test="companyWhere != null">company_where = #{companyWhere},</if>
  76. <if test="companyEnterprisepro != null">company_enterprisepro = #{companyEnterprisepro},</if>
  77. <if test="companyState != null">company_state = #{companyState},</if>
  78. <if test="companyCapital != null">company_capital = #{companyCapital},</if>
  79. <if test="companySales != null">company_sales = #{companySales},</if>
  80. <if test="userName != null">user_name = #{userName},</if>
  81. <if test="userPhone != null">user_phone = #{userPhone},</if>
  82. <if test="userDepartment != null">user_department = #{userDepartment},</if>
  83. <if test="createBy != null">create_by = #{createBy},</if>
  84. </trim>
  85. where id = #{id}
  86. </update>
  87. <delete id="deleteTCustomerById" parameterType="String">
  88. delete from t_customer where id = #{id}
  89. </delete>
  90. <delete id="deleteTCustomerByIds" parameterType="String">
  91. delete from t_customer where id in
  92. <foreach item="id" collection="array" open="(" separator="," close=")">
  93. #{id}
  94. </foreach>
  95. </delete>
  96. </mapper>