zhwl/zhwl-business/zhwl-base/target/classes/mapper/base/ZdyBaseCompanyMapper.xml

204 lines
7.0 KiB
XML
Raw Normal View History

2025-07-01 17:54:58 +08:00
<?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.zhwl.base.mapper.ZdyBaseCompanyMapper">
<resultMap type="ZdyBaseCompany" id="ZdyBaseCompanyResult">
<result property="id" column="id"/>
<result property="companyName" column="company_name"/>
<result property="deptId" column="dept_id"/>
<result property="address" column="address"/>
<result property="legal" column="legal"/>
<result property="phone" column="phone"/>
<result property="enterpriseCode" column="enterprise_code"/>
<result property="businessLicense" column="business_license"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectZdyBaseCompanyVo">
select id,
company_name,
dept_id,
address,
legal,
phone,
enterprise_code,
business_license,
create_time,
create_by,
update_time,
update_by,
remark
from zdy_base_company
</sql>
<select id="selectZdyBaseCompanyList" parameterType="ZdyBaseCompany" resultMap="ZdyBaseCompanyResult">
<include refid="selectZdyBaseCompanyVo"/>
<where>
<if test="companyName != null and companyName != ''">
and company_name like concat('%', #{companyName}, '%')
</if>
<if test="address != null and address != ''">
and address = #{address}
</if>
<if test="legal != null and legal != ''">
and legal = #{legal}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="enterpriseCode != null and enterpriseCode != ''">
and enterprise_code = #{enterpriseCode}
</if>
<if test="businessLicense != null and businessLicense != ''">
and business_license = #{businessLicense}
</if>
<if test="deptId != null">
and dept_id = #{deptId}
</if>
</where>
</select>
<select id="selectZdyBaseCompanyById" parameterType="Long"
resultMap="ZdyBaseCompanyResult">
<include refid="selectZdyBaseCompanyVo"/>
where id = #{id}
</select>
<insert id="insertZdyBaseCompany" parameterType="ZdyBaseCompany" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_base_company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyName != null">company_name,
</if>
<if test="address != null">address,
</if>
<if test="legal != null">legal,
</if>
<if test="phone != null">phone,
</if>
<if test="enterpriseCode != null">enterprise_code,
</if>
<if test="businessLicense != null">business_license,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="remark != null">remark,
</if>
<if test="deptId != null">dept_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},
</if>
<if test="address != null">#{address},
</if>
<if test="legal != null">#{legal},
</if>
<if test="phone != null">#{phone},
</if>
<if test="enterpriseCode != null">#{enterpriseCode},
</if>
<if test="businessLicense != null">#{businessLicense},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="remark != null">#{remark},
</if>
<if test="deptId != null">#{deptId},
</if>
</trim>
</insert>
<update id="updateZdyBaseCompany" parameterType="ZdyBaseCompany">
update zdy_base_company
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name =
#{companyName},
</if>
<if test="address != null">address =
#{address},
</if>
<if test="legal != null">legal =
#{legal},
</if>
<if test="phone != null">phone =
#{phone},
</if>
<if test="enterpriseCode != null">enterprise_code =
#{enterpriseCode},
</if>
<if test="businessLicense != null">business_license =
#{businessLicense},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="remark != null">remark =
#{remark},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyBaseCompanyById" parameterType="Long">
delete
from zdy_base_company
where id = #{id}
</delete>
<delete id="deleteZdyBaseCompanyByIds" parameterType="String">
delete from zdy_base_company where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateZdyBaseCompanyByDeptId" parameterType="ZdyBaseCompany">
update zdy_base_company
set company_name = #{companyName}
where dept_id = #{deptId}
</update>
<select id="selectZdyBaseCompanyByDeptId" parameterType="Long"
resultMap="ZdyBaseCompanyResult">
<include refid="selectZdyBaseCompanyVo"/>
where dept_id = #{deptId} limit 1
</select>
<select id="countByCompanyName" resultType="int">
select count(1)
from zdy_base_company
where company_name = #{companyName}
</select>
</mapper>