| | |
| | | <!-- <select id="parentTree" resultMap="treeNodeResultMap">--> |
| | | <!-- select id, parent_id, dict_value as title, id as "value", id as "key" from blade_dict where is_deleted = 0 and parent_id = 0--> |
| | | <!-- </select>--> |
| | | <sql id="prog_all_columns">id,tenant_id,nc_node_id,code,name,package_name,machine_code,part_no,is_cured, |
| | | <sql id="prog_all_columns">id,tenant_id,nc_node_id,code,name,machine_code,draw_no,is_cured, |
| | | expire_date,process_edition,is_last_edition,is_locked,task_assign_time,status,create_dept,is_deleted,create_time,create_user,update_time,update_user</sql> |
| | | |
| | | <delete id="deleteSubNodes"> |
| | | delete from mdm_nc_node where parent_id=#{nodeId} |
| | | </delete> |
| | | <!-- |
| | | <select id="getCuredNcProgram" resultMap="BaseResultMap"> |
| | | select <include refid="prog_all_columns"/> from mdm_nc_program |
| | | where is_deleted=0 and is_cured=1 and part_no=#{partNo} and is_last_edition=1 |
| | | where is_deleted=0 and is_cured=1 and drawing_no=#{drawingNo} and is_last_edition=1 |
| | | and machine_code in (select code from mdm_machine where machine_group_code=#{machineGroupCode}) |
| | | order by create_time desc |
| | | limit 1 |
| | | </select> |
| | | |
| | | <sql id="all_columns">id,tenant_id,name,parent_id,node_type,status,create_dept,is_deleted,create_time,create_user,update_time,update_user</sql> |
| | | --> |
| | | <sql id="all_columns">id,tenant_id,name,parent_id,parent_ids,node_type,status,create_dept,is_deleted,create_time,create_user,update_time,update_user</sql> |
| | | <sql id="all_columns_n">n.id,n.tenant_id,n.name,n.parent_id,n.parent_ids,n.node_type,n.version_number,n.description,n.remark,n.drawing_no,n.drawing_no_edition,n.craft_edition,n.is_last_edition,n.is_locked,n.process_edition,n.process_no,n.product_model,n.is_cured,n.process_instance_id,n.status,n.create_dept,n.is_deleted,n.create_time,n.create_user,n.update_time,n.update_user</sql> |
| | | <select id="lazyList" resultType="org.springblade.mdm.program.vo.NcNodeVO"> |
| | | select <include refid="all_columns"/>,( |
| | | select <include refid="all_columns_n"/>,dt.dict_value as node_type_name,u.name create_user_name,( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | mdm_nc_node |
| | | WHERE |
| | | parent_id = n.id and is_deleted = 0 |
| | | ) AS "has_children" from mdm_nc_node n where is_deleted=0 and parent_id=#{parentId} |
| | | parent_id = n.id and is_last_edition=1 and is_deleted = 0 |
| | | ) AS "has_children" from mdm_nc_node n left join blade_user u on n.create_user=u.id |
| | | left join blade_dict_biz dt on n.node_type=dt.dict_key and dt.code='nc_node_type' and dt.is_deleted=0 |
| | | where n.is_deleted=0 and n.is_last_edition=1 and n.parent_id=#{parentId} |
| | | </select> |
| | | <select id="programPageQuery" resultType="org.springblade.mdm.program.vo.NcNodeProgramVO"> |
| | | select id,parent_id,machine_code,drawing_no,drawing_no_edition,part_no,process_name,craft_edition from mdm_nc_node n |
| | | <where> |
| | | <if test="query.name!=null and query.name!=''"> |
| | | and n.name like CONCAT('%', #{query.name,jdbcType=VARCHAR},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <!--获取 最新版本的程序(即程序包名 节点 node_type=60)--> |
| | | <select id="getLastProgramNode" resultType="org.springblade.mdm.program.entity.NcNode"> |
| | | select <include refid="all_columns"/> from mdm_nc_node |
| | | where is_deleted=0 and node_type='60' and is_last_edition=1 order by create_time desc limit 1 |
| | | </select> |
| | | |
| | | <!--首页查询--> |
| | | <select id="searchList" resultType="org.springblade.mdm.program.vo.NcNodeVO"> |
| | | select <include refid="all_columns_n"/>,dt.dict_value as node_type_name,u.name create_user_name,( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | mdm_nc_node |
| | | WHERE |
| | | parent_id = n.id and is_deleted = 0 |
| | | ) AS "has_children" from mdm_nc_node n left join blade_user u on n.create_user=u.id |
| | | left join blade_dict_biz dt on n.node_type=dt.dict_key and dt.code='nc_node_type' and dt.is_deleted=0 |
| | | where n.is_deleted=0 and n.node_type=#{nodeType} and n.name like CONCAT('%', #{name}, '%') |
| | | |
| | | </select> |
| | | <select id="searchListInIds" resultType="org.springblade.mdm.program.vo.NcNodeVO"> |
| | | select <include refid="all_columns_n"/>,dt.dict_value as node_type_name,u.name create_user_name,( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | mdm_nc_node |
| | | WHERE |
| | | parent_id = n.id and is_deleted = 0 |
| | | ) AS "has_children" from mdm_nc_node n left join blade_user u on n.create_user=u.id |
| | | left join blade_dict_biz dt on n.node_type=dt.dict_key and dt.code='nc_node_type' and dt.is_deleted=0 |
| | | <where> |
| | | <if test="ids != null and ids.size() > 0"> |
| | | n.id IN |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="ids == null or ids.size() == 0"> |
| | | 1=0 |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="historyByParentIdAndName" resultType="org.springblade.mdm.program.vo.NcNodeVO"> |
| | | select n.id,n.name,n.version_number,n.create_time,n.update_time,u.name create_user_name,n.process_no |
| | | from mdm_nc_node n left join blade_user u on n.create_user=u.id and u.is_deleted=0 |
| | | |
| | | where n.is_deleted=0 and n.parent_id in (select id from mdm_nc_node where parent_id=#{parentNode.parentId}) and n.name=#{name} |
| | | |
| | | </select> |
| | | <select id="searchList2" resultType="org.springblade.mdm.program.vo.NcNodeVO"> |
| | | select <include refid="all_columns_n"/>,dt.dict_value as node_type_name,u.name create_user_name,( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | | FROM |
| | | mdm_nc_node |
| | | WHERE |
| | | parent_id = n.id and is_deleted = 0 |
| | | ) AS "has_children" from mdm_nc_node n left join blade_user u on n.create_user=u.id |
| | | left join blade_dict_biz dt on n.node_type=dt.dict_key and dt.code='nc_node_type' and dt.is_deleted=0 |
| | | <where> |
| | | n.is_deleted=0 and n.node_type='20' and n.name=#{drawingNo} |
| | | <if test="status != null and status != ''"> |
| | | and |
| | | ( |
| | | 1=2 |
| | | <if test='status.contains("1".toString())'> |
| | | or n.parent_ids LIKE '0,1,%' |
| | | </if> |
| | | <if test='status.contains("2".toString())'> |
| | | or n.parent_ids LIKE '0,2,%' |
| | | </if> |
| | | <if test='status.contains("3".toString())'> |
| | | or n.parent_ids LIKE '0,3,%' |
| | | </if> |
| | | |
| | | ) |
| | | </if> |
| | | |
| | | <if test="createTimeBegin != null"> |
| | | and n.create_time>=#{createTimeBegin} |
| | | </if> |
| | | <if test="createTimeEnd != null"> |
| | | and n.create_time<=#{createTimeEnd} |
| | | </if> |
| | | </where> |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | | </mapper> |