ElectricDao.xml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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.ElectricDao">
  4. <select id="findByElectricName" resultType="platform.modules.build.entity.Electric">
  5. select * from y_electric 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.Electric">
  11. select id,name ,is_peak from y_electric
  12. order by create_time desc
  13. </select>
  14. <select id="findByCondition" resultType="platform.modules.build.entity.Electric">
  15. select
  16. distinct e.*
  17. from y_electric e
  18. LEFT JOIN y_contract_electric ce on e.id = ce.electric_id
  19. where e.del_flag = 0
  20. <if test="condition.keyword!=null and condition.keyword!=''">
  21. and
  22. (
  23. (e.name like CONCAT ('%',#{condition.keyword},'%'))
  24. or
  25. (
  26. ce.company_id in (Select c.id from y_company c where c.del_flag = 0 and c.company_name like CONCAT ('%',#{condition.keyword},'%'))
  27. )
  28. )
  29. </if>
  30. <if test="condition.build_id != null and condition.build_id !='' ">
  31. and e.build_id = #{condition.build_id}
  32. </if>
  33. order by create_time desc
  34. </select>
  35. </mapper>