no message
This commit is contained in:
143
src/main/resources/mapper/CompanyInfoMapper.xml
Normal file
143
src/main/resources/mapper/CompanyInfoMapper.xml
Normal file
@ -0,0 +1,143 @@
|
||||
<?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.sczx.sync.mapper.CompanyInfoMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.sczx.sync.po.CompanyInfo">
|
||||
<result column="company_name" property="companyName" />
|
||||
<result column="contact_name" property="contactName" />
|
||||
<result column="phone" property="phone" />
|
||||
<result column="address" property="address" />
|
||||
<result column="citys" property="citys" />
|
||||
<result column="is_delete" property="isDelete" />
|
||||
<result column="b_op_id" property="bOpId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
b_op_id, company_name, contact_name, phone, address, citys, is_delete
|
||||
</sql>
|
||||
|
||||
<!-- 根据电话号码查询公司信息 -->
|
||||
<select id="selectByPhone" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM zc_company
|
||||
WHERE phone = #{phone}
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据bOpId查询公司信息 -->
|
||||
<select id="selectByOpId" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM zc_company
|
||||
WHERE b_op_id = #{bOpId}
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据公司名称查询公司信息 -->
|
||||
<select id="selectByCompanyName" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM zc_company
|
||||
WHERE company_name = #{companyName}
|
||||
AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据电话号码更新公司信息 -->
|
||||
<update id="updateByPhone" parameterType="com.sczx.sync.po.CompanyInfo" >
|
||||
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
|
||||
SELECT
|
||||
id
|
||||
from zc_company
|
||||
where phone = #{phone}
|
||||
</selectKey>
|
||||
UPDATE zc_company
|
||||
<set>
|
||||
<if test="companyName != null and companyName != ''">
|
||||
company_name = #{companyName},
|
||||
</if>
|
||||
<if test="contactName != null and contactName != ''">
|
||||
contact_name = #{contactName},
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
address = #{address},
|
||||
</if>
|
||||
<if test="citys != null and citys != ''">
|
||||
citys = #{citys},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete = #{isDelete},
|
||||
</if>
|
||||
<if test="bOpId != null">
|
||||
b_op_id = #{bOpId},
|
||||
</if>
|
||||
phone = #{phone}
|
||||
</set>
|
||||
WHERE phone = #{phone}
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据电话号码更新公司信息 -->
|
||||
<update id="updateByOpId" parameterType="com.sczx.sync.po.CompanyInfo">
|
||||
<selectKey keyProperty='id' resultType='java.lang.Long' order='AFTER'>
|
||||
SELECT
|
||||
id
|
||||
from zc_company
|
||||
where phone = #{phone}
|
||||
</selectKey>
|
||||
UPDATE zc_company
|
||||
<set>
|
||||
<if test="companyName != null and companyName != ''">
|
||||
company_name = #{companyName},
|
||||
</if>
|
||||
<if test="contactName != null and contactName != ''">
|
||||
contact_name = #{contactName},
|
||||
</if>
|
||||
<if test="address != null and address != ''">
|
||||
address = #{address},
|
||||
</if>
|
||||
<if test="citys != null and citys != ''">
|
||||
citys = #{citys},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete = #{isDelete},
|
||||
</if>
|
||||
<if test="bOpId != null">
|
||||
b_op_id = #{bOpId},
|
||||
</if>
|
||||
phone = #{phone}
|
||||
</set>
|
||||
WHERE b_op_id = #{bOpId}
|
||||
</update>
|
||||
|
||||
<!-- 插入公司信息 -->
|
||||
<insert id="insertCompanyInfo" parameterType="com.sczx.sync.po.CompanyInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO zc_company (
|
||||
b_op_id,
|
||||
company_name,
|
||||
contact_name,
|
||||
phone,
|
||||
address,
|
||||
citys,
|
||||
is_delete,
|
||||
is_add_rules,
|
||||
sharing_ratio,
|
||||
wechat_receiving_account,
|
||||
wechat_key,
|
||||
ali_receiving_account,
|
||||
ali_key
|
||||
) VALUES (
|
||||
#{bOpId},
|
||||
#{companyName},
|
||||
#{contactName},
|
||||
#{phone},
|
||||
#{address},
|
||||
#{citys},
|
||||
#{isDelete},
|
||||
0,0,0,0,0,0
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user