|
@@ -0,0 +1,33 @@
|
|
|
+<?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.huimv.eartag2.admin.mapper.BasePigpenMapper">
|
|
|
+
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap" type="com.huimv.eartag2.admin.entity.BasePigpen">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="pigpen_code" property="pigpenCode" />
|
|
|
+ <result column="pigpen_name" property="pigpenName" />
|
|
|
+ <result column="parent_id" property="parentId" />
|
|
|
+ <result column="f_type" property="fType" />
|
|
|
+ <result column="farm_code" property="farmCode" />
|
|
|
+ <result column="sort" property="sort" />
|
|
|
+ <result column="stage_code" property="stageCode" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 通用查询结果列 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, pigpen_code, pigpen_name, parent_id, f_type, farm_code, sort, stage_code
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="listBuildings" resultType="com.huimv.eartag2.admin.entity.dto.BuildingDto">
|
|
|
+ SELECT DISTINCT a.pigpen_name 'buildingName',a.id 'buildingId' FROM `base_pigpen` a
|
|
|
+ INNER JOIN `base_pigpen` b ON a.id = b.parent_id
|
|
|
+ WHERE a.farm_code = #{farmId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="listUnitByBuilding" resultType="com.huimv.eartag2.admin.entity.dto.UnitDto">
|
|
|
+ SELECT a.pigpen_name 'unitName',a.id 'unitId' FROM `base_pigpen` a INNER JOIN `base_pigpen` b ON a.parent_id = b.id
|
|
|
+ WHERE b.id = #{buildingId} AND b.farm_code = #{farmId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|