| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.yuanchu.mom.mapper.WarehouseMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.Warehouse"> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="createUser" column="create_user" jdbcType="INTEGER"/> |
| | | <result property="updateUser" column="update_user" jdbcType="INTEGER"/> |
| | | <id property="id" column="id" jdbcType="INTEGER"/> |
| | | <result property="name" column="name" jdbcType="VARCHAR"/> |
| | | <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
| | | <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
| | | <result property="createUser" column="create_user" jdbcType="INTEGER"/> |
| | | <result property="updateUser" column="update_user" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="Warehouse" type="com.yuanchu.mom.dto.WarehouseDto"> |
| | |
| | | <result property="name" column="sName" jdbcType="VARCHAR"/> |
| | | <result property="row" column="row" jdbcType="INTEGER"/> |
| | | <result property="col" column="col" jdbcType="INTEGER"/> |
| | | <collection property="warehouseCellList" resultMap="cell"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="cell" type="com.yuanchu.mom.pojo.WarehouseCell"> |
| | | <id property="id" column="cId" jdbcType="INTEGER"/> |
| | | <result property="row" column="crow" jdbcType="INTEGER"/> |
| | | <result property="col" column="ccol" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectWarehouseList" resultMap="Warehouse"> |
| | | select w.id,w.name,ws.id sId,ws.name sName,ws.row,ws.col,ws.warehouse_id from warehouse w |
| | | left join warehouse_shelf ws on w.id = ws.warehouse_id |
| | | select w.id, |
| | | w.name, |
| | | ws.id sId, |
| | | ws.name sName, |
| | | ws.row, |
| | | ws.col, |
| | | wc.id cId, |
| | | wc.row crow, |
| | | wc.col ccol |
| | | from warehouse w |
| | | left join warehouse_shelf ws on w.id = ws.warehouse_id |
| | | left join warehouse_cell wc on shelf_id = ws.id |
| | | left join |
| | | (select cell_id, count(*) num from warehouse_history group by cell_id) a on cell_id = wc.id |
| | | where num is null |
| | | or num % 2 = 0 |
| | | order by id, sId, crow, ccol |
| | | </select> |
| | | </mapper> |