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.expenses.mapper.ExpensesMapper" >
<resultMap type= "Expenses" id= "ExpensesResult" >
2024-08-12 14:29:37 +08:00
<result property= "expId" column= "exp_id" />
<result property= "expCode" column= "exp_code" />
<result property= "expNumber" column= "exp_number" />
<result property= "expPqCode" column= "exp_pq_code" />
<result property= "expBidCode" column= "exp_bid_code" />
<result property= "expExpenditureMode" column= "exp_expenditure_mode" />
<result property= "expCustomerBm" column= "exp_customer_bm" />
<result property= "expCustomerName" column= "exp_customer_name" />
<result property= "expExpenditurePeople" column= "exp_expenditure_people" />
<result property= "expProject" column= "exp_project" />
<result property= "expReturnDate" column= "exp_return_date" />
<result property= "expExpenditureType" column= "exp_expenditure_type" />
<result property= "expExpenditureAmount" column= "exp_expenditure_amount" />
<result property= "expBidArea" column= "exp_bid_area" />
<result property= "expExpenditureDate" column= "exp_expenditure_date" />
<result property= "expExpenditureAmountUppercase" column= "exp_expenditure_amount_uppercase" />
<result property= "expStaffTureorfales" column= "exp_staff_tureorfales" />
<result property= "expBackOffice" column= "exp_back_office" />
2024-08-13 11:26:46 +08:00
<result property= "expBackOfficeId" column= "exp_back_office_id" />
2024-08-12 14:29:37 +08:00
<result property= "expSalesmanCode" column= "exp_salesman_code" />
<result property= "expSalesmanBm" column= "exp_salesman_bm" />
<result property= "expSalesmanName" column= "exp_salesman_name" />
<result property= "expSalesmanDeptId" column= "exp_salesman_dept_id" />
<result property= "expSalesmanDeptName" column= "exp_salesman_dept_name" />
<result property= "expDispatchStatus" column= "exp_dispatch_status" />
<result property= "expAccountName" column= "exp_account_name" />
<result property= "expAccountNumber" column= "exp_account_number" />
<result property= "expDepositBank" column= "exp_deposit_bank" />
<result property= "expLineNumberAndOthres" column= "exp_line_number_and_othres" />
<result property= "expRequestRemark" column= "exp_request_remark" />
<result property= "expReturnRemark" column= "exp_return_remark" />
<result property= "expApprovalStatus" column= "exp_approval_status" />
<result property= "expOaApprovalStatus" column= "exp_oa_approval_status" />
<result property= "expOaRemark" column= "exp_oa_remark" />
<result property= "expReceiveUserId" column= "exp_receive_user_id" />
<result property= "expReceiveUserNickName" column= "exp_receive_user_nick_name" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
2024-08-05 17:16:54 +08:00
</resultMap>
2024-08-12 14:29:37 +08:00
<sql id= "expJoins" >
left join sys_user u on u.user_id=a.create_by
left join sys_user u2 on u2.user_id=a.exp_receive_user_id
left join sys_dept d on u.dept_id = d.dept_id
</sql>
2024-08-05 17:16:54 +08:00
<sql id= "selectExpensesVo" >
2024-08-12 14:29:37 +08:00
select a.exp_id, a.exp_code, a.exp_pq_code, a.exp_number, a.exp_bid_code, a.exp_expenditure_mode, a.exp_customer_bm,
a.exp_customer_name, a.exp_expenditure_people, a.exp_project, a.exp_return_date,
a.exp_expenditure_type, a.exp_expenditure_amount, a.exp_bid_area, a.exp_expenditure_date,
2024-08-13 11:26:46 +08:00
a.exp_expenditure_amount_uppercase, a.exp_staff_tureorfales, a.exp_back_office,a.exp_back_office_id,
2024-08-12 14:29:37 +08:00
a.exp_salesman_code, a.exp_salesman_bm, a.exp_salesman_name, a.exp_salesman_dept_id,
a.exp_salesman_dept_name, a.exp_dispatch_status, a.exp_account_name, a.exp_account_number,
a.exp_deposit_bank, a.exp_line_number_and_othres, a.exp_request_remark, a.exp_return_remark,
a.exp_approval_status, a.exp_oa_approval_status,a.exp_oa_remark, a.exp_receive_user_id, u2.nick_name exp_receive_user_nick_name,
a.create_by, a.create_time, a.update_by, a.update_time
from expenses a
<include refid= "expJoins" />
2024-08-05 17:16:54 +08:00
</sql>
<select id= "selectExpensesList" parameterType= "Expenses" resultMap= "ExpensesResult" >
<include refid= "selectExpensesVo" />
<where >
2024-08-12 14:29:37 +08:00
<if test= "expNumber != null and expNumber != ''" > and exp_number like concat('%', #{expNumber}, '%')</if>
<if test= "expExpenditureMode != null and expExpenditureMode != ''" > and exp_expenditure_mode = #{expExpenditureMode}</if>
<if test= "expCustomerName != null and expCustomerName != ''" > and exp_customer_name like concat('%', #{expCustomerName}, '%')</if>
<if test= "expProject != null and expProject != ''" > and exp_project like concat('%', #{expProject}, '%')</if>
<if test= "expExpenditureType != null and expExpenditureType != ''" > and exp_expenditure_type = #{expExpenditureType}</if>
<if test= "expExpenditureAmount != null " > and exp_expenditure_amount like concat('%', #{expExpenditureAmount}, '%')</if>
<if test= "params.beginExpExpenditureDate != null and params.beginExpExpenditureDate != '' and params.endExpExpenditureDate != null and params.endExpExpenditureDate != ''" > and exp_expenditure_date between #{params.beginExpExpenditureDate} and #{params.endExpExpenditureDate}</if>
<if test= "expSalesmanName != null and expSalesmanName != ''" > and exp_salesman_name like concat('%', #{expSalesmanName}, '%')</if>
<if test= "expRequestRemark != null and expRequestRemark != ''" > and exp_request_remark like concat('%', #{expRequestRemark}, '%')</if>
<if test= "expApprovalStatus != null and expApprovalStatus != ''" > and exp_approval_status = #{expApprovalStatus}</if>
<if test= "expDispatchStatus != null and expDispatchStatus != ''" > and exp_dispatch_status = #{expDispatchStatus}</if>
<if test= "expReceiveUserId != null and expReceiveUserId != ''" > and exp_receive_user_id = #{expReceiveUserId}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
2024-08-05 17:16:54 +08:00
</where>
</select>
<select id= "selectExpensesByExpId" parameterType= "String" resultMap= "ExpensesResult" >
<include refid= "selectExpensesVo" />
where exp_id = #{expId}
</select>
<insert id= "insertExpenses" parameterType= "Expenses" >
insert into expenses
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
2024-08-12 14:29:37 +08:00
<if test= "expId != null" > exp_id,</if>
<if test= "expCode != null" > exp_code,</if>
<if test= "expNumber != null" > exp_number,</if>
<if test= "expPqCode != null" > exp_pq_code,</if>
<if test= "expBidCode != null" > exp_bid_code,</if>
<if test= "expExpenditureMode != null" > exp_expenditure_mode,</if>
<if test= "expCustomerBm != null" > exp_customer_bm,</if>
<if test= "expCustomerName != null" > exp_customer_name,</if>
<if test= "expExpenditurePeople != null" > exp_expenditure_people,</if>
<if test= "expProject != null" > exp_project,</if>
<if test= "expReturnDate != null" > exp_return_date,</if>
<if test= "expExpenditureType != null" > exp_expenditure_type,</if>
<if test= "expExpenditureAmount != null" > exp_expenditure_amount,</if>
<if test= "expBidArea != null" > exp_bid_area,</if>
<if test= "expExpenditureDate != null" > exp_expenditure_date,</if>
<if test= "expExpenditureAmountUppercase != null" > exp_expenditure_amount_uppercase,</if>
<if test= "expStaffTureorfales != null" > exp_staff_tureorfales,</if>
<if test= "expBackOffice != null" > exp_back_office,</if>
2024-08-13 11:26:46 +08:00
<if test= "expBackOfficeId != null" > exp_back_office_id,</if>
2024-08-12 14:29:37 +08:00
<if test= "expSalesmanCode != null" > exp_salesman_code,</if>
<if test= "expSalesmanBm != null" > exp_salesman_bm,</if>
<if test= "expSalesmanName != null" > exp_salesman_name,</if>
<if test= "expSalesmanDeptId != null" > exp_salesman_dept_id,</if>
<if test= "expSalesmanDeptName != null" > exp_salesman_dept_name,</if>
<if test= "expDispatchStatus != null" > exp_dispatch_status,</if>
<if test= "expAccountName != null" > exp_account_name,</if>
<if test= "expAccountNumber != null" > exp_account_number,</if>
<if test= "expDepositBank != null" > exp_deposit_bank,</if>
<if test= "expLineNumberAndOthres != null" > exp_line_number_and_othres,</if>
<if test= "expRequestRemark != null" > exp_request_remark,</if>
<if test= "expReturnRemark != null" > exp_return_remark,</if>
<if test= "expApprovalStatus != null" > exp_approval_status,</if>
<if test= "expOaApprovalStatus != null" > exp_oa_approval_status,</if>
<if test= "expOaRemark != null" > exp_oa_remark,</if>
<if test= "expReceiveUserId != null" > exp_receive_user_id,</if>
<if test= "expReceiveUserNickName != null" > exp_receive_user_nick_name,</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>
2024-08-05 17:16:54 +08:00
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
2024-08-12 14:29:37 +08:00
<if test= "expId != null" > #{expId},</if>
<if test= "expCode != null" > #{expCode},</if>
<if test= "expNumber != null" > #{expNumber},</if>
<if test= "expPqCode != null" > #{expPqCode},</if>
<if test= "expBidCode != null" > #{expBidCode},</if>
<if test= "expExpenditureMode != null" > #{expExpenditureMode},</if>
<if test= "expCustomerBm != null" > #{expCustomerBm},</if>
<if test= "expCustomerName != null" > #{expCustomerName},</if>
<if test= "expExpenditurePeople != null" > #{expExpenditurePeople},</if>
<if test= "expProject != null" > #{expProject},</if>
<if test= "expReturnDate != null" > #{expReturnDate},</if>
<if test= "expExpenditureType != null" > #{expExpenditureType},</if>
<if test= "expExpenditureAmount != null" > #{expExpenditureAmount},</if>
<if test= "expBidArea != null" > #{expBidArea},</if>
<if test= "expExpenditureDate != null" > #{expExpenditureDate},</if>
<if test= "expExpenditureAmountUppercase != null" > #{expExpenditureAmountUppercase},</if>
<if test= "expStaffTureorfales != null" > #{expStaffTureorfales},</if>
<if test= "expBackOffice != null" > #{expBackOffice},</if>
2024-08-13 11:26:46 +08:00
<if test= "expBackOfficeId != null" > #{expBackOfficeId},</if>
2024-08-12 14:29:37 +08:00
<if test= "expSalesmanCode != null" > #{expSalesmanCode},</if>
<if test= "expSalesmanBm != null" > #{expSalesmanBm},</if>
<if test= "expSalesmanName != null" > #{expSalesmanName},</if>
<if test= "expSalesmanDeptId != null" > #{expSalesmanDeptId},</if>
<if test= "expSalesmanDeptName != null" > #{expSalesmanDeptName},</if>
<if test= "expDispatchStatus != null" > #{expDispatchStatus},</if>
<if test= "expAccountName != null" > #{expAccountName},</if>
<if test= "expAccountNumber != null" > #{expAccountNumber},</if>
<if test= "expDepositBank != null" > #{expDepositBank},</if>
<if test= "expLineNumberAndOthres != null" > #{expLineNumberAndOthres},</if>
<if test= "expRequestRemark != null" > #{expRequestRemark},</if>
<if test= "expReturnRemark != null" > #{expReturnRemark},</if>
<if test= "expApprovalStatus != null" > #{expApprovalStatus},</if>
<if test= "expOaApprovalStatus != null" > #{expOaApprovalStatus},</if>
<if test= "expOaRemark != null" > #{expOaRemark},</if>
<if test= "expReceiveUserId != null" > #{expReceiveUserId},</if>
<if test= "expReceiveUserNickName != null" > #{expReceiveUserNickName},</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>
2024-08-05 17:16:54 +08:00
</trim>
</insert>
<update id= "updateExpenses" parameterType= "Expenses" >
update expenses
<trim prefix= "SET" suffixOverrides= "," >
2024-08-12 14:29:37 +08:00
<if test= "expCode != null" > exp_code = #{expCode},</if>
<if test= "expPqCode != null" > exp_pq_code = #{expPqCode},</if>
<if test= "expNumber != null" > exp_number = #{expNumber},</if>
<if test= "expBidCode != null" > exp_bid_code = #{expBidCode},</if>
<if test= "expExpenditureMode != null" > exp_expenditure_mode = #{expExpenditureMode},</if>
<if test= "expCustomerBm != null" > exp_customer_bm = #{expCustomerBm},</if>
<if test= "expCustomerName != null" > exp_customer_name = #{expCustomerName},</if>
<if test= "expExpenditurePeople != null" > exp_expenditure_people = #{expExpenditurePeople},</if>
<if test= "expProject != null" > exp_project = #{expProject},</if>
<if test= "expReturnDate != null" > exp_return_date = #{expReturnDate},</if>
<if test= "expExpenditureType != null" > exp_expenditure_type = #{expExpenditureType},</if>
<if test= "expExpenditureAmount != null" > exp_expenditure_amount = #{expExpenditureAmount},</if>
<if test= "expBidArea != null" > exp_bid_area = #{expBidArea},</if>
<if test= "expExpenditureDate != null" > exp_expenditure_date = #{expExpenditureDate},</if>
<if test= "expExpenditureAmountUppercase != null" > exp_expenditure_amount_uppercase = #{expExpenditureAmountUppercase},</if>
<if test= "expStaffTureorfales != null" > exp_staff_tureorfales = #{expStaffTureorfales},</if>
<if test= "expBackOffice != null" > exp_back_office = #{expBackOffice},</if>
2024-08-13 11:26:46 +08:00
<if test= "expBackOfficeId != null" > exp_back_office_id = #{expBackOfficeId},</if>
2024-08-12 14:29:37 +08:00
<if test= "expSalesmanCode != null" > exp_salesman_code = #{expSalesmanCode},</if>
<if test= "expSalesmanBm != null" > exp_salesman_bm = #{expSalesmanBm},</if>
<if test= "expSalesmanName != null" > exp_salesman_name = #{expSalesmanName},</if>
<if test= "expSalesmanDeptId != null" > exp_salesman_dept_id = #{expSalesmanDeptId},</if>
<if test= "expSalesmanDeptName != null" > exp_salesman_dept_name = #{expSalesmanDeptName},</if>
<if test= "expDispatchStatus != null" > exp_dispatch_status = #{expDispatchStatus},</if>
<if test= "expAccountName != null" > exp_account_name = #{expAccountName},</if>
<if test= "expAccountNumber != null" > exp_account_number = #{expAccountNumber},</if>
<if test= "expDepositBank != null" > exp_deposit_bank = #{expDepositBank},</if>
<if test= "expLineNumberAndOthres != null" > exp_line_number_and_othres = #{expLineNumberAndOthres},</if>
<if test= "expRequestRemark != null" > exp_request_remark = #{expRequestRemark},</if>
<if test= "expReturnRemark != null" > exp_return_remark = #{expReturnRemark},</if>
<if test= "expApprovalStatus != null" > exp_approval_status = #{expApprovalStatus},</if>
<if test= "expOaApprovalStatus != null" > exp_oa_approval_status = #{expOaApprovalStatus},</if>
<if test= "expOaRemark != null" > exp_oa_remark = #{expOaRemark},</if>
<if test= "expReceiveUserId != null" > exp_receive_user_id = #{expReceiveUserId},</if>
<if test= "expReceiveUserNickName != null" > exp_receive_user_nick_name = #{expReceiveUserNickName},</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>
2024-08-05 17:16:54 +08:00
</trim>
where exp_id = #{expId}
</update>
<delete id= "deleteExpensesByExpId" parameterType= "String" >
delete from expenses where exp_id = #{expId}
</delete>
<delete id= "deleteExpensesByExpIds" parameterType= "String" >
delete from expenses where exp_id in
<foreach item= "expId" collection= "array" open= "(" separator= "," close= ")" >
#{expId}
</foreach>
</delete>
2024-08-12 14:29:37 +08:00
<select id= "getCode" resultType= "String" statementType= "CALLABLE" >
{call GetSerialNo(#{type,mode=IN,jdbcType=VARCHAR})}
</select>
<select id= "getCodeExp" resultType= "String" statementType= "CALLABLE" >
{call GetSerialNo_Business(#{type,mode=IN,jdbcType=VARCHAR})}
</select>
2024-08-12 17:22:13 +08:00
2024-08-13 11:26:46 +08:00
<select id= "selectOAUserByUserName" resultType= "SysOaExpenses" >
2024-08-12 17:22:13 +08:00
select top 1 id as userId,departmentid as departmentId from HrmResource where loginid = #{loginid}
</select>
2024-08-13 11:26:46 +08:00
<select id= "oaOfficeStaff" resultType= "OaOfficeStaff" >
select a.resourceid expBackOfficeId,b.lastname expBackOffice
from hrmrolemembers as a
left join HrmResource as b on a.resourceid=b.id
where a.ROLEID=35
</select>
2024-08-05 17:16:54 +08:00
</mapper>