You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
5.1 KiB
125 lines
5.1 KiB
package com.mh.user.mapper; |
|
|
|
import com.mh.user.entity.BuildingEntity; |
|
import com.mh.user.mapper.provider.BuildingProvider; |
|
import com.mh.user.model.BuildingModel; |
|
import org.apache.ibatis.annotations.*; |
|
|
|
import java.util.List; |
|
|
|
@Mapper |
|
public interface BuildingMapper { |
|
|
|
/** |
|
* 楼栋管理模块 |
|
* 保存楼栋信息 |
|
* @param buildingEntity |
|
*/ |
|
@Insert("insert into building(building_name,levels_count,begin_level,house_count,bed_count,check_in_count,area_id,remarks,tankHeight,pump_count,low_tank_height) values (" + |
|
"#{buildingName},#{levelsCount},#{beginLevel},#{houseCount},#{bedCount},#{checkInCount},#{areaId},#{remarks},#{tankHeight}, #{pumpCount}, #{lowTabkHeight})") |
|
int saveBuilding(BuildingEntity buildingEntity); |
|
|
|
/** |
|
* 楼栋管理模块 |
|
* 保存楼栋信息 |
|
* @param buildingEntity |
|
*/ |
|
@Update("<script>" + |
|
" update building set " + |
|
" <if test='buildingName!=null'> building_name = #{buildingName} </if>" + |
|
" <if test='levelsCount!=null'> , levels_count = #{levelsCount} </if>" + |
|
" <if test='beginLevel!=null'> , begin_level = #{beginLevel} </if>" + |
|
" <if test='houseCount!=null'> , house_count = #{houseCount} </if>" + |
|
" <if test='bedCount!=null'> , bed_count = #{bedCount} </if>" + |
|
" <if test='checkInCount!=null'> , check_in_count = #{checkInCount} </if>" + |
|
" <if test='areaId!=null'> , area_id = #{areaId} </if>" + |
|
" <if test='remarks!=null'> , remarks = #{remarks} </if>" + |
|
" <if test='tankHeight!=null'> , tankHeight = #{tankHeight} </if>" + |
|
" <if test='lowTankHeight!=null'> , low_tank_height = #{lowTankHeight} </if>" + |
|
" <if test='pumpCount!=null'> , pump_count = #{pumpCount} </if>" + |
|
" where id = #{id} " + |
|
"</script>") |
|
int updateBuilding(BuildingEntity buildingEntity); |
|
|
|
/** |
|
* 楼栋管理模块: |
|
* 查询楼栋资料 |
|
* @param page |
|
* @param limit |
|
* @return |
|
*/ |
|
@Results(value = { |
|
@Result(property="buildingId",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property="levelsCount",column="levels_count"), |
|
@Result(property="beginLevel",column="begin_level"), |
|
@Result(property ="houseCount",column ="house_count"), |
|
@Result(property ="bedCount",column ="bed_count"), |
|
@Result(property="checkInCount",column="check_in_count"), |
|
@Result(property="areaId",column="area_id"), |
|
@Result(property="pumpCount",column="pump_count"), |
|
@Result(property="remarks",column="remarks"), |
|
@Result(property="tankHeight",column="tankHeight"), |
|
@Result(property="lowTankHeight",column="low_tank_height") |
|
}) |
|
|
|
@SelectProvider(type = BuildingProvider.class,method = "queryBuilding") |
|
List<BuildingEntity> queryBuilding(@Param("buildingId") String buildingId,@Param("page") int page, @Param("limit") int limit); |
|
|
|
/** |
|
* 楼栋管理模块: |
|
* 获取楼栋信息查询的总条数 |
|
* @return |
|
*/ |
|
@SelectProvider(type = BuildingProvider.class,method = "getCount") |
|
int getCount(@Param("buildingId") String buildingId,@Param("page") int page, @Param("limit") int limit); |
|
|
|
//查询所有楼栋编号和名称 |
|
@Results(value = { |
|
@Result(property="buildingId",column="id"), |
|
@Result(property="buildingName",column="building_name") |
|
}) |
|
@Select("select * from building order by sort ") |
|
List<BuildingModel> selectBuildingName(); |
|
|
|
//查询楼栋编号 |
|
// @Results(value = { |
|
// @Result(property="buildingId",column="building_id") |
|
// }) |
|
@Select("select id from building where building_name=#{buildingName}") |
|
String selectBuildingId(@Param("buildingName") String buildingName); |
|
|
|
//根据楼栋名称查询是否存在 |
|
@Select("select count(*) from building where building_name=#{buildingName}") |
|
int selectCount(@Param("buildingName") String buildingName); |
|
|
|
/** |
|
* 楼栋管理模块: |
|
* 根据名称删除楼栋信息 |
|
* @param id |
|
*/ |
|
@Delete("delete from building where id=#{id}") |
|
int deleteBuilding(@Param("id") String id); |
|
|
|
//通过编号查询名称 |
|
@Select("select building_name from building where id=#{id}") |
|
String queryBuildingName(@Param("id") String id); |
|
|
|
//查询水箱高度 |
|
@Select("select tankHeight from building where id=#{id}") |
|
Double queryTankHeight(@Param("id") String id); |
|
|
|
//查询对应区域编号 |
|
@Select("select area_id from building where id=#{id}") |
|
String queryAreaId(@Param("id") int id); |
|
|
|
//查询楼栋热泵数目 |
|
@Select("select ISNULL(pump_count,0) from building where id=#{buildingId}") |
|
int selectPumpCount(@Param("buildingId") String buildingId); |
|
|
|
@Select("select building_name from building where id = #{buildingId} ") |
|
String selectBuildingNameById(@Param("buildingId") String buildingId); |
|
|
|
@Select("select low_tank_height from building where id=#{id}" ) |
|
Double queryLowTankHeight(@Param("id") String buildingId); |
|
}
|
|
|