JNBusinessTest/ruoyi-system/target/classes/mapper/expenses/ExpensesMapper.xml

352 lines
23 KiB
XML
Raw Normal View History

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" />
2024-08-13 15:58:13 +08:00
<result property="expPqNumber" column="exp_pq_number" />
<result property="expBidNumber" column="exp_bid_number" />
2024-08-12 14:29:37 +08:00
<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" />
2024-08-13 15:58:13 +08:00
<result property="expCashDeposit" column="exp_cash_deposit" />
<result property="expLxr" column="exp_lxr" />
<result property="expLxrdh" column="exp_lxrdh" />
2024-08-12 14:29:37 +08:00
<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-13 15:58:13 +08:00
select a.exp_id, a.exp_code, a.exp_pq_number, a.exp_number, a.exp_bid_number, a.exp_expenditure_mode, a.exp_customer_bm,
2024-08-12 14:29:37 +08:00
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,
2024-08-13 15:58:13 +08:00
a.exp_deposit_bank, a.exp_line_number_and_othres, a.exp_request_remark,a.exp_cash_deposit,a.exp_lxr, a.exp_lxrdh,
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,
2024-08-12 14:29:37 +08:00
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>
2024-08-14 09:05:04 +08:00
<if test="expSalesmanName != null and expSalesmanName != ''"> and u.nick_name like concat('%', #{expSalesmanName}, '%')</if>
2024-08-12 14:29:37 +08:00
<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>
2024-08-13 15:58:13 +08:00
<if test="expPqNumber != null">exp_pq_number,</if>
<if test="expBidNumber != null">exp_bid_number,</if>
2024-08-12 14:29:37 +08:00
<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>
2024-08-13 15:58:13 +08:00
<if test="expCashDeposit != null">exp_cash_deposit,</if>
<if test="expLxr != null">exp_lxr,</if>
<if test="expLxrdh != null">exp_lxrdh,</if>
2024-08-12 14:29:37 +08:00
<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>
2024-08-13 15:58:13 +08:00
<if test="expPqNumber != null">#{expPqNumber},</if>
<if test="expBidNumber != null">#{expBidNumber},</if>
2024-08-12 14:29:37 +08:00
<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>
2024-08-13 15:58:13 +08:00
<if test="expCashDeposit != null">#{expCashDeposit},</if>
<if test="expLxr != null">#{expLxr},</if>
<if test="expLxrdh != null">#{expLxrdh},</if>
2024-08-12 14:29:37 +08:00
<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>
2024-08-13 15:58:13 +08:00
<insert id="insertSysOAExpenses" parameterType="Expenses">
insert into sys_oa_expenses
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="departmentId != null">department_id,</if>
<if test="submissionTime != null">submission_time,</if>
<if test="expId != null">exp_id,</if>
<if test="expCode != null">exp_code,</if>
<if test="expNumber != null">exp_number,</if>
<if test="expBidNumber != null">exp_bid_number,</if>
<if test="expExpenditureMode != null">exp_expenditure_mode,</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="expExpenditureAmountUppercase != null">exp_expenditure_amount_uppercase,</if>
<if test="expBidArea != null">exp_bid_area,</if>
<if test="expExpenditureDate != null">exp_expenditure_date,</if>
<if test="expStaffTureorfales != null">exp_staff_tureorfales,</if>
<if test="expBackOfficeId != null">exp_back_office_id,</if>
2024-08-13 16:34:37 +08:00
<if test="oaUserId != null">exp_oa_userId,</if>
<if test="oaDepartmentId != null">exp_oa_departmentId,</if>
2024-08-13 15:58:13 +08:00
<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="expCashDeposit != null">exp_cash_deposit,</if>
<if test="expLxr != null">exp_lxr,</if>
<if test="expLxrdh != null">exp_lxrdh,</if>
<if test="fileAddress != null">file_address,</if>
<if test="createTime != null">create_time,</if>
<if test="isFinish != null">isFinish,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="departmentId != null">#{departmentId},</if>
<if test="submissionTime != null">#{submissionTime},</if>
<if test="expId != null">#{expId},</if>
<if test="expCode != null">#{expCode},</if>
<if test="expNumber != null">#{expNumber},</if>
<if test="expBidNumber != null">#{expBidNumber},</if>
<if test="expExpenditureMode != null">#{expExpenditureMode},</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="expExpenditureAmountUppercase != null">#{expExpenditureAmountUppercase},</if>
<if test="expBidArea != null">#{expBidArea},</if>
<if test="expExpenditureDate != null">#{expExpenditureDate},</if>
<if test="expStaffTureorfales != null">#{expStaffTureorfales},</if>
<if test="expBackOfficeId != null">#{expBackOfficeId},</if>
2024-08-13 16:34:37 +08:00
<if test="oaUserId != null">#{oaUserId},</if>
<if test="oaDepartmentId != null">#{oaDepartmentId},</if>
2024-08-13 15:58:13 +08:00
<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="expCashDeposit != null">#{expCashDeposit},</if>
<if test="expLxr != null">#{expLxr},</if>
<if test="expLxrdh != null">#{expLxrdh},</if>
<if test="fileAddress != null">#{fileAddress},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isFinish != null">#{isFinish},</if>
</trim>
</insert>
2024-08-05 17:16:54 +08:00
<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>
2024-08-13 15:58:13 +08:00
<if test="expPqNumber != null">exp_pq_number = #{expPqNumber},</if>
2024-08-12 14:29:37 +08:00
<if test="expNumber != null">exp_number = #{expNumber},</if>
2024-08-13 15:58:13 +08:00
<if test="expBidNumber != null">exp_bid_number = #{expBidNumber},</if>
2024-08-12 14:29:37 +08:00
<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>
2024-08-13 15:58:13 +08:00
<if test="expCashDeposit != null">exp_cash_deposit = #{expCashDeposit},</if>
<if test="expLxr != null">exp_lxr = #{expLxr},</if>
<if test="expLxrdh != null">exp_lxrdh = #{expLxrdh},</if>
2024-08-12 14:29:37 +08:00
<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>