<?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.yuanchu.mom.mapper.ProductMapper">
|
|
<resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.Product">
|
<id property="id" column="id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="father" column="father" jdbcType="VARCHAR"/>
|
<result property="unit" column="unit" jdbcType="VARCHAR"/>
|
<result property="required" column="required" jdbcType="VARCHAR"/>
|
<result property="internal" column="internal" jdbcType="VARCHAR"/>
|
<result property="state" column="state" jdbcType="INTEGER"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
<result property="version" column="version" jdbcType="INTEGER"/>
|
<result property="specificationsId" column="specifications_id" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<resultMap id="selectTreeProduct" type="ProductDto">
|
<id property="father" column="father" jdbcType="VARCHAR"/>
|
<collection property="children" resultMap="productDto2ListMap"/>
|
</resultMap>
|
|
<resultMap id="productDto2ListMap" type="ProductDto2">
|
<id property="id" column="id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="unit" column="unit" jdbcType="VARCHAR"/>
|
<result property="required" column="required" jdbcType="VARCHAR"/>
|
<result property="internal" column="internal" jdbcType="VARCHAR"/>
|
<result property="state" column="state" jdbcType="INTEGER"/>
|
</resultMap>
|
|
<select id="selectTreeProduct" resultMap="selectTreeProduct">
|
SELECT p.id, p.`name`, IFNULL(p.`father`,p.`name`) father, p.`unit`, p.`required`, p.`internal`
|
FROM product p
|
where p.specifications_id = #{specifications}
|
<if test="project != null and project != ''">
|
AND p.father like concat('%',#{project},'%')
|
</if>
|
and p.state = 1
|
</select>
|
</mapper>
|