You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
8.8 KiB

<?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.daqing.financial.guarantee.mapper.DgWorkConferenceConsiderMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.daqing.framework.domain.guarantee.DgWorkConferenceConsider">
<id column="id" property="id" />
<result column="company_id" property="companyId" />
<result column="consider_id" property="considerId" />
<result column="remark" property="remark" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 通过角色查询所有数据 -->
<select id="list" resultType="com.daqing.framework.domain.guarantee.po.DgWorkConferencePO">
SELECT a.id AS business_id,a.business_code AS business_code,a.business_type AS business_type,a.apply_amount AS apply_amount,
a.apply_time AS apply_time,a.create_time AS create_time,c.name AS name,c.phone AS phone,w.id AS id,
w.role_id AS role_id,w.audit_status AS audit_status,w.operation_status AS operation_status,
b.business_status AS business_status,i.user_id AS i_user_id,ass.emp_id AS ass_user_id,m.emp_id AS m_user_id,
ab.A AS a_user_id,ab.B AS b_user_id
FROM dg_work_conference_consider AS w
LEFT JOIN dg_apply_amount_info AS a
ON a.id = w.business_id
left join dg_business_company c on c.business_id = a.id
/* LEFT JOIN crms_company_customer AS cc
ON a.company_id = cc.id
LEFT JOIN crms_customer AS c
ON cc.customer_id = c.id*/
LEFT JOIN dg_business_process_status AS b
ON b.business_id = a.id
LEFT JOIN (SELECT business_id,SUM(CASE role_id WHEN 59 THEN emp_id ELSE 0 END) AS A,
SUM(CASE role_id WHEN 60 THEN emp_id ELSE 0 END) AS B
FROM dg_guarantee_assign_user GROUP BY business_id) AS ab
ON a.id = ab.business_id
LEFT JOIN dg_compliance_investigation AS i
ON a.id = i.business_id
LEFT JOIN dg_assets_investigation AS ass
ON a.id = ass.business_id
LEFT JOIN dg_message_investigation AS m
ON a.id = m.business_id
WHERE /*c.del_or_not = 0*/
/*AND*/ (w.user_id = #{userId} OR w.user_id IS NULL)
AND w.role_id IN
<foreach collection="roleIds" open="(" separator="," close=")" item="roleId">
#{roleId}
</foreach>
AND i.role_id = 70
AND ass.role_id = 64
AND m.role_id = 67
<if test="codeOrName != null and codeOrName != ''">
AND (a.business_code LIKE CONCAT('%',#{codeOrName},'%') OR c.name LIKE CONCAT('%',#{codeOrName},'%'))
</if>
ORDER BY a.create_time DESC
</select>
<select id="excelList" resultType="com.daqing.framework.domain.guarantee.po.DgWorkConferencePO">
SELECT a.business_code AS business_code,a.business_type AS business_type,a.apply_amount AS apply_amount,
a.apply_time AS apply_time,a.create_time AS create_time,c.name AS name,c.phone AS phone,w.audit_status AS audit_status,
w.operation_status AS operation_status,b.business_status AS business_status,i.user_id AS i_user_id,ass.emp_id AS ass_user_id,
m.emp_id AS m_user_id,ab.A AS a_user_id,ab.B AS b_user_id
FROM dg_work_conference_consider AS w
LEFT JOIN dg_apply_amount_info AS a
ON a.id = w.business_id
left join dg_business_company c on c.business_id = a.id
/* LEFT JOIN crms_company_customer AS cc
ON a.company_id = cc.id
LEFT JOIN crms_customer AS c
ON cc.customer_id = c.id*/
LEFT JOIN dg_business_process_status AS b
ON b.business_id = a.id
LEFT JOIN (SELECT business_id,SUM(CASE role_id WHEN 59 THEN emp_id ELSE 0 END) AS A,
SUM(CASE role_id WHEN 60 THEN emp_id ELSE 0 END) AS B
FROM dg_guarantee_assign_user GROUP BY business_id) AS ab
ON a.id = ab.business_id
LEFT JOIN dg_compliance_investigation AS i
ON a.id = i.business_id
LEFT JOIN dg_assets_investigation AS ass
ON a.id = ass.business_id
LEFT JOIN dg_message_investigation AS m
ON a.id = m.business_id
WHERE /*c.del_or_not = 0*/
/*AND*/ i.role_id = 70
AND ass.role_id = 64
AND m.role_id = 67
AND w.id IN
<foreach collection="ids" open="(" separator="," close=")" item="id">
#{id}
</foreach>
ORDER BY a.create_time DESC
</select>
<!-- 审议 -->
<update id="check">
UPDATE dg_work_conference_consider
SET user_id = #{userId},opinion = #{opinion},audit_status = #{auditStatus},operation_status = #{operationStatus},
update_time = #{date},join_judge = #{joinJudge}
WHERE id = #{id}
</update>
<!-- 获取一个工作会对象 -->
<select id="getWorkConferenceConsider" parameterType="integer" resultType="com.daqing.framework.domain.guarantee.DgWorkConferenceConsider">
SELECT company_id,business_id FROM dg_work_conference_consider WHERE id = #{id}
</select>
<!-- 新增一条贷审会数据 -->
<insert id="insertLoanCommitteeConsider" parameterType="com.daqing.framework.domain.guarantee.DgLoanCommitteeConsider">
INSERT INTO dg_loan_committee_consider (business_id,company_id,role_id,status,operating_status,create_time,update_time)
VALUES (#{lcc.businessId},#{lcc.companyId},#{lcc.roleId},#{lcc.status},#{lcc.operatingStatus},#{lcc.createTime},#{lcc.updateTime})
</insert>
<select id="query" parameterType="integer" resultType="com.daqing.framework.domain.guarantee.DgWorkConferenceConsider">
SELECT opinion AS remark,join_judge FROM dg_work_conference_consider WHERE id = #{id}
</select>
<!-- 改变所有业务id相同的审核状态,用于拒绝或者驳回 -->
<update id="updateAuditStatusByBusinessId">
UPDATE dg_work_conference_consider SET audit_status = #{auditStatus} WHERE business_id = #{businessId}
</update>
<!-- 根据id改变当前数据的操作状态 -->
<update id="updateOperationStatusById">
UPDATE dg_work_conference_consider SET operation_status = #{operationStatus},opinion = #{opinion} WHERE id = #{id}
</update>
<!-- 更新操作状态 -->
<update id="updateOperationStatus">
UPDATE dg_work_conference_consider SET operation_status = #{operationStatus} WHERE id = #{id}
</update>
<!-- 根据id绑定用户id -->
<update id="updateWorkConferenceUserIdById">
UPDATE dg_work_conference_consider SET user_id = #{userId} WHERE id = #{id}
</update>
<!-- <select id="selectWorkConferenceList" resultType="com.daqing.financial.guarantee.model.response.DgNoticeListResponse">
SELECT au.id,au.role_id,ai.business_code,au.create_time
FROM dg_work_conference_consider au
left join dg_apply_amount_info ai on au.business_id = ai.id
<where>
au.role_id in
<foreach collection="roleIdlist" open="(" separator="," close=")" item="id">
#{id}
</foreach>
<if test="userId != null and userId != ''">
AND (au.user_id =#{userId} or au.user_id is null or au.user_id ='')
</if>
AND au.operation_status=1
</where>
</select>-->
<select id="selectWorkConferenceList" resultType="com.daqing.financial.guarantee.model.response.DgNoticeListResponse">
SELECT w.id,w.business_id,a.business_code,a.business_type,a.apply_amount,
a.apply_time,a.create_time,c.name,c.phone,
w.role_id,w.audit_status AS status,w.operation_status AS operatingStatus,
b.business_status,i.user_id AS i_user_id,ass.emp_id AS ass_user_id,m.emp_id AS m_user_id,
ab.A AS a_user_id,ab.B AS b_user_id
FROM dg_work_conference_consider AS w
LEFT JOIN dg_apply_amount_info AS a ON a.id = w.business_id
LEFT JOIN crms_company_customer AS cc ON a.company_id = cc.id
LEFT JOIN crms_customer AS c ON cc.customer_id = c.id
LEFT JOIN dg_business_process_status AS b ON b.business_id = a.id
LEFT JOIN (SELECT business_id,SUM(CASE role_id WHEN 59 THEN emp_id ELSE 0 END) AS A,
SUM(CASE role_id WHEN 60 THEN emp_id ELSE 0 END) AS B
FROM dg_guarantee_assign_user GROUP BY business_id) AS ab
ON a.id = ab.business_id
LEFT JOIN dg_compliance_investigation AS i ON a.id = i.business_id
LEFT JOIN dg_assets_investigation AS ass ON a.id = ass.business_id
LEFT JOIN dg_message_investigation AS m ON a.id = m.business_id
WHERE c.del_or_not = 0
AND (w.user_id = #{userId} OR w.user_id IS NULL)
AND w.role_id IN
<foreach collection="roleIdlist" open="(" separator="," close=")" item="roleId">
#{roleId}
</foreach>
AND i.role_id = 70
AND ass.role_id = 64
AND m.role_id = 67
AND w.operation_status=1
</select>
</mapper>