| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?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.hssx.pcbms.mapper.GoodsMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.Goods">
- <id column="id" property="id" />
- <result column="name" property="name" />
- <result column="tag_id" property="tagId" />
- <result column="model_number" property="modelNumber" />
- <result column="unit" property="unit" />
- <result column="address" property="address" />
- <result column="factory" property="factory" />
- <result column="pic" property="pic" />
- <result column="service_life" property="serviceLife" />
- <result column="next_indate" property="nextIndate" />
- <result column="is_delete" property="isDelete" />
- <result column="creator_id" property="creatorId" />
- <result column="division_code" property="divisionCode" />
- <result column="suffix_code" property="suffixCode" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, name, tag_id, model_number, unit, address, factory, pic, service_life, next_indate, is_delete, creator_id, division_code, suffix_code
- </sql>
- <resultMap id="BaseResultMapVO" type="com.hssx.pcbms.entity.vo.GoodsVO">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="tag_id" property="tagId"/>
- <result column="model_number" property="modelNumber"/>
- <result column="unit" property="unit"/>
- <result column="address" property="address"/>
- <result column="factory" property="factory"/>
- <result column="pic" property="pic"/>
- <result column="service_life" property="serviceLife"/>
- <result column="next_indate" property="nextIndate"/>
- <collection property="goodsNos" select="selectGoodsNoByGoodsId" javaType="java.util.List" column="{goodId = id}"
- ofType="com.hssx.pcbms.entity.GoodsNo">
- </collection>
- </resultMap>
- <!-- 我的资产查询映射结果 -->
- <resultMap id="BaseResultMapMyList" type="com.hssx.pcbms.entity.vo.GoodsVO">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="tag_id" property="tagId"/>
- <result column="model_number" property="modelNumber"/>
- <result column="unit" property="unit"/>
- <result column="address" property="address"/>
- <result column="factory" property="factory"/>
- <result column="pic" property="pic"/>
- <result column="service_life" property="serviceLife"/>
- <result column="next_indate" property="nextIndate"/>
- <result column="divisioncode" property="divisionCode"/>
- <result column="suffixcode" property="suffixCode"/>
- <collection property="goodsNos" ofType="com.hssx.pcbms.entity.GoodsNo">
- <id column="nid" property="id"/>
- <result column="model_no" property="modelNo"/>
- <result column="division_code" property="divisionCode"/>
- <result column="suffix_code" property="suffixCode"/>
- <result column="state" property="state"/>
- <result column="indate" property="indate"/>
- <result column="goods_id" property="goodsId"/>
- <result column="user_id" property="userId"/>
- <result column="is_maintain" property="isMaintain" />
- </collection>
- </resultMap>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMapDetail" type="com.hssx.pcbms.entity.vo.GoodsVO">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="tag_id" property="tagId"/>
- <result column="model_number" property="modelNumber"/>
- <result column="unit" property="unit"/>
- <result column="address" property="address"/>
- <result column="factory" property="factory"/>
- <result column="pic" property="pic"/>
- <result column="service_life" property="serviceLife"/>
- <result column="next_indate" property="nextIndate"/>
- <result column="divisioncode" property="divisionCode"/>
- <result column="suffixcode" property="suffixCode"/>
- <collection property="goodsNosVO" ofType="com.hssx.pcbms.entity.vo.GoodsNoVO">
- <id column="nid" property="id"/>
- <result column="model_no" property="modelNo"/>
- <result column="division_code" property="divisionCode"/>
- <result column="suffix_code" property="suffixCode"/>
- <result column="state" property="state"/>
- <result column="indate" property="indate"/>
- <result column="goods_id" property="goodsId"/>
- <result column="user_id" property="userId"/>
- <result column="username" property="username"/>
- <result column="is_maintain" property="isMaintain" />
- <result column="phone" property="phone" />
- </collection>
- </resultMap>
- <select id="getListBycondition" resultMap="BaseResultMapVO">
- select
- id, name, tag_id, model_number, unit, address, factory, pic, service_life, next_indate
- from
- goods
- <where>
- is_delete = 0
- <if test="keyName != null and keyName != ''">
- and name like concat('%',#{keyName},'%')
- </if>
- <if test="tagId != null">
- and tag_id = #{tagId}
- </if>
- </where>
- </select>
- <select id="selectGoodsNoByGoodsId" resultType="com.hssx.pcbms.entity.GoodsNo">
- select
- id, model_no, state, indate, goods_id,is_maintain
- from
- goods_no
- where
- goods_id = #{goodId}
- </select>
- <select id="getDetail" resultMap="BaseResultMapDetail">
- select
- g.id, g.name, g.tag_id, g.model_number, g.unit,g.address, g.factory, g.pic, g.service_life, g.next_indate,g.division_code divisioncode,g.suffix_code suffixcode,
- g.is_delete,gn.id nid,
- gn.model_no, gn.division_code, gn.suffix_code, gn.state, gn.indate, gn.goods_id, gn.user_id,u.name username,gn.is_maintain,u.phone
- from
- goods g
- left join
- goods_no gn
- on g.id = gn.goods_id
- left join user u
- on u.id = gn.user_id
- <where>
- g.id = #{id}
- </where>
- </select>
- <select id="selectMyList" resultMap="BaseResultMapMyList">
- select
- g.id, g.name, g.tag_id, g.model_number, g.unit,g.address, g.factory, g.pic, g.service_life, g.next_indate,g.division_code divisioncode,g.suffix_code suffixcode,
- g.is_delete,gn.id nid,
- gn.model_no, gn.division_code, gn.suffix_code, gn.state, gn.indate, gn.goods_id, gn.user_id,u.name username,gn.is_maintain,u.phone
- from
- goods g
- left join
- goods_no gn
- on g.id = gn.goods_id
- left join user u
- on u.id = gn.user_id
- <where>
- AND gn.user_id = #{uid,jdbcType=INTEGER}
- </where>
- <if test="start != null and pageSize != null">
- limit #{start,jdbcType=INTEGER} ,#{pageSize,jdbcType=INTEGER}
- </if>
- </select>
- </mapper>
|