<?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.huaheng.pc.warehouseCompany.company.mapper.WarehouseCompanyMapperAuto"> <select id="selectListEntityByLike" resultType="com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany"> SELECT id, warehouseId, warehouseCode, companyId, companyCode FROM warehouse_company <where> <if test="id != null "> AND id = #{id} </if> <if test="warehouseId != null "> AND warehouseId = #{warehouseId} </if> <if test="warehouseCode != null and warehouseCode != '' "> AND warehouseCode = #{warehouseCode} </if> <if test="companyIdList != null and companyIdList.size() > 0 "> AND companyId in <foreach collection="companyIdList" item="companyIdItem" open="(" separator="," close=")"> #{companyIdItem} </foreach> </if> <if test="companyId != null "> AND companyId = #{companyId} </if> <if test="companyCodeList != null and companyCodeList.size() > 0 "> AND companyCode in <foreach collection="companyCodeList" item="companyCodeItem" open="(" separator="," close=")"> #{companyCodeItem} </foreach> </if> <if test="companyCode != null and companyCode != '' "> AND companyCode = #{companyCode} </if> </where> </select> <select id="selectListEntityByEqual" resultType="com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany"> SELECT id, warehouseId, warehouseCode, companyId, companyCode FROM warehouse_company <where> <if test="id != null"> AND id = #{id} </if> <if test="warehouseId != null"> AND warehouseId = #{warehouseId} </if> <if test="warehouseCode != null"> AND warehouseCode = #{warehouseCode} </if> <if test="companyIdList != null and companyIdList.size() > 0 "> AND companyId in <foreach collection="companyIdList" item="companyIdItem" open="(" separator="," close=")"> #{companyIdItem} </foreach> </if> <if test="companyId != null"> AND companyId = #{companyId} </if> <if test="companyCodeList != null and companyCodeList.size() > 0 "> AND companyCode in <foreach collection="companyCodeList" item="companyCodeItem" open="(" separator="," close=")"> #{companyCodeItem} </foreach> </if> <if test="companyCode != null"> AND companyCode = #{companyCode} </if> </where> </select> <select id="selectListMapByEqual" resultType="java.util.HashMap"> SELECT ${columns} FROM warehouse_company <where> <if test="condition.id != null"> AND id = #{condition.id} </if> <if test="condition.warehouseId != null"> AND warehouseId = #{condition.warehouseId} </if> <if test="condition.warehouseCode != null"> AND warehouseCode = #{condition.warehouseCode} </if> <if test="condition.companyIdList != null and condition.companyIdList.size() > 0 "> AND companyId in <foreach collection="condition.companyIdList" item="companyIdItem" open="(" separator="," close=")"> #{companyIdItem} </foreach> </if> <if test="condition.companyId != null"> AND companyId = #{condition.companyId} </if> <if test="condition.companyCodeList != null and condition.companyCodeList.size() > 0 "> AND companyCode in <foreach collection="condition.companyCodeList" item="companyCodeItem" open="(" separator="," close=")"> #{companyCodeItem} </foreach> </if> <if test="condition.companyCode != null"> AND companyCode = #{condition.companyCode} </if> </where> </select> <select id="selectEntityById" resultType="com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany"> SELECT id, warehouseId, warehouseCode, companyId, companyCode FROM warehouse_company WHERE id = #{id} </select> <select id="selectFirstEntity" resultType="com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany"> SELECT id, warehouseId, warehouseCode, companyId, companyCode FROM warehouse_company <where> <if test="id != null"> AND id = #{id} </if> <if test="warehouseId != null"> AND warehouseId = #{warehouseId} </if> <if test="warehouseCode != null"> AND warehouseCode = #{warehouseCode} </if> <if test="companyIdList != null and companyIdList.size() > 0 "> AND companyId in <foreach collection="companyIdList" item="companyIdItem" open="(" separator="," close=")"> #{companyIdItem} </foreach> </if> <if test="companyId != null"> AND companyId = #{companyId} </if> <if test="companyCodeList != null and companyCodeList.size() > 0 "> AND companyCode in <foreach collection="companyCodeList" item="companyCodeItem" open="(" separator="," close=")"> #{companyCodeItem} </foreach> </if> <if test="companyCode != null"> AND companyCode = #{companyCode} </if> </where> LIMIT 1 </select> <select id="selectFirstMap" resultType="java.util.HashMap"> SELECT ${columns} FROM warehouse_company <where> <if test="condition.id != null"> AND id = #{condition.id} </if> <if test="condition.warehouseId != null"> AND warehouseId = #{condition.warehouseId} </if> <if test="condition.warehouseCode != null"> AND warehouseCode = #{condition.warehouseCode} </if> <if test="condition.companyIdList != null and condition.companyIdList.size() > 0 "> AND companyId in <foreach collection="condition.companyIdList" item="companyIdItem" open="(" separator="," close=")"> #{companyIdItem} </foreach> </if> <if test="condition.companyId != null"> AND companyId = #{condition.companyId} </if> <if test="condition.companyCodeList != null and condition.companyCodeList.size() > 0 "> AND companyCode in <foreach collection="condition.companyCodeList" item="companyCodeItem" open="(" separator="," close=")"> #{companyCodeItem} </foreach> </if> <if test="condition.companyCode != null"> AND companyCode = #{condition.companyCode} </if> </where> LIMIT 1 </select> <insert id="insert" parameterType="com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany" keyProperty="id" useGeneratedKeys="true" > INSERT INTO warehouse_company <trim prefix="(" suffix=")" suffixOverrides=","> <if test="warehouseId != null"> warehouseId, </if> <if test="warehouseCode != null"> warehouseCode, </if> <if test="companyId != null"> companyId, </if> <if test="companyCode != null"> companyCode, </if> </trim> <trim prefix=" values (" suffix=")" suffixOverrides=","> <if test="warehouseId != null"> #{warehouseId, jdbcType=INTEGER}, </if> <if test="warehouseCode != null"> #{warehouseCode, jdbcType=VARCHAR}, </if> <if test="companyId != null"> #{companyId, jdbcType=INTEGER}, </if> <if test="companyCode != null"> #{companyCode, jdbcType=VARCHAR}, </if> </trim> </insert> <update id="updateByModel"> UPDATE warehouse_company <set> <if test="warehouseId != null"> warehouseId = #{warehouseId, jdbcType=INTEGER}, </if> <if test="warehouseCode != null"> warehouseCode = #{warehouseCode, jdbcType=VARCHAR}, </if> <if test="companyId != null"> companyId = #{companyId, jdbcType=INTEGER}, </if> <if test="companyCode != null"> companyCode = #{companyCode, jdbcType=VARCHAR}, </if> </set> WHERE id = #{id,jdbcType=INTEGER} </update> <update id="updateByCondition"> UPDATE warehouse_company <set> <if test="record.warehouseId != null"> warehouseId = #{record.warehouseId, jdbcType=INTEGER}, </if> <if test="record.warehouseCode != null"> warehouseCode = #{record.warehouseCode, jdbcType=VARCHAR}, </if> <if test="record.companyId != null"> companyId = #{record.companyId, jdbcType=INTEGER}, </if> <if test="record.companyCode != null"> companyCode = #{record.companyCode, jdbcType=VARCHAR}, </if> </set> <where> <if test="condition.id != null"> AND id = #{condition.id} </if> <if test="condition.warehouseId != null"> AND warehouseId = #{condition.warehouseId} </if> <if test="condition.warehouseCode != null"> AND warehouseCode = #{condition.warehouseCode} </if> <if test="condition.companyId != null"> AND companyId = #{condition.companyId} </if> <if test="condition.companyCode != null"> AND companyCode = #{condition.companyCode} </if> </where> </update> <delete id="deleteById"> DELETE FROM warehouse_company WHERE id = #{id, jdbcType=INTEGER} </delete> <delete id="deleteByCondition"> DELETE FROM warehouse_company <where> <if test="id != null"> AND id = #{id} </if> <if test="warehouseId != null"> AND warehouseId = #{warehouseId} </if> <if test="warehouseCode != null"> AND warehouseCode = #{warehouseCode} </if> <if test="companyId != null"> AND companyId = #{companyId} </if> <if test="companyCode != null"> AND companyCode = #{companyCode} </if> </where> </delete> </mapper>