|
|
|
|
examinationFinancialByQuery
|
|
|
|
|
===
|
|
|
|
|
* 根据条件获取ExaminationFinancial数据 用于学生创建实训/练习实例 个人业务处理方法
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
examination_financials
|
|
|
|
|
WHERE
|
|
|
|
|
init_balance = #balance#
|
|
|
|
|
AND balance=#balance#
|
|
|
|
|
AND product_assets=0
|
|
|
|
|
|
|
|
|
|
getExaminationsAndUserExaminations
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 获取资产概况所需要的UserExaminations
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
user_examinations ue
|
|
|
|
|
LEFT JOIN examinations es ON ue.examination_id = es.id
|
|
|
|
|
WHERE
|
|
|
|
|
ue.user_id = #id#
|
|
|
|
|
AND es.type = #type#
|
|
|
|
|
@if(type==1){
|
|
|
|
|
AND es.`status` >= 1
|
|
|
|
|
@}
|
|
|
|
|
ORDER BY
|
|
|
|
|
ue.`id` DESC
|
|
|
|
|
LIMIT 0,1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLastExaminationFinancials
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 获取资产概况所需要的UserExaminations
|
|
|
|
|
SELECT
|
|
|
|
|
t1.*
|
|
|
|
|
FROM
|
|
|
|
|
examination_financials t1
|
|
|
|
|
JOIN user_examinations ue on t1.id = ue.financial_id
|
|
|
|
|
JOIN examinations es ON ue.examination_id = es.id
|
|
|
|
|
WHERE
|
|
|
|
|
ue.user_id = #userId#
|
|
|
|
|
AND es.type = #type#
|
|
|
|
|
@if(type==1){
|
|
|
|
|
AND es.`status` >= 1
|
|
|
|
|
@}
|
|
|
|
|
ORDER BY
|
|
|
|
|
ue.`id` DESC
|
|
|
|
|
LIMIT 0,1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getFinancialByExaminationId
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据考核ID查询相关资产信息
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
t1.*
|
|
|
|
|
FROM
|
|
|
|
|
examination_financials t1
|
|
|
|
|
JOIN user_examinations t2 on t2.financial_id = t1.id
|
|
|
|
|
JOIN examinations t3 ON t2.examination_id = t3.id
|
|
|
|
|
WHERE
|
|
|
|
|
t3.id = #examinationId#
|
|
|
|
|
ORDER BY
|
|
|
|
|
t3.`id` DESC
|
|
|
|
|
LIMIT 0,1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getBalanceProductAssets
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据考核ID和角色ID查询资产信息
|
|
|
|
|
|
|
|
|
|
select t1.* from examination_financials t1
|
|
|
|
|
JOIN user_examinations t2 on t2.financial_id = t1.id
|
|
|
|
|
WHERE
|
|
|
|
|
t2.examination_id = #examinationId# and t2.instance_id = #instanceId#
|
|
|
|
|
and JSON_CONTAINS(t2.data->'$.roles', #roleId#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateBalanceProductAssets
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据考核ID和角色ID修改资产信息
|
|
|
|
|
|
|
|
|
|
update examination_financials t
|
|
|
|
|
JOIN user_examinations t2 on t2.financial_id = t.id
|
|
|
|
|
SET
|
|
|
|
|
@trim(){
|
|
|
|
|
@if(!isEmpty(balance)){
|
|
|
|
|
t.balance =#balance#,
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(productAssets)){
|
|
|
|
|
t.product_assets =#productAssets#,
|
|
|
|
|
@}
|
|
|
|
|
@}
|
|
|
|
|
WHERE
|
|
|
|
|
t2.examination_id = #examinationId#
|
|
|
|
|
and JSON_CONTAINS(t2.data->'$.roles', #roleId#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
incrementBalance
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据考核ID增加资产信息
|
|
|
|
|
|
|
|
|
|
update examination_financials t1
|
|
|
|
|
JOIN user_examinations t2 on t2.financial_id = t1.id
|
|
|
|
|
SET t1.balance = t1.balance + (#amount#)
|
|
|
|
|
WHERE
|
|
|
|
|
t2.examination_id = #examinationId# and t2.instance_id = #instanceId#
|
|
|
|
|
and JSON_CONTAINS(t2.data->'$.roles', #roleId#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
decrementBalance
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据考核ID减少资产信息
|
|
|
|
|
|
|
|
|
|
update examination_financials t1
|
|
|
|
|
JOIN user_examinations t2 on t2.financial_id = t1.id
|
|
|
|
|
SET t1.balance = t1.balance - (#amount#)
|
|
|
|
|
WHERE
|
|
|
|
|
t2.examination_id = #examinationId# and t2.instance_id = #instanceId#
|
|
|
|
|
and JSON_CONTAINS(t2.data->'$.roles', #roleId#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
incrementProductAssets
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据考核ID增加资产信息
|
|
|
|
|
|
|
|
|
|
update examination_financials t1
|
|
|
|
|
JOIN user_examinations t2 on t2.financial_id = t1.id
|
|
|
|
|
SET t1.product_assets = t1.product_assets + (#amount#)
|
|
|
|
|
WHERE
|
|
|
|
|
t2.examination_id = #examinationId# and t2.instance_id = #instanceId#
|
|
|
|
|
and JSON_CONTAINS(t2.data->'$.roles', #roleId#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
decrementProductAssets
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据考核ID减少资产信息
|
|
|
|
|
|
|
|
|
|
update examination_financials t1
|
|
|
|
|
JOIN user_examinations t2 on t2.financial_id = t1.id
|
|
|
|
|
SET t1.product_assets = t1.product_assets - (#amount#)
|
|
|
|
|
WHERE
|
|
|
|
|
t2.examination_id = #examinationId# and t2.instance_id = #instanceId#
|
|
|
|
|
and JSON_CONTAINS(t2.data->'$.roles', #roleId#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryByCondition
|
|
|
|
|
===
|
|
|
|
|
* 根据不为空的参数进行分页查询
|
|
|
|
|
|
|
|
|
|
select
|
|
|
|
|
@pageTag(){
|
|
|
|
|
t.*
|
|
|
|
|
@}
|
|
|
|
|
from examination_financials t
|
|
|
|
|
where 1=1
|
|
|
|
|
@//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行
|
|
|
|
|
and #function("examinationFinancials.query")#
|
|
|
|
|
@if(!isEmpty(id)){
|
|
|
|
|
and t.id =#id#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(createdAt)){
|
|
|
|
|
and t.created_at =#createdAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(updatedAt)){
|
|
|
|
|
and t.updated_at =#updatedAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(data)){
|
|
|
|
|
and t.data =#data#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(initBalance)){
|
|
|
|
|
and t.init_balance =#initBalance#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(balance)){
|
|
|
|
|
and t.balance =#balance#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(productAssets)){
|
|
|
|
|
and t.product_assets =#productAssets#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseRate)){
|
|
|
|
|
and t.raise_rate =#raiseRate#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseOrders)){
|
|
|
|
|
and t.raise_orders =#raiseOrders#
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteExaminationFinancialsByIds
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 批量删除
|
|
|
|
|
|
|
|
|
|
delete from examination_financials where find_in_set(id,#ids#)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getExaminationFinancialsValues
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
|
|
|
|
select t.*
|
|
|
|
|
from examination_financials t
|
|
|
|
|
where 1=1
|
|
|
|
|
@if(!isEmpty(id)){
|
|
|
|
|
and t.id =#id#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(createdAt)){
|
|
|
|
|
and t.created_at =#createdAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(updatedAt)){
|
|
|
|
|
and t.updated_at =#updatedAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(data)){
|
|
|
|
|
and t.data =#data#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(initBalance)){
|
|
|
|
|
and t.init_balance =#initBalance#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(balance)){
|
|
|
|
|
and t.balance =#balance#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(productAssets)){
|
|
|
|
|
and t.product_assets =#productAssets#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseRate)){
|
|
|
|
|
and t.raise_rate =#raiseRate#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseOrders)){
|
|
|
|
|
and t.raise_orders =#raiseOrders#
|
|
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getValuesByQuery
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
|
|
|
|
select t.*
|
|
|
|
|
from examination_financials t
|
|
|
|
|
where 1=1
|
|
|
|
|
@if(!isEmpty(id)){
|
|
|
|
|
and t.id =#id#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(createdAt)){
|
|
|
|
|
and t.created_at =#createdAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(updatedAt)){
|
|
|
|
|
and t.updated_at =#updatedAt#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(data)){
|
|
|
|
|
and t.data =#data#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(initBalance)){
|
|
|
|
|
and t.init_balance =#initBalance#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(balance)){
|
|
|
|
|
and t.balance =#balance#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(productAssets)){
|
|
|
|
|
and t.product_assets =#productAssets#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseRate)){
|
|
|
|
|
and t.raise_rate =#raiseRate#
|
|
|
|
|
@}
|
|
|
|
|
@if(!isEmpty(raiseOrders)){
|
|
|
|
|
and t.raise_orders =#raiseOrders#
|
|
|
|
|
@}
|