2024-08-05 17:16:54 +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.authorize.mapper.AuthorizeMapper" >
<resultMap type= "Authorize" id= "AuthorizeResult" >
<result property= "doaId" column= "doa_id" />
<result property= "doaCode" column= "doa_code" />
<result property= "doaNumber" column= "doa_number" />
<result property= "doaSalesmanCode" column= "doa_salesman_code" />
<result property= "doaSalesmanBm" column= "doa_salesman_bm" />
<result property= "doaSalesmanName" column= "doa_salesman_name" />
<result property= "doaSalesmanDeptId" column= "doa_salesman_dept_id" />
<result property= "doaSalesmanDeptName" column= "doa_salesman_dept_name" />
<result property= "doaSalesmanPhone" column= "doa_salesman_phone" />
<result property= "doaProject" column= "doa_project" />
<result property= "doaCustomerBm" column= "doa_customer_bm" />
<result property= "doaCustomerName" column= "doa_customer_name" />
<result property= "doaOwnerUnit" column= "doa_owner_unit" />
<result property= "doaGeneralcontractUnit" column= "doa_generalcontract_unit" />
<result property= "doaSubcontractUnit" column= "doa_subcontract_unit" />
<result property= "doaAuthorizer" column= "doa_authorizer" />
<result property= "doaAuthorizerPhone" column= "doa_authorizer_phone" />
<result property= "doaAuthorizerIdentificationNumber" column= "doa_authorizer_identification_number" />
<result property= "doaAuthorizationDuration" column= "doa_authorization_duration" />
<result property= "doaPowerAttorneyPurpose" column= "doa_power_attorney_purpose" />
<result property= "doaFormat" column= "doa_format" />
<result property= "doaRemark" column= "doa_remark" />
<result property= "doaRejectionReasons" column= "doa_rejection_reasons" />
<result property= "doaStandardizer" column= "doa_standardizer" />
<result property= "doaArchiving" column= "doa_archiving" />
<result property= "doaVicePresidentApproved" column= "doa_vice_president_approved" />
<result property= "doaApprovalStatus" column= "doa_approval_status" />
<result property= "doaOaApprovalStatus" column= "doa_oa_approval_status" />
2024-08-07 16:25:31 +08:00
<result property= "doaOaRemark" column= "doa_oa_remark" />
2024-08-05 17:16:54 +08:00
<result property= "createBy" column= "create_by" />
<result property= "createName" column= "create_name" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
</resultMap>
<sql id= "authorizeJoins" >
left join sys_user u on u.user_name=a.create_by
left join sys_dept d on u.dept_id = d.dept_id
</sql>
<sql id= "selectAuthorizeVo" >
select a.doa_id, a.doa_code, a.doa_number, a.doa_salesman_code, a.doa_salesman_bm, a.doa_salesman_name, a.doa_salesman_dept_id,
a.doa_salesman_dept_name, a.doa_salesman_phone, a.doa_project, a.doa_customer_bm, a.doa_customer_name,
a.doa_owner_unit, a.doa_generalcontract_unit, a.doa_subcontract_unit, a.doa_authorizer, a.doa_authorizer_phone,
a.doa_authorizer_identification_number, a.doa_authorization_duration, a.doa_power_attorney_purpose,
a.doa_format, a.doa_remark, a.doa_rejection_reasons, a.doa_standardizer, a.doa_archiving, a.doa_vice_president_approved,
2024-08-08 11:25:41 +08:00
a.doa_approval_status, a.doa_oa_approval_status, a.doa_oa_remark,
2024-08-05 17:16:54 +08:00
a.create_by, u.nick_name create_name, a.create_time, a.update_by, a.update_time
from authorize a
<include refid= "authorizeJoins" />
</sql>
<select id= "selectAuthorizeList" parameterType= "Authorize" resultMap= "AuthorizeResult" >
<include refid= "selectAuthorizeVo" />
<where >
<if test= "doaNumber != null and doaNumber != ''" > and doa_number like concat('%', #{doaNumber}, '%')</if>
<if test= "doaSalesmanName != null and doaSalesmanName != ''" > and doa_salesman_name like concat('%', #{doaSalesmanName}, '%')</if>
<if test= "doaProject != null and doaProject != ''" > and doa_project like concat('%', #{doaProject}, '%')</if>
<if test= "doaCustomerName != null and doaCustomerName != ''" > and doa_customer_name like concat('%', #{doaCustomerName}, '%')</if>
<if test= "doaAuthorizer != null and doaAuthorizer != ''" > and doa_authorizer like concat('%', #{doaAuthorizer}, '%')</if>
<if test= "params.beginDoaAuthorizationDuration != null and params.beginDoaAuthorizationDuration != '' and params.endDoaAuthorizationDuration != null and params.endDoaAuthorizationDuration != ''" > and doa_authorization_duration between #{params.beginDoaAuthorizationDuration} and #{params.endDoaAuthorizationDuration}</if>
<if test= "doaPowerAttorneyPurpose != null and doaPowerAttorneyPurpose != ''" > and doa_power_attorney_purpose = #{doaPowerAttorneyPurpose}</if>
<if test= "doaApprovalStatus != null and doaApprovalStatus != ''" > and doa_approval_status = #{doaApprovalStatus}</if>
<if test= "doaStandardizer != null and doaStandardizer != ''" > and doa_standardizer like concat('%', #{doaStandardizer}, '%')</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>
<select id= "selectAuthorizeByDoaId" parameterType= "String" resultMap= "AuthorizeResult" >
<include refid= "selectAuthorizeVo" />
where doa_id = #{doaId}
</select>
<insert id= "insertAuthorize" parameterType= "Authorize" >
insert into authorize
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "doaId != null" > doa_id,</if>
<if test= "doaCode != null" > doa_code,</if>
<if test= "doaNumber != null" > doa_number,</if>
<if test= "doaSalesmanCode != null" > doa_salesman_code,</if>
<if test= "doaSalesmanBm != null" > doa_salesman_bm,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanName != null" > doa_salesman_name,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaSalesmanDeptId != null" > doa_salesman_dept_id,</if>
<if test= "doaSalesmanDeptName != null" > doa_salesman_dept_name,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanPhone != null" > doa_salesman_phone,</if>
<if test= "doaProject != null" > doa_project,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaCustomerBm != null" > doa_customer_bm,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaCustomerName != null" > doa_customer_name,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaOwnerUnit != null" > doa_owner_unit,</if>
<if test= "doaGeneralcontractUnit != null" > doa_generalcontract_unit,</if>
<if test= "doaSubcontractUnit != null" > doa_subcontract_unit,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaAuthorizer != null" > doa_authorizer,</if>
<if test= "doaAuthorizerPhone != null" > doa_authorizer_phone,</if>
<if test= "doaAuthorizerIdentificationNumber != null" > doa_authorizer_identification_number,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaAuthorizationDuration != null" > doa_authorization_duration,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaPowerAttorneyPurpose != null" > doa_power_attorney_purpose,</if>
<if test= "doaFormat != null" > doa_format,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaRemark != null" > doa_remark,</if>
<if test= "doaRejectionReasons != null" > doa_rejection_reasons,</if>
<if test= "doaStandardizer != null" > doa_standardizer,</if>
<if test= "doaArchiving != null" > doa_archiving,</if>
<if test= "doaVicePresidentApproved != null" > doa_vice_president_approved,</if>
<if test= "doaApprovalStatus != null" > doa_approval_status,</if>
<if test= "doaOaApprovalStatus != null" > doa_oa_approval_status,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaOaRemark != null" > doa_oa_remark,</if>
2024-08-05 17:16:54 +08:00
<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= "doaId != null" > #{doaId},</if>
<if test= "doaCode != null" > #{doaCode},</if>
<if test= "doaNumber != null" > #{doaNumber},</if>
<if test= "doaSalesmanCode != null" > #{doaSalesmanCode},</if>
<if test= "doaSalesmanBm != null" > #{doaSalesmanBm},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanName != null" > #{doaSalesmanName},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaSalesmanDeptId != null" > #{doaSalesmanDeptId},</if>
<if test= "doaSalesmanDeptName != null" > #{doaSalesmanDeptName},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanPhone != null" > #{doaSalesmanPhone},</if>
<if test= "doaProject != null" > #{doaProject},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaCustomerBm != null" > #{doaCustomerBm},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaCustomerName != null" > #{doaCustomerName},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaOwnerUnit != null" > #{doaOwnerUnit},</if>
<if test= "doaGeneralcontractUnit != null" > #{doaGeneralcontractUnit},</if>
<if test= "doaSubcontractUnit != null" > #{doaSubcontractUnit},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaAuthorizer != null" > #{doaAuthorizer},</if>
<if test= "doaAuthorizerPhone != null" > #{doaAuthorizerPhone},</if>
<if test= "doaAuthorizerIdentificationNumber != null" > #{doaAuthorizerIdentificationNumber},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaAuthorizationDuration != null" > #{doaAuthorizationDuration},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaPowerAttorneyPurpose != null" > #{doaPowerAttorneyPurpose},</if>
<if test= "doaFormat != null" > #{doaFormat},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaRemark != null" > #{doaRemark},</if>
<if test= "doaRejectionReasons != null" > #{doaRejectionReasons},</if>
<if test= "doaStandardizer != null" > #{doaStandardizer},</if>
<if test= "doaArchiving != null" > #{doaArchiving},</if>
<if test= "doaVicePresidentApproved != null" > #{doaVicePresidentApproved},</if>
<if test= "doaApprovalStatus != null" > #{doaApprovalStatus},</if>
<if test= "doaOaApprovalStatus != null" > #{doaOaApprovalStatus},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaOaRemark != null" > #{doaOaRemark},</if>
2024-08-05 17:16:54 +08:00
<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>
<insert id= "insertSysOAAuthorize" parameterType= "SysOaAuthorize" >
insert into sys_oa_authorize
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
2024-08-07 16:25:31 +08:00
<if test= "userId != null" > user_id,</if>
<if test= "departmentId != null" > department_id,</if>
<if test= "submissionTime != null" > submission_time,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaId != null" > doa_id,</if>
2024-08-08 16:51:48 +08:00
<if test= "doaCode != null" > doa_code,</if>
2024-08-08 15:09:48 +08:00
<if test= "doaNumber != null" > doa_number,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanName != null" > doa_salesman_name,</if>
<if test= "doaProject != null" > doa_project,</if>
<if test= "doaCustomerName != null" > doa_customer_name,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaOwnerUnit != null" > doa_owner_unit,</if>
<if test= "doaGeneralcontractUnit != null" > doa_generalcontract_unit,</if>
<if test= "doaSubcontractUnit != null" > doa_subcontract_unit,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaAuthorizer != null" > doa_authorizer,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaAuthorizationDuration != null" > doa_authorization_duration,</if>
2024-08-07 16:25:31 +08:00
<if test= "doaPowerAttorneyPurpose != null" > doa_power_attorney_purpose,</if>
2024-08-05 17:16:54 +08:00
<if test= "doaRemark != null" > doa_remark,</if>
<if test= "doaStandardizer != null" > doa_standardizer,</if>
<if test= "createTime != null" > create_time,</if>
2024-08-07 16:25:31 +08:00
<if test= "isFinish != null" > isFinish,</if>
2024-08-05 17:16:54 +08:00
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
2024-08-07 16:25:31 +08:00
<if test= "userId != null" > #{userId},</if>
<if test= "departmentId != null" > #{departmentId},</if>
<if test= "submissionTime != null" > #{submissionTime},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaId != null" > #{doaId},</if>
2024-08-08 16:51:48 +08:00
<if test= "doaCode != null" > #{doaCode},</if>
2024-08-08 15:09:48 +08:00
<if test= "doaNumber != null" > #{doaNumber},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanName != null" > #{doaSalesmanName},</if>
<if test= "doaProject != null" > #{doaProject},</if>
<if test= "doaCustomerName != null" > #{doaCustomerName},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaOwnerUnit != null" > #{doaOwnerUnit},</if>
<if test= "doaGeneralcontractUnit != null" > #{doaGeneralcontractUnit},</if>
<if test= "doaSubcontractUnit != null" > #{doaSubcontractUnit},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaAuthorizer != null" > #{doaAuthorizer},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaAuthorizationDuration != null" > #{doaAuthorizationDuration},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaPowerAttorneyPurpose != null" > #{doaPowerAttorneyPurpose},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaRemark != null" > #{doaRemark},</if>
<if test= "doaStandardizer != null" > #{doaStandardizer},</if>
<if test= "createTime != null" > #{createTime},</if>
2024-08-07 16:25:31 +08:00
<if test= "isFinish != null" > #{isFinish},</if>
2024-08-05 17:16:54 +08:00
</trim>
</insert>
<update id= "updateAuthorize" parameterType= "Authorize" >
update authorize
<trim prefix= "SET" suffixOverrides= "," >
<if test= "doaCode != null" > doa_code = #{doaCode},</if>
<if test= "doaNumber != null" > doa_number = #{doaNumber},</if>
<if test= "doaSalesmanCode != null" > doa_salesman_code = #{doaSalesmanCode},</if>
<if test= "doaSalesmanBm != null" > doa_salesman_bm = #{doaSalesmanBm},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanName != null" > doa_salesman_name = #{doaSalesmanName},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaSalesmanDeptId != null" > doa_salesman_dept_id = #{doaSalesmanDeptId},</if>
<if test= "doaSalesmanDeptName != null" > doa_salesman_dept_name = #{doaSalesmanDeptName},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaSalesmanPhone != null" > doa_salesman_phone = #{doaSalesmanPhone},</if>
<if test= "doaProject != null" > doa_project = #{doaProject},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaCustomerBm != null" > doa_customer_bm = #{doaCustomerBm},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaCustomerName != null" > doa_customer_name = #{doaCustomerName},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaOwnerUnit != null" > doa_owner_unit = #{doaOwnerUnit},</if>
<if test= "doaGeneralcontractUnit != null" > doa_generalcontract_unit = #{doaGeneralcontractUnit},</if>
<if test= "doaSubcontractUnit != null" > doa_subcontract_unit = #{doaSubcontractUnit},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaAuthorizer != null" > doa_authorizer = #{doaAuthorizer},</if>
<if test= "doaAuthorizerPhone != null" > doa_authorizer_phone = #{doaAuthorizerPhone},</if>
<if test= "doaAuthorizerIdentificationNumber != null" > doa_authorizer_identification_number = #{doaAuthorizerIdentificationNumber},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaAuthorizationDuration != null" > doa_authorization_duration = #{doaAuthorizationDuration},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaPowerAttorneyPurpose != null" > doa_power_attorney_purpose = #{doaPowerAttorneyPurpose},</if>
<if test= "doaFormat != null" > doa_format = #{doaFormat},</if>
2024-08-05 17:16:54 +08:00
<if test= "doaRemark != null" > doa_remark = #{doaRemark},</if>
<if test= "doaRejectionReasons != null" > doa_rejection_reasons = #{doaRejectionReasons},</if>
<if test= "doaStandardizer != null" > doa_standardizer = #{doaStandardizer},</if>
<if test= "doaArchiving != null" > doa_archiving = #{doaArchiving},</if>
<if test= "doaVicePresidentApproved != null" > doa_vice_president_approved = #{doaVicePresidentApproved},</if>
<if test= "doaApprovalStatus != null" > doa_approval_status = #{doaApprovalStatus},</if>
<if test= "doaOaApprovalStatus != null" > doa_oa_approval_status = #{doaOaApprovalStatus},</if>
2024-08-07 16:25:31 +08:00
<if test= "doaOaRemark != null" > doa_oa_remark = #{doaOaRemark},</if>
2024-08-05 17:16:54 +08:00
<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 doa_id = #{doaId}
</update>
<delete id= "deleteAuthorizeByDoaId" parameterType= "String" >
delete from authorize where doa_id = #{doaId}
</delete>
<delete id= "deleteAuthorizeByDoaIds" parameterType= "String" >
delete from authorize where doa_id in
<foreach item= "doaId" collection= "array" open= "(" separator= "," close= ")" >
#{doaId}
</foreach>
</delete>
<select id= "getCode" resultType= "String" statementType= "CALLABLE" >
{call GetSerialNo(#{type,mode=IN,jdbcType=VARCHAR})}
</select>
<select id= "getCodeAT" resultType= "String" statementType= "CALLABLE" >
{call GetSerialNo_Business(#{type,mode=IN,jdbcType=VARCHAR})}
</select>
<select id= "selectOAUserByUserName" resultType= "SysOaAuthorize" >
select top 1 id as userId,departmentid as departmentId from HrmResource where loginid = #{loginid}
</select>
</mapper>