| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500 |
- <?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="jp.yamoto.farm.crm.biz.master.mapper.MastCustomerMapper">
- <resultMap type="MastCustomerVo" id="MastCustomerResult">
- <result property="id" column="id"/>
- <result property="customerId" column="customer_id"/>
- <result property="firstName" column="first_name"/>
- <result property="lastName" column="last_name"/>
- <result property="customerName" column="customer_name"/>
- <result property="phoneNumber" column="phone_number"/>
- <result property="sysCustomerId" column="sys_customer_id"/>
- <result property="memberId" column="member_id"/>
- <result property="furiganaSei" column="furigana_sei"/>
- <result property="furiganaMei" column="furigana_mei"/>
- <result property="companyName" column="company_name"/>
- <result property="departmentName" column="department_name"/>
- <result property="postalCode" column="postal_code"/>
- <result property="prefecture" column="prefecture"/>
- <result property="city" column="city"/>
- <result property="townStreetArea" column="town_street_area"/>
- <result property="buildingEtc" column="building_etc"/>
- <result property="address" column="address"/>
- <result property="mailAddress" column="mail_address"/>
- <result property="mobile" column="mobile"/>
- <result property="fax" column="fax"/>
- <result property="farmerId" column="farmer_id"/>
- <result property="discontinuedFlg" column="discontinued_flg"/>
- <result property="discontinuedDate" column="discontinued_date"/>
- <result property="createTime" column="create_time"/>
- <result property="createBy" column="create_by"/>
- <result property="createPgId" column="create_pg_id"/>
- <result property="updateTime" column="update_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updatePgId" column="update_pg_id"/>
- <result property="version" column="version"/>
- </resultMap>
- <sql id="selectMastCustomerVo">
- select
- id,
- customer_id,
- first_name,
- last_name,
- customer_name,
- phone_number,
- sys_customer_id,
- member_id,
- furigana_sei,
- furigana_mei,
- company_name,
- department_name,
- postal_code,
- prefecture,
- city,
- town_street_area,
- building_etc,
- address,
- mail_address,
- mobile,
- fax,
- farmer_id,
- discontinued_flg,
- discontinued_date,
- create_time,
- create_by,
- create_pg_id,
- update_time,
- update_by,
- update_pg_id,
- version
- from mast_customer
- </sql>
- <select id="selectList" parameterType="MastCustomer" resultMap="MastCustomerResult">
- <include refid="selectMastCustomerVo"/>
- <where>
- <if test="id != null and id != ''">
- and id = #{id}
- </if>
- <if test="customerId != null and customerId != ''">
- and customer_id = #{customerId}
- </if>
- <if test="firstName != null and firstName != ''">
- and first_name = #{firstName}
- </if>
- <if test="lastName != null and lastName != ''">
- and last_name = #{lastName}
- </if>
- <if test="customerName != null and customerName != ''">
- and customer_name = #{customerName}
- </if>
- <if test="phoneNumber != null and phoneNumber != ''">
- and phone_number = #{phoneNumber}
- </if>
- <if test="sysCustomerId != null and sysCustomerId != ''">
- and sys_customer_id = #{sysCustomerId}
- </if>
- <if test="memberId != null and memberId != ''">
- and member_id = #{memberId}
- </if>
- <if test="furiganaSei != null and furiganaSei != ''">
- and furigana_sei = #{furiganaSei}
- </if>
- <if test="furiganaMei != null and furiganaMei != ''">
- and furigana_mei = #{furiganaMei}
- </if>
- <if test="companyName != null and companyName != ''">
- and company_name = #{companyName}
- </if>
- <if test="departmentName != null and departmentName != ''">
- and department_name = #{departmentName}
- </if>
- <if test="postalCode != null and postalCode != ''">
- and postal_code = #{postalCode}
- </if>
- <if test="prefecture != null and prefecture != ''">
- and prefecture = #{prefecture}
- </if>
- <if test="city != null and city != ''">
- and city = #{city}
- </if>
- <if test="townStreetArea != null and townStreetArea != ''">
- and town_street_area = #{townStreetArea}
- </if>
- <if test="buildingEtc != null and buildingEtc != ''">
- and building_etc = #{buildingEtc}
- </if>
- <if test="address != null and address != ''">
- and address = #{address}
- </if>
- <if test="mailAddress != null and mailAddress != ''">
- and mail_address = #{mailAddress}
- </if>
- <if test="mobile != null and mobile != ''">
- and mobile = #{mobile}
- </if>
- <if test="fax != null and fax != ''">
- and fax = #{fax}
- </if>
- <if test="farmerId != null and farmerId != ''">
- and farmer_id = #{farmerId}
- </if>
- <if test="discontinuedFlg != null ">
- and discontinued_flg = #{discontinuedFlg}
- </if>
- <if test="discontinuedDate != null and discontinuedDate != ''">
- and discontinued_date = #{discontinuedDate}
- </if>
- </where>
- </select>
- <select id="selectById" parameterType="String" resultMap="MastCustomerResult">
- <include refid="selectMastCustomerVo"/>
- where id = #{id}
- </select>
- <select id="getCustomerIdCount" parameterType="String" resultType="java.lang.Integer">
- SELECT
- count(1)
- FROM
- mast_customer
- <where>
- <if test="customerId != null and customerId != ''">
- and customer_id = #{customerId}
- </if>
- </where>
- </select>
- <insert id="insert" parameterType="MastCustomer">
- insert into mast_customer
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="customerId != null">
- customer_id,
- </if>
- <if test="firstName != null">
- first_name,
- </if>
- <if test="lastName != null">
- last_name,
- </if>
- <if test="customerName != null">
- customer_name,
- </if>
- <if test="phoneNumber != null">
- phone_number,
- </if>
- <if test="sysCustomerId != null">
- sys_customer_id,
- </if>
- <if test="memberId != null">
- member_id,
- </if>
- <if test="furiganaSei != null">
- furigana_sei,
- </if>
- <if test="furiganaMei != null">
- furigana_mei,
- </if>
- <if test="companyName != null">
- company_name,
- </if>
- <if test="departmentName != null">
- department_name,
- </if>
- <if test="postalCode != null">
- postal_code,
- </if>
- <if test="prefecture != null">
- prefecture,
- </if>
- <if test="city != null">
- city,
- </if>
- <if test="townStreetArea != null">
- town_street_area,
- </if>
- <if test="buildingEtc != null">
- building_etc,
- </if>
- <if test="address != null">
- address,
- </if>
- <if test="mailAddress != null">
- mail_address,
- </if>
- <if test="mobile != null">
- mobile,
- </if>
- <if test="fax != null">
- fax,
- </if>
- <if test="farmerId != null">
- farmer_id,
- </if>
- <if test="discontinuedFlg != null">
- discontinued_flg,
- </if>
- <if test="discontinuedDate != null">
- discontinued_date,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="createBy != null">
- create_by,
- </if>
- <if test="createPgId != null">
- create_pg_id,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="updateBy != null">
- update_by,
- </if>
- <if test="updatePgId != null">
- update_pg_id,
- </if>
- <if test="version != null">
- version,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id},
- </if>
- <if test="customerId != null">
- #{customerId},
- </if>
- <if test="firstName != null">
- #{firstName},
- </if>
- <if test="lastName != null">
- #{lastName},
- </if>
- <if test="customerName != null">
- #{customerName},
- </if>
- <if test="phoneNumber != null">
- #{phoneNumber},
- </if>
- <if test="sysCustomerId != null">
- #{sysCustomerId},
- </if>
- <if test="memberId != null">
- #{memberId},
- </if>
- <if test="furiganaSei != null">
- #{furiganaSei},
- </if>
- <if test="furiganaMei != null">
- #{furiganaMei},
- </if>
- <if test="companyName != null">
- #{companyName},
- </if>
- <if test="departmentName != null">
- #{departmentName},
- </if>
- <if test="postalCode != null">
- #{postalCode},
- </if>
- <if test="prefecture != null">
- #{prefecture},
- </if>
- <if test="city != null">
- #{city},
- </if>
- <if test="townStreetArea != null">
- #{townStreetArea},
- </if>
- <if test="buildingEtc != null">
- #{buildingEtc},
- </if>
- <if test="address != null">
- #{address},
- </if>
- <if test="mailAddress != null">
- #{mailAddress},
- </if>
- <if test="mobile != null">
- #{mobile},
- </if>
- <if test="fax != null">
- #{fax},
- </if>
- <if test="farmerId != null">
- #{farmerId},
- </if>
- <if test="discontinuedFlg != null">
- #{discontinuedFlg},
- </if>
- <if test="discontinuedDate != null">
- #{discontinuedDate},
- </if>
- <if test="createTime != null">
- #{createTime},
- </if>
- <if test="createBy != null">
- #{createBy},
- </if>
- <if test="createPgId != null">
- #{createPgId},
- </if>
- <if test="updateTime != null">
- #{updateTime},
- </if>
- <if test="updateBy != null">
- #{updateBy},
- </if>
- <if test="updatePgId != null">
- #{updatePgId},
- </if>
- <if test="version != null">
- #{version},
- </if>
- </trim>
- </insert>
- <update id="update" parameterType="MastCustomer">
- update mast_customer
- <trim prefix="SET" suffixOverrides=",">
- <if test="id != null">
- id = #{id},
- </if>
- <if test="customerId != null">
- customer_id = #{customerId},
- </if>
- <if test="firstName != null">
- first_name = #{firstName},
- </if>
- <if test="lastName != null">
- last_name = #{lastName},
- </if>
- <if test="customerName != null">
- customer_name = #{customerName},
- </if>
- <if test="phoneNumber != null">
- phone_number = #{phoneNumber},
- </if>
- <if test="sysCustomerId != null">
- sys_customer_id = #{sysCustomerId},
- </if>
- <if test="memberId != null">
- member_id = #{memberId},
- </if>
- <if test="furiganaSei != null">
- furigana_sei = #{furiganaSei},
- </if>
- <if test="furiganaMei != null">
- furigana_mei = #{furiganaMei},
- </if>
- <if test="companyName != null">
- company_name = #{companyName},
- </if>
- <if test="departmentName != null">
- department_name = #{departmentName},
- </if>
- <if test="postalCode != null">
- postal_code = #{postalCode},
- </if>
- <if test="prefecture != null">
- prefecture = #{prefecture},
- </if>
- <if test="city != null">
- city = #{city},
- </if>
- <if test="townStreetArea != null">
- town_street_area = #{townStreetArea},
- </if>
- <if test="buildingEtc != null">
- building_etc = #{buildingEtc},
- </if>
- <if test="address != null">
- address = #{address},
- </if>
- <if test="mailAddress != null">
- mail_address = #{mailAddress},
- </if>
- <if test="mobile != null">
- mobile = #{mobile},
- </if>
- <if test="fax != null">
- fax = #{fax},
- </if>
- <if test="farmerId != null">
- farmer_id = #{farmerId},
- </if>
- <if test="discontinuedFlg != null">
- discontinued_flg = #{discontinuedFlg},
- </if>
- <if test="discontinuedDate != null">
- discontinued_date = #{discontinuedDate},
- </if>
- <if test="createTime != null">
- create_time = #{createTime},
- </if>
- <if test="createBy != null">
- create_by = #{createBy},
- </if>
- <if test="createPgId != null">
- create_pg_id = #{createPgId},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime},
- </if>
- <if test="updateBy != null">
- update_by = #{updateBy},
- </if>
- <if test="updatePgId != null">
- update_pg_id = #{updatePgId},
- </if>
- version = version + 1
- </trim>
- where
- id = #{id}
- and version = #{version}
- </update>
- <delete id="deleteById" parameterType="String">
- delete
- from
- mast_customer
- where
- id = #{id}
- </delete>
- <update id="deleteLogicByIdAndVersion" parameterType="MastOkyakusama">
- update
- mast_customer
- set
- haisi_flg = 1,
- version = version + 1,
- <if test="updateBy != null">
- update_by = #{updateBy},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime}
- </if>
- <where>
- <if test="customerId != null and customerId != ''">
- and customer_id = #{customerId}
- </if>
- and version = #{version}
- and haisi_flg = 0
- </where>
- </update>
- </mapper>
|