BusinessOpportunityMapper.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.dayou.mapper.BusinessOpportunityMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.BusinessOpportunity">
  6. <result column="id" property="id" />
  7. <result column="deleted" property="deleted" />
  8. <result column="created" property="created" />
  9. <result column="modified" property="modified" />
  10. <result column="customer_id" property="customerId" />
  11. <result column="opportunity_name" property="opportunityName" />
  12. <result column="estimate_amount" property="estimateAmount" />
  13. <result column="estimate_date" property="estimateDate" />
  14. <result column="remark" property="remark" />
  15. <result column="state" property="state" />
  16. <result column="off_reason" property="offReason" />
  17. <result column="user_id" property="userId" />
  18. </resultMap>
  19. <!-- 通用查询结果列 -->
  20. <sql id="Base_Column_List">
  21. business_opportunity.id,
  22. business_opportunity.deleted,
  23. business_opportunity.created,
  24. business_opportunity.modified,
  25. business_opportunity.customer_id,
  26. business_opportunity.opportunity_name,
  27. business_opportunity.estimate_amount,
  28. business_opportunity.estimate_date,
  29. business_opportunity.remark,
  30. business_opportunity.state,
  31. business_opportunity.off_reason,
  32. business_opportunity.user_id
  33. </sql>
  34. <select id="getPage" parameterType="com.dayou.vo.BusinessOpportunityVO" resultType="com.dayou.vo.BusinessOpportunityVO">
  35. select <include refid="Base_Column_List"/> ,c.name as customerName,u.name as userName
  36. from business_opportunity left join customer c on business_opportunity.customer_id = c.id left join user u on u.id = business_opportunity.user_id
  37. where c.deleted =0 and business_opportunity.deleted = 0
  38. <if test="keyword!=null and keyword!='' ">
  39. and(
  40. c.name like concat ('%',#{keyword},'%')
  41. or u.name like concat('%',#{keyword},'%')
  42. )
  43. </if>
  44. <if test="dto!=null and dto.customerName!=null and dto.customerName!=''">
  45. and c.name like concat('%',#{dto.customerName},'%')
  46. </if>
  47. <if test="dto!=null and dto.opportunityName!=null and dto.opportunityName!=''">
  48. and business_opportunity.opportunity_name like concat('%',#{dto.opportunityName},'%')
  49. </if>
  50. <if test="dto!=null and dto.state!=null and dto.state!=''">
  51. and business_opportunity.state = #{dto.state}
  52. </if>
  53. <if test="dto!=null and dto.userIds!=null and dto.userIds.size!=0">
  54. and business_opportunity.user_id in
  55. <foreach collection="dto.userIds" open="(" close=")" separator="," item="userId">
  56. #{userId}
  57. </foreach>
  58. </if>
  59. order by business_opportunity.state desc, business_opportunity.estimate_date DESC
  60. </select>
  61. </mapper>