JNBusinessTest/ruoyi-system/target/classes/mapper/registeredCompany/RegisteredCompanyMapper.xml

98 lines
5.5 KiB
XML
Raw Normal View History

2024-08-01 17:23:46 +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.ruoyi.registeredCompany.mapper.RegisteredCompanyMapper">
<resultMap type="RegisteredCompany" id="RegisteredCompanyResult">
<result property="regId" column="reg_id" />
<result property="regSalesmanCode" column="reg_salesman_code" />
<result property="regSalesmanName" column="reg_salesman_name" />
<result property="regCompany" column="reg_company" />
<result property="regTax" column="reg_tax" />
<result property="regState" column="reg_state" />
<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="selectRegisteredCompanyVo">
select reg_id, reg_salesman_code, reg_salesman_name, reg_company, reg_tax, reg_state, create_by, create_time, update_by, update_time from registered_company
</sql>
<select id="selectRegisteredCompanyList" parameterType="RegisteredCompany" resultMap="RegisteredCompanyResult">
<include refid="selectRegisteredCompanyVo"/>
<where>
<if test="regSalesmanCode != null and regSalesmanCode != ''"> and reg_salesman_code = #{regSalesmanCode}</if>
<if test="regSalesmanName != null and regSalesmanName != ''"> and reg_salesman_name like concat('%', #{regSalesmanName}, '%')</if>
<if test="regCompany != null and regCompany != ''"> and reg_company like concat('%', #{regCompany}, '%')</if>
<if test="regState != null and regState != ''"> and reg_state = #{regState}</if>
</where>
</select>
<select id="selectRegisteredCompanyByRegId" parameterType="String" resultMap="RegisteredCompanyResult">
<include refid="selectRegisteredCompanyVo"/>
where reg_id = #{regId}
</select>
<insert id="insertRegisteredCompany" parameterType="RegisteredCompany">
insert into registered_company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="regId != null">reg_id,</if>
<if test="regSalesmanCode != null">reg_salesman_code,</if>
<if test="regSalesmanName != null">reg_salesman_name,</if>
<if test="regCompany != null and regCompany != ''">reg_company,</if>
<if test="regTax != null and regTax != ''">reg_tax,</if>
<if test="regState != null">reg_state,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="regId != null">#{regId},</if>
<if test="regSalesmanCode != null">#{regSalesmanCode},</if>
<if test="regSalesmanName != null">#{regSalesmanName},</if>
<if test="regCompany != null and regCompany != ''">#{regCompany},</if>
<if test="regTax != null and regTax != ''">#{regTax},</if>
<if test="regState != null">#{regState},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateRegisteredCompany" parameterType="RegisteredCompany">
update registered_company
<trim prefix="SET" suffixOverrides=",">
<if test="regSalesmanCode != null">reg_salesman_code = #{regSalesmanCode},</if>
<if test="regSalesmanName != null">reg_salesman_name = #{regSalesmanName},</if>
<if test="regCompany != null and regCompany != ''">reg_company = #{regCompany},</if>
<if test="regTax != null and regTax != ''">reg_tax = #{regTax},</if>
<if test="regState != null">reg_state = #{regState},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where reg_id = #{regId}
</update>
<delete id="deleteRegisteredCompanyByRegId" parameterType="String">
delete from registered_company where reg_id = #{regId}
</delete>
<delete id="deleteRegisteredCompanyByRegIds" parameterType="String">
delete from registered_company where reg_id in
<foreach item="regId" collection="array" open="(" separator="," close=")">
#{regId}
</foreach>
</delete>
<select id="checkTaxUnique" parameterType="String" resultMap="RegisteredCompanyResult">
select top(1) reg_id from registered_company where reg_tax = #{regTax} and reg_state = '0'
</select>
</mapper>