CompanyMapper.xml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.web.work.mapper.CompanyMapper">
  6. <select id="selectList" resultType="com.ruoyi.web.work.domain.Company">
  7. SELECT
  8. c.id,
  9. c.company_name,
  10. c.bank_name,
  11. c.bank_account,
  12. c.address,
  13. c.director,
  14. c.money,
  15. c.phone,
  16. c.create_time,
  17. c.state,
  18. c.email,
  19. ( SELECT COUNT( r.id ) FROM tb_relate r WHERE r.company_id = c.id ) AS peoples
  20. FROM
  21. tb_company c
  22. <where>
  23. <if test="companyName != null and companyName != ''"> and c.company_name like concat('%', #{companyName}, '%')</if>
  24. <if test="director != null and director != ''"> and c.director like concat('%', #{director}, '%')</if>
  25. <if test="phone != null and phone != ''"> and c.phone = #{phone}</if>
  26. <if test="state != null "> and c.state = #{state}</if>
  27. <if test="dateBegin != null and dateBegin != ''"> AND c.create_time BETWEEN #{dateBegin} AND #{dateEnd} + INTERVAL 1 DAY</if>
  28. </where>
  29. </select>
  30. <select id="selectCompanyList" resultType="com.ruoyi.web.work.domain.vo.CompanyListVo">
  31. SELECT * FROM tb_company
  32. WHERE state=0
  33. <if test="companyName != null and companyName != ''">AND company_name like concat('%', #{companyName}, '%')</if>
  34. ORDER BY id DESC
  35. </select>
  36. </mapper>