| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475 |
- <?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.MastFarmerMapper">
- <resultMap type="MastFarmerVo" id="MastFarmerResult">
- <result property="id" column="id"/>
- <result property="farmerId" column="farmer_id"/>
- <result property="farmerName" column="farmer_name"/>
- <result property="farmerNameKn" column="farmer_name_kn"/>
- <result property="phoneNumber" column="phone_number"/>
- <result property="mailAddress" column="mail_address"/>
- <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="representativeName" column="representative_name"/>
- <result property="representativeNameKn" column="representative_name_kn"/>
- <result property="issuedBy" column="issued_by"/>
- <result property="issuedDate" column="issued_date"/>
- <result property="loginCnt" column="login_cnt"/>
- <result property="rakuuruCartId" column="rakuuru_cart_id"/>
- <result property="rakuuruCartPwd" column="rakuuru_cart_pwd"/>
- <result property="userPassword" column="user_password"/>
- <result property="discontinuedFlg" column="discontinued_flg"/>
- <result property="discontinuedFlgLabel" column="discontinued_flg_label"/>
- <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="selectMastFarmerVo">
- select
- mf.id,
- mf.farmer_id,
- mf.farmer_name,
- mf.farmer_name_kn,
- mf.phone_number,
- mf.mail_address,
- mf.postal_code,
- mf. prefecture,
- mf. city,
- mf.town_street_area,
- mf.building_etc,
- mf.address,
- mf.representative_name,
- mf.representative_name_kn,
- mf.issued_by,
- mf.issued_date,
- mf.login_cnt,
- mf.rakuuru_cart_id,
- mf.rakuuru_cart_pwd,
- mf.user_password,
- mf.discontinued_flg,
- mf.discontinued_date,
- mf.create_time,
- mf.create_by,
- mf.create_pg_id,
- mf.update_time,
- mf.update_by,
- mf.update_pg_id,
- mf. version,
- sdd.dict_label as discontinued_flg_label
- from mast_farmer mf inner join sys_dict_data sdd
- on CAST(mf.discontinued_flg AS VARCHAR) = sdd.dict_value and sdd.dict_type = 'sys_usage_status'
- </sql>
- <select id="selectList" parameterType="MastFarmer" resultMap="MastFarmerResult">
- <include refid="selectMastFarmerVo"/>
- <where>
- <if test="id != null and id != ''">
- and mf.id = #{id}
- </if>
- <if test="farmerId != null and farmerId != ''">
- and mf.farmer_id = #{farmerId}
- </if>
- <if test="farmerName != null and farmerName != ''">
- and mf.farmer_name like '%' || #{farmerName} || '%'
- </if>
- <if test="farmerNameKn != null and farmerNameKn != ''">
- and mf.farmer_name_kn = #{farmerNameKn}
- </if>
- <if test="phoneNumber != null and phoneNumber != ''">
- and mf.phone_number = #{phoneNumber}
- </if>
- <if test="mailAddress != null and mailAddress != ''">
- and mf.mail_address = #{mailAddress}
- </if>
- <if test="prefecture != null and prefecture != ''">
- and mf.prefecture = #{prefecture}
- </if>
- <if test="city != null and city != ''">
- and mf.city = #{city}
- </if>
- <if test="townStreetArea != null and townStreetArea != ''">
- and mf.town_street_area = #{townStreetArea}
- </if>
- <if test="buildingEtc != null and buildingEtc != ''">
- and mf.building_etc = #{buildingEtc}
- </if>
- <if test="address != null and address != ''">
- and mf.address = #{address}
- </if>
- <if test="representativeName != null and representativeName != ''">
- and mf.representative_name like '%' || #{representativeName} || '%'
- </if>
- <if test="representativeNameKn != null and representativeNameKn != ''">
- and mf.representative_name_kn = #{representativeNameKn}
- </if>
- <if test="issuedBy != null and issuedBy != ''">
- and mf.issued_by = #{issuedBy}
- </if>
- <if test="issuedDate != null and issuedDate != ''">
- and mf.issued_date = #{issuedDate}
- </if>
- <if test="loginCnt != null ">
- and mf.login_cnt = #{loginCnt}
- </if>
- <if test="rakuuruCartId != null and rakuuruCartId != ''">
- and mf.rakuuru_cart_id = #{rakuuruCartId}
- </if>
- <if test="rakuuruCartPwd != null and rakuuruCartPwd != ''">
- and mf.rakuuru_cart_pwd = #{rakuuruCartPwd}
- </if>
- <if test="userPassword != null and userPassword != ''">
- and mf.user_password = #{userPassword}
- </if>
- <if test="discontinuedFlg != null ">
- and mf.discontinued_flg = #{discontinuedFlg}
- </if>
- <if test="discontinuedDate != null and discontinuedDate != ''">
- and mf.discontinued_date = #{discontinuedDate}
- </if>
- <if test="postalCode != null and postalCode != ''">
- and mf.postal_code = #{postalCode}
- </if>
- </where>
- order by mf.farmer_id asc
- </select>
- <select id="selectById" parameterType="String" resultMap="MastFarmerResult">
- <include refid="selectMastFarmerVo"/>
- where mf.id = #{id}
- </select>
- <insert id="insert" parameterType="MastFarmer">
- insert into mast_farmer
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="farmerId != null">
- farmer_id,
- </if>
- <if test="farmerName != null">
- farmer_name,
- </if>
- <if test="farmerNameKn != null">
- farmer_name_kn,
- </if>
- <if test="phoneNumber != null">
- phone_number,
- </if>
- <if test="mailAddress != null">
- mail_address,
- </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="representativeName != null">
- representative_name,
- </if>
- <if test="representativeNameKn != null">
- representative_name_kn,
- </if>
- <if test="issuedBy != null">
- issued_by,
- </if>
- <if test="issuedDate != null">
- issued_date,
- </if>
- <if test="loginCnt != null">
- login_cnt,
- </if>
- <if test="rakuuruCartId != null">
- rakuuru_cart_id,
- </if>
- <if test="rakuuruCartPwd != null">
- rakuuru_cart_pwd,
- </if>
- <if test="userPassword != null">
- user_password,
- </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="farmerId != null">
- #{farmerId},
- </if>
- <if test="farmerName != null">
- #{farmerName},
- </if>
- <if test="farmerNameKn != null">
- #{farmerNameKn},
- </if>
- <if test="phoneNumber != null">
- #{phoneNumber},
- </if>
- <if test="mailAddress != null">
- #{mailAddress},
- </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="representativeName != null">
- #{representativeName},
- </if>
- <if test="representativeNameKn != null">
- #{representativeNameKn},
- </if>
- <if test="issuedBy != null">
- #{issuedBy},
- </if>
- <if test="issuedDate != null">
- #{issuedDate},
- </if>
- <if test="loginCnt != null">
- #{loginCnt},
- </if>
- <if test="rakuuruCartId != null">
- #{rakuuruCartId},
- </if>
- <if test="rakuuruCartPwd != null">
- #{rakuuruCartPwd},
- </if>
- <if test="userPassword != null">
- #{userPassword},
- </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="MastFarmer">
- update mast_farmer
- <trim prefix="SET" suffixOverrides=",">
- <if test="farmerName != null">
- farmer_name = #{farmerName},
- </if>
- <if test="farmerNameKn != null">
- farmer_name_kn = #{farmerNameKn},
- </if>
- <if test="phoneNumber != null">
- phone_number = #{phoneNumber},
- </if>
- <if test="mailAddress != null">
- mail_address = #{mailAddress},
- </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="representativeName != null">
- representative_name = #{representativeName},
- </if>
- <if test="representativeNameKn != null">
- representative_name_kn = #{representativeNameKn},
- </if>
- <if test="issuedBy != null">
- issued_by = #{issuedBy},
- </if>
- <if test="issuedDate != null">
- issued_date = #{issuedDate},
- </if>
- <if test="loginCnt != null">
- login_cnt = #{loginCnt},
- </if>
- <if test="rakuuruCartId != null">
- rakuuru_cart_id = #{rakuuruCartId},
- </if>
- <if test="rakuuruCartPwd != null">
- rakuuru_cart_pwd = #{rakuuruCartPwd},
- </if>
- <if test="userPassword != null">
- user_password = #{userPassword},
- </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>
- <select id="getFarmerIdCount" parameterType="String" resultType="java.lang.Integer">
- SELECT
- count(1)
- FROM
- mast_farmer
- <where>
- <if test="farmerId != null and farmerId != ''">
- and farmer_id = #{farmerId}
- </if>
- </where>
- </select>
- <delete id="deleteById" parameterType="String">
- delete
- from
- mast_farmer
- where
- id = #{id}
- </delete>
- <!--廃止-->
- <update id="deleteLogicByIdAndVersion" parameterType="MastFarmer">
- update
- mast_noka
- 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="farmerId != null and farmerId != ''">
- and farmer_id = #{farmerId}
- </if>
- and version = #{version}
- and discontinued_flg = 0
- </where>
- </update>
- </mapper>
|