| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <?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.inspur.idm.media.dao.ElePartDao">
- <resultMap id="BaseResultMap" type="com.inspur.idm.media.po.part.ElePart">
- <id column="part_id" jdbcType="VARCHAR" property="partId" />
- <result column="brand_id" jdbcType="VARCHAR" property="brandId" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="data_status" jdbcType="INTEGER" property="dataStatus" />
- <result column="description" jdbcType="VARCHAR" property="description" />
- <result column="manufact_company_id" jdbcType="VARCHAR" property="manufactCompanyId" />
- <result column="parent_id" jdbcType="VARCHAR" property="parentId" />
- <result column="part_model" jdbcType="VARCHAR" property="partModel" />
- <result column="part_name" jdbcType="VARCHAR" property="partName" />
- <result column="part_type_id" jdbcType="VARCHAR" property="partTypeId" />
- <result column="validity" jdbcType="INTEGER" property="validity" />
- <result column="create_company" jdbcType="VARCHAR" property="createCompany" />
- </resultMap>
- <sql id="Base_Column_List">
- part_id, brand_id, create_time, data_status, description, manufact_company_id, parent_id,
- part_model, part_name, part_type_id, validity, create_company
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from `ele_part`
- where part_id = #{partId,jdbcType=VARCHAR}
- <if test="limitCompany!= null">
- and ele_part.create_company = #{limitCompany}
- </if>
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from `ele_part`
- where part_id = #{partId,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.inspur.idm.media.po.part.ElePart">
- insert into `ele_part` (part_id, brand_id, create_time,
- data_status, description, manufact_company_id,
- parent_id, part_model, part_name,
- part_type_id, validity)
- values (#{partId,jdbcType=VARCHAR}, #{brandId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
- #{dataStatus,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{manufactCompanyId,jdbcType=VARCHAR},
- #{parentId,jdbcType=VARCHAR}, #{partModel,jdbcType=VARCHAR}, #{partName,jdbcType=VARCHAR},
- #{partTypeId,jdbcType=VARCHAR}, #{validity,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" parameterType="com.inspur.idm.media.po.part.ElePart">
- insert into `ele_part`
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="partId != null">
- part_id,
- </if>
- <if test="brandId != null">
- brand_id,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="dataStatus != null">
- data_status,
- </if>
- <if test="description != null">
- description,
- </if>
- <if test="manufactCompanyId != null">
- manufact_company_id,
- </if>
- <if test="parentId != null">
- parent_id,
- </if>
- <if test="partModel != null">
- part_model,
- </if>
- <if test="partName != null">
- part_name,
- </if>
- <if test="partTypeId != null">
- part_type_id,
- </if>
- <if test="validity != null">
- validity,
- </if>
- <if test="createCompany != null">
- create_company,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="partId != null">
- #{partId,jdbcType=VARCHAR},
- </if>
- <if test="brandId != null">
- #{brandId,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="dataStatus != null">
- #{dataStatus,jdbcType=INTEGER},
- </if>
- <if test="description != null">
- #{description,jdbcType=VARCHAR},
- </if>
- <if test="manufactCompanyId != null">
- #{manufactCompanyId,jdbcType=VARCHAR},
- </if>
- <if test="parentId != null">
- #{parentId,jdbcType=VARCHAR},
- </if>
- <if test="partModel != null">
- #{partModel,jdbcType=VARCHAR},
- </if>
- <if test="partName != null">
- #{partName,jdbcType=VARCHAR},
- </if>
- <if test="partTypeId != null">
- #{partTypeId,jdbcType=VARCHAR},
- </if>
- <if test="validity != null">
- #{validity,jdbcType=INTEGER},
- </if>
- <if test="createCompany != null">
- #{createCompany,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.inspur.idm.media.po.part.ElePart">
- update `ele_part`
- <set>
- <if test="brandId != null">
- brand_id = #{brandId,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="dataStatus != null">
- data_status = #{dataStatus,jdbcType=INTEGER},
- </if>
- <if test="description != null">
- description = #{description,jdbcType=VARCHAR},
- </if>
- <if test="manufactCompanyId != null">
- manufact_company_id = #{manufactCompanyId,jdbcType=VARCHAR},
- </if>
- <if test="parentId != null">
- parent_id = #{parentId,jdbcType=VARCHAR},
- </if>
- <if test="partModel != null">
- part_model = #{partModel,jdbcType=VARCHAR},
- </if>
- <if test="partName != null">
- part_name = #{partName,jdbcType=VARCHAR},
- </if>
- <if test="partTypeId != null">
- part_type_id = #{partTypeId,jdbcType=VARCHAR},
- </if>
- <if test="validity != null">
- validity = #{validity,jdbcType=INTEGER},
- </if>
- <if test="createCompany != null">
- create_company = #{createCompany,jdbcType=VARCHAR},
- </if>
- </set>
- where part_id = #{partId,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.inspur.idm.media.po.part.ElePart">
- update `ele_part`
- set brand_id = #{brandId,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- data_status = #{dataStatus,jdbcType=INTEGER},
- description = #{description,jdbcType=VARCHAR},
- manufact_company_id = #{manufactCompanyId,jdbcType=VARCHAR},
- parent_id = #{parentId,jdbcType=VARCHAR},
- part_model = #{partModel,jdbcType=VARCHAR},
- part_name = #{partName,jdbcType=VARCHAR},
- part_type_id = #{partTypeId,jdbcType=VARCHAR},
- validity = #{validity,jdbcType=INTEGER}
- where part_id = #{partId,jdbcType=VARCHAR}
- </update>
- <select id="selectByQuery" resultType="com.inspur.idm.media.vo.part.ElePartVO">
- select a.*, IFNULL(b.part_type_name, '') as part_type_name
- from `ele_part` a, `ele_part_type` b
- <where>
- a.part_type_id = b.part_type_id
- <if test="partTypeId!= null">
- and a.part_type_id = #{partTypeId,jdbcType=VARCHAR}
- </if>
- <if test="parentId!= null">
- and a.parent_id = #{parentId,jdbcType=VARCHAR}
- </if>
- <if test="brandId!= null">
- and a.brand_id = #{brandId,jdbcType=VARCHAR}
- </if>
- <if test="querySearch!= null and querySearch != ''">
- and a.part_name like concat('%',#{querySearch,jdbcType=VARCHAR},'%')
- </if>
- <if test="partName!= null">
- and a.part_name like concat('%',#{partName,jdbcType=VARCHAR},'%')
- </if>
- <if test="manufactCompanyId!= null">
- and a.manufact_company_id = #{manufactCompanyId,jdbcType=VARCHAR}
- </if>
- <if test="dataStatus!= null">
- and a.data_status = #{dataStatus,jdbcType=INTEGER}
- </if>
- <if test="limitCompany!= null">
- and a.create_company = #{limitCompany}
- </if>
- </where>
- <choose>
- <when test="orderByClause == 'partTypeAsc'.toString()">
- order by b.part_type_name
- </when>
- <when test="orderByClause == 'partTypeDesc'.toString()">
- order by b.part_type_name desc
- </when>
- <when test="orderByClause == 'validityAsc'.toString()">
- order by a.validity
- </when>
- <when test="orderByClause == 'validityDesc'.toString()">
- order by a.validity desc
- </when>
- <otherwise>
- order by a.create_time desc
- </otherwise>
- </choose>
- </select>
- </mapper>
|