WaterDao.xml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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="platform.modules.build.dao.WaterDao">
  4. <select id="findByWaterName" resultType="platform.modules.build.entity.Water">
  5. select * from y_water where name=#{name}
  6. <if test="id!=null and id!=''">
  7. and id!=#{id}
  8. </if>
  9. </select>
  10. <select id="findList" resultType="platform.modules.build.entity.Water">
  11. select id,name from y_water
  12. order by create_time desc
  13. </select>
  14. <select id="findByCondition" resultType="platform.modules.build.entity.Water">
  15. select
  16. distinct w.*
  17. from y_water w
  18. LEFT JOIN y_contract_water cw on w.id = cw.water_id
  19. where w.del_flag = 0 and cw.del_flag = 0
  20. <if test="condition.keyword!=null and condition.keyword!=''">
  21. and
  22. (
  23. (w.name like CONCAT ('%',#{condition.keyword},'%'))
  24. or
  25. (cw.company_id in (Select c.id from y_company c where c.del_flag = 0 and c.company_name like CONCAT ('%',#{condition.keyword},'%')))
  26. )
  27. </if>
  28. <if test="condition.build_id != null and condition.build_id !='' ">
  29. and w.build_id = #{condition.build_id}
  30. </if>
  31. order by create_time desc
  32. </select>
  33. </mapper>