| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.yt.zhylplat.moduleLhzx.road.mapper.TLhzxStreetTreeMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
- <id column="id" property="id" />
- <result column="yh_company_id" property="yhCompanyId" />
- <result column="yh_company_name" property="yhCompanyName" />
- <result column="section_id" property="sectionId" />
- <result column="section_name" property="sectionName" />
- <result column="road_id" property="roadId" />
- <result column="road_type" property="roadType" />
- <result column="road_plate" property="roadPlate" />
- <result column="tree_name" property="treeName" />
- <result column="extra_large_num" property="extraLargeNum" />
- <result column="large_num" property="largeNum" />
- <result column="medium_num" property="mediumNum" />
- <result column="small_num" property="smallNum" />
- <result column="help_stump" property="helpStump" />
- <result column="cover_plate" property="coverPlate" />
- <result column="grow_year" property="growYear" />
- <result column="grow_spacing" property="growSpacing" />
- <result column="growing" property="growing" />
- <result column="years" property="years" />
- <result column="remark" property="remark" />
- <result column="create_user_id" property="createUserId" />
- <result column="create_date" property="createDate" />
- <result column="update_user_id" property="updateUserId" />
- <result column="update_date" property="updateDate" />
- <result column="del_flg" property="delFlg" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, yh_company_id, yh_company_name, section_id, section_name, road_id, road_type, road_plate, tree_name, extra_large_num, large_num, medium_num, small_num, help_stump, cover_plate, grow_year, grow_spacing, growing, years, remark, create_user_id, create_date, update_user_id, update_date, del_flg
- </sql>
- <select id="selectStreetTreeListByRoadId"
- resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
- select
- *,
- if(extra_large_num is null, 0, extra_large_num) +
- if(large_num is null, 0, large_num) +
- if(medium_num is null, 0, medium_num) +
- if(small_num is null, 0, small_num) as sumNum
- from
- T_Lhzx_Street_Tree
- where
- del_flg = 0
- and
- road_id = #{roadId}
- </select>
- <select id="pageByBean" resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
- select
- temp.*
- from
- (<include refid="page"/>) temp
- where
- temp.sumNum > 0
- </select>
- <select id="getSumTreeCount" resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
- select
- sum(temp.sumNum) as sumNum
- from
- (<include refid="page"/>) temp
- </select>
- <select id="selectStreetTreePage" resultType="com.yt.zhylplat.moduleLhzx.road.vo.TLhzxStreetTreeVO">
- select
- temp.section_name,
- temp.maintenance_company_name,
- temp.road_code,
- temp.road_name,
- temp.road_start_spot,
- temp.road_end_spot,
- temp.tree_name,
- temp.extra_large_num,
- temp.large_num,
- temp.medium_num,
- temp.small_num,
- temp.cover_plate,
- temp.road_type,
- temp.road_plate,
- temp.help_stump,
- temp.grow_year,
- temp.grow_spacing,
- temp.growing,
- temp.remark
- from
- (<include refid="page"/>) temp
- where
- temp.sumNum > 0
- </select>
- <select id="getByBean" resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxStreetTree">
- select
- st.maintenance_company_id,
- st.section_id,
- st.road_id,
- r.road_code,
- r.road_name,
- r.road_start_spot,
- r.road_end_spot,
- sum(
- if(extra_large_num is null, 0, extra_large_num) +
- if(large_num is null, 0, large_num) +
- if(medium_num is null, 0, medium_num) +
- if(small_num is null, 0, small_num)
- ) as totalCount
- from
- T_Lhzx_Street_Tree st
- left join
- T_Lhzx_Road r on st.road_id = r.id
- where
- st.maintenance_company_id = #{maintenanceCompanyId}
- and
- st.section_id = #{sectionId}
- and
- st.road_id = #{roadId}
- and
- st.del_flg = 0
- group by
- st.maintenance_company_id,
- st.section_id,
- st.road_id,
- r.road_code,
- r.road_name,
- r.road_start_spot,
- r.road_end_spot
- </select>
- <!-- 查询分页sql -->
- <sql id="page">
- select
- st.*,
- r.road_code,
- r.road_name,
- if(st.extra_large_num is null, 0, st.extra_large_num) +
- if(st.large_num is null, 0, st.large_num) +
- if(st.medium_num is null, 0, st.medium_num) +
- if(st.small_num is null, 0, st.small_num) as sumNum
- from
- T_Lhzx_Street_Tree st
- left join
- T_Lhzx_Road r on st.road_id = r.id
- where
- st.del_flg = 0
- <if test="tLhzxStreetTree.sectionId != null">
- and st.section_id = #{tLhzxStreetTree.sectionId}
- </if>
- <if test="tLhzxStreetTree.sectionName != null and tLhzxStreetTree.sectionName != ''">
- and st.section_name like concat('%', #{tLhzxStreetTree.sectionName}, '%')
- </if>
- <if test="tLhzxStreetTree.maintenanceCompanyId != null">
- and st.maintenance_company_id = #{tLhzxStreetTree.maintenanceCompanyId}
- </if>
- <if test="tLhzxStreetTree.maintenanceCompanyName != null and tLhzxStreetTree.maintenanceCompanyName != ''">
- and st.maintenance_company_name like concat('%', #{tLhzxStreetTree.maintenanceCompanyName}, '%')
- </if>
- <if test="tLhzxStreetTree.roadId != null">
- and st.road_id = #{tLhzxStreetTree.roadId}
- </if>
- <if test="tLhzxStreetTree.roadCode != null and tLhzxStreetTree.roadCode != ''">
- and r.road_code like concat('%', #{tLhzxStreetTree.roadCode}, '%')
- </if>
- <if test="tLhzxStreetTree.roadName != null and tLhzxStreetTree.roadName != ''">
- and r.road_name like concat('%', #{tLhzxStreetTree.roadName}, '%')
- </if>
- <if test="tLhzxStreetTree.treeName != null and tLhzxStreetTree.treeName != ''">
- and st.tree_name like concat('%', #{tLhzxStreetTree.treeName}, '%')
- </if>
- order by
- st.section_id, st.maintenance_company_id
- </sql>
- </mapper>
|