123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?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.pm.enterpriseInfo.mapper.EnterpriseBranchMapper">
- <resultMap type="pd" id="EnterpriseBranchResult">
- <result property="branchId" column="branch_id" />
- <result property="enterpriseId" column="enterprise_id" />
- <result property="branchName" column="branch_name" />
- <result property="branchCode" column="branch_code" />
- <result property="branchType" column="branch_type" />
- <result property="address" column="address" />
- <result property="contactPerson" column="contact_person" />
- <result property="contactPhone" column="contact_phone" />
- <result property="longitude" column="longitude" />
- <result property="latitude" column="latitude" />
- <result property="status" column="status" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="selectEnterpriseBranchVo">
- select branch_id, enterprise_id, branch_name, branch_code, branch_type, address,
- contact_person, contact_phone, longitude, latitude, status, create_by,
- create_time, update_by, update_time
- from sys_enterprise_branch
- </sql>
- <select id="selectEnterpriseBranchList" parameterType="pd" resultMap="EnterpriseBranchResult">
- <include refid="selectEnterpriseBranchVo"/>
- <where>
- <if test="enterpriseId != null ">
- and enterprise_id = #{enterpriseId}
- </if>
- <if test="branchName != null and branchName != ''">
- and branch_name like concat('%', #{branchName}, '%')
- </if>
- <if test="branchCode != null and branchCode != ''">
- and branch_code = #{branchCode}
- </if>
- <if test="branchType != null and branchType != ''">
- and branch_type = #{branchType}
- </if>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- </where>
- order by create_time desc
- </select>
- <select id="selectEnterpriseBranchByBranchId" parameterType="Long" resultMap="EnterpriseBranchResult">
- <include refid="selectEnterpriseBranchVo"/>
- where branch_id = #{branchId}
- </select>
- <select id="selectBranchesByEnterpriseId" parameterType="Long" resultMap="EnterpriseBranchResult">
- <include refid="selectEnterpriseBranchVo"/>
- where enterprise_id = #{enterpriseId}
- order by create_time desc
- </select>
- <insert id="insertEnterpriseBranch" parameterType="pd" useGeneratedKeys="true" keyProperty="branchId">
- insert into sys_enterprise_branch
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="enterpriseId != null">enterprise_id,</if>
- <if test="branchName != null and branchName != ''">branch_name,</if>
- <if test="branchCode != null and branchCode != ''">branch_code,</if>
- <if test="branchType != null">branch_type,</if>
- <if test="address != null">address,</if>
- <if test="contactPerson != null">contact_person,</if>
- <if test="contactPhone != null">contact_phone,</if>
- <if test="longitude != null">longitude,</if>
- <if test="latitude != null">latitude,</if>
- <if test="status != null">status,</if>
- <if test="createBy != null">create_by,</if>
- create_time,
- <if test="updateBy != null">update_by,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="enterpriseId != null">#{enterpriseId},</if>
- <if test="branchName != null and branchName != ''">#{branchName},</if>
- <if test="branchCode != null and branchCode != ''">#{branchCode},</if>
- <if test="branchType != null">#{branchType},</if>
- <if test="address != null">#{address},</if>
- <if test="contactPerson != null">#{contactPerson},</if>
- <if test="contactPhone != null">#{contactPhone},</if>
- <if test="longitude != null">#{longitude},</if>
- <if test="latitude != null">#{latitude},</if>
- <if test="status != null">#{status},</if>
- <if test="createBy != null">#{createBy},</if>
- sysdate(),
- <if test="updateBy != null">#{updateBy},</if>
- </trim>
- </insert>
- <update id="updateEnterpriseBranch" parameterType="pd">
- update sys_enterprise_branch
- <trim prefix="SET" suffixOverrides=",">
- <if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
- <if test="branchName != null and branchName != ''">branch_name = #{branchName},</if>
- <if test="branchCode != null and branchCode != ''">branch_code = #{branchCode},</if>
- <if test="branchType != null">branch_type = #{branchType},</if>
- <if test="address != null">address = #{address},</if>
- <if test="contactPerson != null">contact_person = #{contactPerson},</if>
- <if test="contactPhone != null">contact_phone = #{contactPhone},</if>
- <if test="longitude != null">longitude = #{longitude},</if>
- <if test="latitude != null">latitude = #{latitude},</if>
- <if test="status != null">status = #{status},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- update_time = sysdate(),
- </trim>
- where branch_id = #{branchId}
- </update>
- <delete id="deleteEnterpriseBranchByBranchId" parameterType="Long">
- delete from sys_enterprise_branch where branch_id = #{branchId}
- </delete>
- <delete id="deleteEnterpriseBranchByBranchIds" parameterType="String">
- delete from sys_enterprise_branch where branch_id in
- <foreach item="branchId" collection="array" open="(" separator="," close=")">
- #{branchId}
- </foreach>
- </delete>
- </mapper>
|