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

353 lines
23 KiB
XML

<?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">
<result property="expId" column="exp_id" />
<result property="expCode" column="exp_code" />
<result property="expNumber" column="exp_number" />
<result property="expPqNumber" column="exp_pq_number" />
<result property="expBidNumber" column="exp_bid_number" />
<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" />
<result property="expBackOfficeId" column="exp_back_office_id" />
<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="expCashDeposit" column="exp_cash_deposit" />
<result property="expLxr" column="exp_lxr" />
<result property="expLxrdh" column="exp_lxrdh" />
<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" />
</resultMap>
<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>
<sql id="selectExpensesVo">
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,
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,
a.exp_expenditure_amount_uppercase, a.exp_staff_tureorfales, a.exp_back_office,a.exp_back_office_id,
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_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,
a.create_by, a.create_time, a.update_by, a.update_time
from expenses a
<include refid="expJoins"/>
</sql>
<select id="selectExpensesList" parameterType="Expenses" resultMap="ExpensesResult">
<include refid="selectExpensesVo"/>
<where>
<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 u.nick_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="expBidArea != null and expBidArea != ''"> and exp_bid_area = #{expBidArea}</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}
</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=",">
<if test="expId != null">exp_id,</if>
<if test="expCode != null">exp_code,</if>
<if test="expNumber != null">exp_number,</if>
<if test="expPqNumber != null">exp_pq_number,</if>
<if test="expBidNumber != null">exp_bid_number,</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>
<if test="expBackOfficeId != null">exp_back_office_id,</if>
<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="expCashDeposit != null">exp_cash_deposit,</if>
<if test="expLxr != null">exp_lxr,</if>
<if test="expLxrdh != null">exp_lxrdh,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="expId != null">#{expId},</if>
<if test="expCode != null">#{expCode},</if>
<if test="expNumber != null">#{expNumber},</if>
<if test="expPqNumber != null">#{expPqNumber},</if>
<if test="expBidNumber != null">#{expBidNumber},</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>
<if test="expBackOfficeId != null">#{expBackOfficeId},</if>
<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="expCashDeposit != null">#{expCashDeposit},</if>
<if test="expLxr != null">#{expLxr},</if>
<if test="expLxrdh != null">#{expLxrdh},</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>
</trim>
</insert>
<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>
<if test="oaUserId != null">exp_oa_userId,</if>
<if test="oaDepartmentId != null">exp_oa_departmentId,</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="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>
<if test="oaUserId != null">#{oaUserId},</if>
<if test="oaDepartmentId != null">#{oaDepartmentId},</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="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>
<update id="updateExpenses" parameterType="Expenses">
update expenses
<trim prefix="SET" suffixOverrides=",">
<if test="expCode != null">exp_code = #{expCode},</if>
<if test="expPqNumber != null">exp_pq_number = #{expPqNumber},</if>
<if test="expNumber != null">exp_number = #{expNumber},</if>
<if test="expBidNumber != null">exp_bid_number = #{expBidNumber},</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>
<if test="expBackOfficeId != null">exp_back_office_id = #{expBackOfficeId},</if>
<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="expCashDeposit != null">exp_cash_deposit = #{expCashDeposit},</if>
<if test="expLxr != null">exp_lxr = #{expLxr},</if>
<if test="expLxrdh != null">exp_lxrdh = #{expLxrdh},</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>
</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>
<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>
<select id="selectOAUserByUserName" resultType="SysOaExpenses">
select top 1 id as userId,departmentid as departmentId from HrmResource where loginid = #{loginid}
</select>
<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>
</mapper>