• 动态sql+模糊查询+条件匹配示例


    
    
    IPage<ContractSynopsisVo> findContractList(@Param("toPage") IPage<ContractListConditionDto> toPage,
    @Param("dto") ContractListConditionDto contractListConditionDto);
     
    <select id="findContractList" resultType="com.tgchina.server.contract.module.approach.vo.ContractSynopsisVo">
    select c.contract_id,
    c.contract_name,
    c.contract_code,
    c.customer_id,
    c.customer_name,
    c.project_id,
    c.operation_manager,
    c.paper_archive_state,
    c.electronic_archive_state
    from tb_ct_contract as c left join tb_ct_contract_coordination tccc on c.contract_id = tccc.contract_id
    <where>
    c.is_delete = 0
    and c.auth_state = 4
    <if test="dto.viewType != null and dto.viewType == 2">
    and ( c.operation_manager = #{dto.operationManager} or tccc.collaborative_business_user_id = #{dto.operationManager})
    </if>
    <if test="dto.orgId != null and dto.orgId != ''">
    and c.org_id = #{dto.orgId}
    </if>
    <if test="dto.deptIdList != null and dto.deptIdList.size() != 0">
    and c.dept_id in
    <foreach close=")" collection="dto.deptIdList" item="item" open="(" separator=",">
    #{item}
    </foreach>
    </if>
    <if test="dto.condition != null and dto.condition != ''">
    and (c.contract_name like concat('%', #{dto.condition}, '%') or
    c.contract_code like concat('%', #{dto.condition}, '%') or
    c.project_name like concat('%', #{dto.condition}, '%') or
    c.customer_name like concat('%', #{dto.condition}, '%'))
    </if>
    </where>
    order by c.update_time desc
    </select>
     
  • 相关阅读:
    Linux命令:sed命令
    Linux命令:grep命令 | egrep命令
    Linux命令:find命令
    bash脚本编程
    Linux命令:vi | vim命令
    Linux文件权限管理
    237. 删除链表中的节点
    160. 相交链表
    538. 把二叉搜索树转换为累加树
    543.Diameter of Binary Tree
  • 原文地址:https://www.cnblogs.com/dsds/p/16387842.html
Copyright © 2020-2023  润新知