net.mingsoft.freight.dao.ICompanyDao.xml Maven / Gradle / Ivy
<?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="net.mingsoft.freight.dao.ICompanyDao"> <resultMap id="resultMap" type="net.mingsoft.freight.entity.CompanyEntity"> <id column="id" property="id" /><!--编号 --> <result column="company_name" property="companyName" /><!--快递公司名称 --> <result column="company_pic" property="companyPic" /><!--快递公司logo --> <result column="company_desc" property="companyDesc" /><!--公司简介 --> <result column="company_code" property="companyCode" /><!--快递公司编码 --> <result column="create_by" property="createBy" /><!--创建人 --> <result column="create_date" property="createDate" /><!--创建时间 --> <result column="update_by" property="updateBy" /><!--修改人 --> <result column="update_date" property="updateDate" /><!--修改时间 --> <result column="del" property="del" /><!--删除标记 --> </resultMap> <!--保存--> <insert id="saveEntity" useGeneratedKeys="true" keyProperty="id" parameterType="net.mingsoft.freight.entity.CompanyEntity" > insert into freight_company <trim prefix="(" suffix=")" suffixOverrides=","> <if test="companyName != null and companyName != ''">company_name,</if> <if test="companyPic != null and companyPic != ''">company_pic,</if> <if test="companyDesc != null and companyDesc != ''">company_desc,</if> <if test="companyCode != null and companyCode != ''">company_code,</if> <if test="createBy != null">create_by,</if> <if test="createDate != null">create_date,</if> <if test="updateBy != null">update_by,</if> <if test="updateDate != null">update_date,</if> <if test="del != null">del,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="companyName != null and companyName != ''">#{companyName},</if> <if test="companyPic != null and companyPic != ''">#{companyPic},</if> <if test="companyDesc != null and companyDesc != ''">#{companyDesc},</if> <if test="companyCode != null and companyCode != ''">#{companyCode},</if> <if test="createBy != null">#{createBy},</if> <if test="createDate != null">#{createDate},</if> <if test="updateBy != null">#{updateBy},</if> <if test="updateDate != null">#{updateDate},</if> <if test="del != null">#{del},</if> </trim> </insert> <!--更新--> <update id="updateEntity" parameterType="net.mingsoft.freight.entity.CompanyEntity"> update freight_company <set> <if test="companyName != null and companyName != ''">company_name=#{companyName},</if> <if test="companyPic != null and companyPic != ''">company_pic=#{companyPic},</if> <if test="companyDesc != null and companyDesc != ''">company_desc=#{companyDesc},</if> <if test="companyCode != null and companyCode != ''">company_code=#{companyCode},</if> <if test="createBy != null">create_by=#{createBy},</if> <if test="createDate != null">create_date=#{createDate},</if> <if test="updateBy != null">update_by=#{updateBy},</if> <if test="updateDate != null">update_date=#{updateDate},</if> <if test="del != null">del=#{del},</if> </set> where id = #{id} </update> <!--根据id获取--> <select id="getEntity" resultMap="resultMap" parameterType="int"> select * from freight_company where id=#{id} </select> <!--根据实体获取--> <select id="getByEntity" resultMap="resultMap" parameterType="net.mingsoft.freight.entity.CompanyEntity"> select * from freight_company <where> <if test="companyName != null and companyName != ''">and company_name like CONCAT('%',#{companyName},'%')</if> <if test="companyPic != null and companyPic != ''">and company_pic=#{companyPic}</if> <if test="companyDesc != null and companyDesc != ''">and company_desc=#{companyDesc}</if> <if test="companyCode != null and companyCode != ''">and company_code=#{companyCode}</if> <if test="createBy != null"> and create_by=#{createBy} </if> <if test="createDate != null"> and create_date=#{createDate} </if> <if test="updateBy != null"> and update_by=#{updateBy} </if> <if test="updateDate != null"> and update_date=#{updateDate} </if> <if test="del != null"> and del=#{del} </if> </where> limit 0,1 </select> <!--删除--> <delete id="deleteEntity" parameterType="int"> delete from freight_company where id=#{id} </delete> <!--批量删除--> <delete id="delete" > delete from freight_company <where> id in <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">#{item}</foreach> </where> </delete> <!--查询全部--> <select id="queryAll" resultMap="resultMap"> select * from freight_company order by id desc </select> <!--条件查询--> <select id="query" resultMap="resultMap"> select * from freight_company <where> <if test="companyName != null and companyName != ''"> and company_name like CONCAT('%',#{companyName},'%')</if> <if test="companyPic != null and companyPic != ''"> and company_pic=#{companyPic}</if> <if test="companyDesc != null and companyDesc != ''"> and company_desc=#{companyDesc}</if> <if test="companyCode != null and companyCode != ''"> and company_code=#{companyCode}</if> <if test="createBy != null"> and create_by=#{createBy} </if> <if test="createDate != null"> and create_date=#{createDate} </if> <if test="updateBy != null"> and update_by=#{updateBy} </if> <if test="updateDate != null"> and update_date=#{updateDate} </if> <if test="del != null"> and del=#{del} </if> </where> order by id desc </select> </mapper>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy