| | |
| | | <result column="id" property="id"/> |
| | | <result column="work_order_name" property="workOrderName"/> |
| | | <result column="work_order_code" property="workOrderCode"/> |
| | | <result column="work_order_type" property="workOrderType"/> |
| | | <result column="work_order_type" property="workOrderType" typeHandler="org.sxkj.common.handler.GenericListTypeHandler"/> |
| | | <result column="type_pinyin_first" property="typePinyinFirst"/> |
| | | <result column="device_load_demand" property="deviceLoadDemand"/> |
| | | <result column="recommend_device_ids" property="recommendDeviceIds"/> |
| | | <result column="work_order_status" property="workOrderStatus"/> |
| | |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | </resultMap> |
| | | |
| | | <select id="getWorkOrderDetail" resultType="org.sxkj.gd.workorder.entity.GdWorkOrderEntity"> |
| | | <select id="getWorkOrderDetail" resultMap="gdWorkOrderResultMap"> |
| | | select id, |
| | | work_order_name, |
| | | work_order_code, |
| | | work_order_type, |
| | | type_pinyin_first, |
| | | device_load_demand, |
| | | recommend_device_ids, |
| | | work_order_status, |
| | |
| | | work_order_name, |
| | | work_order_code, |
| | | work_order_type, |
| | | type_pinyin_first, |
| | | device_load_demand, |
| | | recommend_device_ids, |
| | | work_order_status, |
| | |
| | | wo.work_order_name, |
| | | wo.work_order_code, |
| | | wo.work_order_type, |
| | | wo.type_pinyin_first, |
| | | wo.device_load_demand, |
| | | wo.recommend_device_ids, |
| | | wo.work_order_status, |
| | |
| | | <if test="param2.workOrderName != null and param2.workOrderName != ''"> |
| | | and wo.work_order_name like concat('%',#{param2.workOrderName},'%') |
| | | </if> |
| | | <if test="param2.workOrderCode != null and param2.workOrderCode != ''"> |
| | | and wo.work_order_code like concat('%',#{param2.workOrderCode},'%') |
| | | </if> |
| | | <if test="param2.workOrderType != null and param2.workOrderType != ''"> |
| | | and wo.work_order_type::VARCHAR = #{param2.workOrderType}::VARCHAR |
| | | /* 将逗号分隔的字符串转换为带引号的格式,如 "road,road1" 转为 "\"road\",\"road1\"" */ |
| | | and wo.work_order_type like concat('%', |
| | | ( |
| | | select string_agg(concat('"', trim(arr_val), '"'), ',') |
| | | from unnest(string_to_array(#{param2.workOrderType}, ',')) as arr_val |
| | | ), |
| | | '%') |
| | | </if> |
| | | <if test="param2.createUser != null "> |
| | | /* 修改点2:过滤条件也进行类型对齐 */ |
| | | and wo.create_user::VARCHAR = #{param2.createUser}::VARCHAR |
| | | </if> |
| | | <if test="param2.createUserName != null and param2.createUserName != ''"> |
| | | and bu.name like concat('%',#{param2.createUserName},'%') |
| | | </if> |
| | | <if test="param2.serviceParty != null and param2.serviceParty != ''"> |
| | | and wo.service_party like concat('%',#{param2.serviceParty},'%') |
| | | </if> |
| | | <if test="param2.startTime != null and param2.startTime != '' and param2.endTime != null and param2.endTime != ''"> |
| | | and wo.create_time BETWEEN #{param2.startTime}::timestamp AND #{param2.endTime}::timestamp |
| | | and wo.execute_start_time <= #{param2.endTime}::timestamp AND wo.execute_end_time >= #{param2.startTime}::timestamp |
| | | </if> |
| | | <if test="param2.deptList != null and param2.deptList.size > 0"> |
| | | /* 修改点3:IN 查询内部元素类型转换 */ |
| | |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | <!-- 按工单类型拼音首字母排序,然后按 createTime 排序 --> |
| | | ORDER BY |
| | | <choose> |
| | | <when test="param2.typePinyinFirst == 'desc'"> |
| | | wo.type_pinyin_first DESC , |
| | | </when> |
| | | <when test="param2.typePinyinFirst == 'asc'"> |
| | | wo.type_pinyin_first ASC , |
| | | </when> |
| | | <otherwise> |
| | | </otherwise> |
| | | </choose> |
| | | <choose> |
| | | <when test="param2.createTimeOrder == 'asc'"> |
| | | wo.create_time ASC |
| | | </when> |
| | | <otherwise> |
| | | wo.create_time DESC |
| | | </otherwise> |
| | | </choose> |
| | | </select> |
| | | |
| | | |
| | |
| | | |
| | | <!-- 自定义插入语句,使用ST_GeomFromText处理几何数据 --> |
| | | <insert id="saveWorkOrder" parameterType="org.sxkj.gd.workorder.entity.GdWorkOrderEntity"> |
| | | INSERT INTO ja_gd_work_order ( work_order_name, work_order_code, work_order_type, |
| | | INSERT INTO ja_gd_work_order ( work_order_name, work_order_code, work_order_type, type_pinyin_first, |
| | | device_load_demand, recommend_device_ids, work_order_status, |
| | | execute_start_time, execute_end_time, service_party, |
| | | geom, remark, area_code, |
| | | create_user, create_dept, create_time, |
| | | update_user, update_time, status, is_deleted) |
| | | VALUES ( #{workOrderParam.workOrderName}, #{workOrderParam.workOrderCode}, #{workOrderParam.workOrderType}, |
| | | #{workOrderParam.typePinyinFirst}, |
| | | #{workOrderParam.deviceLoadDemand}, #{workOrderParam.recommendDeviceIds}, #{workOrderParam.workOrderStatus}, |
| | | #{workOrderParam.executeStartTime}, #{workOrderParam.executeEndTime}, #{workOrderParam.serviceParty}, |
| | | ST_GeomFromText(#{workOrderParam.geom}), #{workOrderParam.remark}, #{workOrderParam.areaCode}, |
| | |
| | | <if test="workOrderParam.workOrderType != null and workOrderParam.workOrderType != ''"> |
| | | work_order_type = #{workOrderParam.workOrderType}, |
| | | </if> |
| | | <if test="workOrderParam.typePinyinFirst != null and workOrderParam.typePinyinFirst != ''"> |
| | | type_pinyin_first = #{workOrderParam.typePinyinFirst}, |
| | | </if> |
| | | <if test="workOrderParam.deviceLoadDemand != null and workOrderParam.deviceLoadDemand != ''"> |
| | | device_load_demand = #{workOrderParam.deviceLoadDemand}, |
| | | </if> |